PRO: inspector is not available error 502

Hello,

We are using pro version 2.15.1, we cannot access to inspector, and we got error 502. Same if we try to access to pro api for mount a media node.
My guess is that is related with elasticSearch, I send a error we got at the end of this email.

Please this issue is quite urgent.

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
openvidu-server_1 | [ERROR] 2020-11-05 14:26:05,526 [main] org.springframework.boot.SpringApplication - Application run failed
openvidu-server_1 | org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘elasticSearchConfig’: Invocation of init method failed; nested exception is ElasticsearchStatusException[Elasticsearch exception [type=validation_exception, reason=Validation Failed: 1: this action would add [2] total shards, but this cluster currently has [999]/[1000] maximum shards open;]]
openvidu-server_1 | at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:160)
openvidu-server_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:416)
openvidu-server_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1788)
openvidu-server_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595)
openvidu-server_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
openvidu-server_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
openvidu-server_1 | at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
openvidu-server_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
openvidu-server_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
openvidu-server_1 | at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879)
openvidu-server_1 | at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878)
openvidu-server_1 | at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
openvidu-server_1 | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
openvidu-server_1 | at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
openvidu-server_1 | at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
openvidu-server_1 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
openvidu-server_1 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
openvidu-server_1 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
openvidu-server_1 | at io.openvidu.server.pro.OpenViduServerPro.main(OpenViduServerPro.java:296)
openvidu-server_1 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
openvidu-server_1 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
openvidu-server_1 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
openvidu-server_1 | at java.lang.reflect.Method.invoke(Method.java:498)
openvidu-server_1 | at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
openvidu-server_1 | at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
openvidu-server_1 | at org.springframework.boot.loader.Launcher.launch(Launcher.java:51)
openvidu-server_1 | at org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:597)
openvidu-server_1 | Caused by: org.elasticsearch.ElasticsearchStatusException: Elasticsearch exception [type=validation_exception, reason=Validation Failed: 1: this action would add [2] total shards, but this cluster currently has [999]/[1000] maximum shards open;]
openvidu-server_1 | at org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:177)
openvidu-server_1 | at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:1897)
openvidu-server_1 | at org.elasticsearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:1867)
openvidu-server_1 | at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1624)
openvidu-server_1 | at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1596)
openvidu-server_1 | at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1563)
openvidu-server_1 | at org.elasticsearch.client.IndicesClient.create(IndicesClient.java:139)
openvidu-server_1 | at io.openvidu.server.pro.config.ElasticSearchConfig.createIndex(ElasticSearchConfig.java:115)
openvidu-server_1 | at io.openvidu.server.pro.config.ElasticSearchConfig.init(ElasticSearchConfig.java:92)
openvidu-server_1 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
openvidu-server_1 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
openvidu-server_1 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
openvidu-server_1 | at java.lang.reflect.Method.invoke(Method.java:498)
openvidu-server_1 | at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389)
openvidu-server_1 | at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333)
openvidu-server_1 | at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157)
openvidu-server_1 | … 26 common frames omitted
openvidu-server_1 | Suppressed: org.elasticsearch.client.ResponseException: method [PUT], host [http://127.0.0.1:9200], URI [/filebeat-openvidu-2020.11.05?master_timeout=30s&timeout=30s], status line [HTTP/1.1 400 Bad Request]
openvidu-server_1 | {“error”:{“root_cause”:[{“type”:“validation_exception”,“reason”:“Validation Failed: 1: this action would add [2] total shards, but this cluster currently has [999]/[1000] maximum shards open;”}],“type”:“validation_exception”,“reason”:“Validation Failed: 1: this action would add [2] total shards, but this cluster currently has [999]/[1000] maximum shards open;”},“status”:400}
openvidu-server_1 | at org.elasticsearch.client.RestClient.convertResponse(RestClient.java:283)
openvidu-server_1 | at org.elasticsearch.client.RestClient.performRequest(RestClient.java:261)
openvidu-server_1 | at org.elasticsearch.client.RestClient.performRequest(RestClient.java:235)
openvidu-server_1 | at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1611)
openvidu-server_1 | … 38 common frames omitted

Hello @Anto , I don’t know how important is your Elasticsearch data. There are two ways to solve this:
First option will delete previous data. Second option will try to preserve it, but elasticsearch may take some minutes to start.


First option:

  1. Stop OpenVidu:
cd /opt/openvidu/
./openvidu stop

The next commands are executed as sudo in /opt/openvidu directory

  1. Delete this directory in /opt/openvidu/:
rm -rf elasticsearch
  1. Create again the folder: elasticsearch folder in /opt/openvidu
mkdir elasticsearch
  1. Change permissions to elasticsearch folder
chown -R 1000:1000 elasticsearch
  1. If you have 4GB or more, add this environment variable in your docker-compose.yml in the elasticsearch section:
...
- "ES_JAVA_OPTS=-Xms2g -Xmx2g"
...

It should look like this:

elasticsearch:
        image: docker.elastic.co/elasticsearch/elasticsearch:7.8.0
        restart: always
        environment:
            - discovery.type=single-node
            - "ES_JAVA_OPTS=-Xms2g -Xmx2g"
        ports:
            - 9200:9200
        volumes:
            - ./elasticsearch:/usr/share/elasticsearch/data
  1. Restart openvidu with:
./openvidu start

Second option:
0. Stop OpenVidu:
Stop OpenVidu:

cd /opt/openvidu/
./openvidu stop

The next commands are executed as sudo in /opt/openvidu directory

  1. If you have 4GB of RAM or more, add this environment variable in your docker-compose.yml in the elasticsearch section:
...
- "ES_JAVA_OPTS=-Xms2g -Xmx2g"
...

It should look like this:

elasticsearch:
        image: docker.elastic.co/elasticsearch/elasticsearch:7.8.0
        restart: always
        environment:
            - discovery.type=single-node
            - "ES_JAVA_OPTS=-Xms2g -Xmx2g"
        ports:
            - 9200:9200
        volumes:
            - ./elasticsearch:/usr/share/elasticsearch/data
  1. Restart openvidu with:
./openvidu start

Elasticsearch may take some minutes to start because the problem is probably due because of a lot of data saved or low memory resources.


Be sure to check disk space and RAM. Elasticsearch run better in machines with 8 GB of RAM for example.

I hope this helps
Regards,
Carlos

Hello Carlos,

thank you.

First I tried without remove the elasticsearch folder, but I was not working. So I tried to rm this folder, and now it is working.

Now I have a question: this folder will grow up again, we have to remove this data periodically? The vm has 254GB of disk (the disk was a 11%) and 8GB of Ram.

Thank you really much.
Regards
Antonello

We’ve seen some problems regarding Docker container logs and the index used to store OpenVidu Pro events. (It is called openvidu).

All the indexes in ElasticSearch follow a policy that delete files older than the value indicated in the env variable OPENVIDU_PRO_ELASTICSEARCH_MAX_DAYS_DELETE, but it is not working for openvidu index.

In the next version that is coming the next week we will fix this, openvidu documents older than OPENVIDU_PRO_ELASTICSEARCH_MAX_DAYS_DELETE will be deleted and also you will be able to configure ElasticSearch externally if you want.

Regarding docker logs issues, we will configure a max-size of 100MB for each container running. You can do a cronjob which truncate docker logs to avoid this potential problem of lack of space in disk until the next version:

truncate -s 0 /var/lib/docker/containers/*/*-json.log

Default value of OPENVIDU_PRO_ELASTICSEARCH_MAX_DAYS_DELETE will be 15 days

Regards,
Carlos

Hello Carlos,

thank you a lot for your help. I really appreciate.
I have one more question: could be possible recover the data? Or at least make it consultable?

Thank you.
Regards
Antonello