How to change GLOBAL_OFFLINE configuration when graph can't be instantiated
I am in a case where the index backend has been incorrectly configured to Elasticsearch. Now, when I try to instantiate my graph database, I get a "ConnectException: Connection refused", even if I set('index.search.backend', 'lucene') in JanusGraphFactory.
The setting index.backend is global offline, I should update it when the graph is instantiated but how can I change it if the instantiation fails ?
Thanks
JanusGraph keeps a record of open instances that sometimes is not updated properly. You can clean it with the methods here:
https://docs.janusgraph.org/advanced-topics/recovery/#janusgraph-instance-failure
Maybe it is no problem if your graph is dropped entirely, so you can also check:
https://docs.janusgraph.org/basics/common-questions/#dropping-a-database
After dropping, the graph can be recreated with the right configs.
Best wishes, Marc
Thank you for your reply. In my case I can remove the database and create a new one. But what should I do if I want to retrieve data from a JanusGraph database in which the configured index backend is not available ?
Is there any way to disable index backend without instantiating the database ? Or to make the index errors not fatal during the instantiation (in order to change configuration) ?
Toom.
Hi Toom,
OK, I tried two things. I start with the janusgraph-full-0.5.3 distribution and run (this has gremlin server running with conf/janusgraph-cql-es.properties):
$ bin/janusgraph.sh start
Now I start a gremlin console and I do:
1. graph = JanusGraphFactory.open('conf/janusgraph-cql-es2.properties')
In this case I made a copy of onf/janusgraph-cql-es.properties') and gave elasticsearch a non-existing ip address. This gives the following stacktrace:
17:32:19 WARN org.janusgraph.diskstorage.es.rest.RestElasticSearchClient - Unable to determine Elasticsearch server version. Default to SEVEN.
java.net.ConnectException: Connection refused
at org.elasticsearch.client.RestClient.extractAndWrapCause(RestClient.java:823)
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:248)
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:235)
at org.janusgraph.diskstorage.es.rest.RestElasticSearchClient.getMajorVersion(RestElasticSearchClient.java:137)
at org.janusgraph.diskstorage.es.rest.RestElasticSearchClient.<init>(RestElasticSearchClient.java:117)
at org.janusgraph.diskstorage.es.rest.RestClientSetup.getElasticSearchClient(RestClientSetup.java:107)
at org.janusgraph.diskstorage.es.rest.RestClientSetup.connect(RestClientSetup.java:75)
at org.janusgraph.diskstorage.es.ElasticSearchSetup$1.connect(ElasticSearchSetup.java:51)
at org.janusgraph.diskstorage.es.ElasticSearchIndex.interfaceConfiguration(ElasticSearchIndex.java:445)
at org.janusgraph.diskstorage.es.ElasticSearchIndex.<init>(ElasticSearchIndex.java:332)
(...)
at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:234)
at org.apache.tinkerpop.gremlin.console.Console.<init>(Console.groovy:168)
at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:234)
at org.apache.tinkerpop.gremlin.console.Console.main(Console.groovy:502)
Caused by: java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:716)
at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:174)
at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:148)
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:351)
at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.execute(PoolingNHttpClientConnectionManager.java:221)
at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase$1.run(CloseableHttpAsyncClientBase.java:64)
at java.lang.Thread.run(Thread.java:748)
Could not instantiate implementation: org.janusgraph.diskstorage.es.ElasticSearchIndex
This sounds like the stacktrace you encountered. It does show that janusgraph uses the local properties file. The GLOBAL OFFLINE looks more like a warning that you cannot use heterogenous indexing backend configs and get consistent results. Are you sure your corrected configs are right?
2. graph = JanusGraphFactory.open('conf/janusgraph-cql.properties')
This simply opens the graph without using the indexing backend. So, it is possible to still open the graph.
Best wishes,
Marc
Your solution works if the configuration hasn't been changed yet. If you change the index backend and set a wrong hostname, you cannot access your data anymore:
mgmt = graph.openManagement()
mgmt.set("index.search.hostname", "non-existant.hostname")
mgmt.commit()
Then the database cannot be open.
Regards,
Toom.