连接Janusgraph时报Unable to determine Elasticsearch server version. Default to FIVE.异常
采用的 janusgraph + hbase + es的集群模式,但通过gremlin.sh的console连接janusgraph服务时的如下错:
gremlin> graph = JanusGraphFactory.open('conf/janusgraph-hbase-es.properties');
12:17:34 WARN org.janusgraph.diskstorage.es.rest.RestElasticSearchClient - Unable to determine Elasticsearch server version. Default to FIVE.
java.net.ConnectException: Connection refused
at org.elasticsearch.client.RestClient$SyncResponseListener.get(RestClient.java:952)
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:229)
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:274)
at org.janusgraph.diskstorage.es.rest.RestElasticSearchClient.getMajorVersion(RestElasticSearchClient.java:118)
at org.janusgraph.diskstorage.es.rest.RestElasticSearchClient.<init>(RestElasticSearchClient.java:101)
at org.janusgraph.diskstorage.es.rest.RestClientSetup.getElasticSearchClient(RestClientSetup.java:107)
at org.janusgraph.diskstorage.es.rest.RestClientSetup.connect(RestClientSetup.java:74)
at org.janusgraph.diskstorage.es.ElasticSearchSetup$1.connect(ElasticSearchSetup.java:50)
at org.janusgraph.diskstorage.es.ElasticSearchIndex.interfaceConfiguration(ElasticSearchIndex.java:379)
at org.janusgraph.diskstorage.es.ElasticSearchIndex.<init>(ElasticSearchIndex.java:295)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.janusgraph.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:58)
at org.janusgraph.diskstorage.Backend.getImplementationClass(Backend.java:440)
at org.janusgraph.diskstorage.Backend.getIndexes(Backend.java:427)
at org.janusgraph.diskstorage.Backend.<init>(Backend.java:150)
原因一:配置问题
经过排查,原来是conf/janusgraph-hbase-es.properties
配置有问题。
将
index.search.hostname=127.0.0.1
改成:
index.search.hostname=192.168.1.244,192.168.1.245,192.168.1.246
然后再启动情况如下:
发现hbase还是127.0.0.1不是集群的,所以再将hbase的配置改一下。
即将:storage.hostname=127.0.0.1
改成:storage.hostname=192.168.1.244,192.168.1.245,192.168.1.246
然后再次访问情况如下:
原因二:ES问题
因为gremlin-server用的是es的索引,然后突然发现ES服务根本没起来。也就是说当ES服务没有启动,也会报上述异常。
然后查看ES的启动日志,果然有问题,如下:
然后解决办法可以参考:
elasticsearch启动时遇到的错误