群集名称更改后,JanusGraph无法连接到ElasticSearch

时间:2017-11-20 10:29:37

标签: elasticsearch cassandra janusgraph

我正在尝试使用以下配置实例化JanusGraph,使用 Cassandra 作为存储后端, ElasticSearch 作为索引后端:

JanusGraph graph = JanusGraphFactory.build()
    .set("storage.backend", "cassandra")
    .set("storage.hostname", "localhost")

    .set("cache.db-cache", true)
    .set("schema.default", "none")

    .set("index.search.backend", "elasticsearch")
    .set("index.search.elasticsearch.client-only", "false")
    .set("index.search.elasticsearch.local-mode", "true")
    .open();

如果cassandra的cluser名为Test Cluster,则上述代码有效。如果我将其重命名为其他内容,则抛出异常:

java.lang.IllegalArgumentException: Could not instantiate implementation: org.janusgraph.diskstorage.es.ElasticSearchIndex
    at org.janusgraph.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:69)
    at org.janusgraph.diskstorage.Backend.getImplementationClass(Backend.java:477)
    at org.janusgraph.diskstorage.Backend.getIndexes(Backend.java:464)
    at org.janusgraph.diskstorage.Backend.<init>(Backend.java:149)
    at org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration.getBackend(GraphDatabaseConfiguration.java:1850)
    at org.janusgraph.graphdb.database.StandardJanusGraph.<init>(StandardJanusGraph.java:134)
    at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:107)
    at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:97)
    at org.janusgraph.core.JanusGraphFactory$Builder.open(JanusGraphFactory.java:152)
    at engineering.divine.core.GraphFactory.cassandraGraph(GraphFactory.java:403)
    at engineering.divine.core.GraphFactory.graph(GraphFactory.java:298)
    at engineering.divine.core.GraphFactory.getDefault(GraphFactory.java:99)
    at engineering.divine.repository.Repository.listRepositoriesToUpdate(Repository.java:130)
    at engineering.divine.daemon.RepositoryAnalysisDaemon.run(RepositoryAnalysisDaemon.java:24)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
    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:422)
    at org.janusgraph.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:58)
    ... 20 more
Caused by: org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: []
    at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:279)
    at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:198)
    at org.elasticsearch.client.transport.support.InternalTransportClusterAdminClient.execute(InternalTransportClusterAdminClient.java:86)
    at org.elasticsearch.client.support.AbstractClusterAdminClient.health(AbstractClusterAdminClient.java:127)
    at org.elasticsearch.action.admin.cluster.health.ClusterHealthRequestBuilder.doExecute(ClusterHealthRequestBuilder.java:92)
    at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91)
    at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65)
    at org.janusgraph.diskstorage.es.ElasticSearchIndex.<init>(ElasticSearchIndex.java:215)
    ... 25 more

如何使elasticsearch使用我的新群集名称? 使用Max OS X 10.11.6,任何指针都受到高度赞赏。

1 个答案:

答案 0 :(得分:0)

重置您的数据(如果是用于测试目的)

  1. 清除存储后端(Cassandra)中的所有数据
  2. 重新启动所有janusgraph节点
  3. 在JanusGraph

      

    每个配置选项都有一定的可变性级别,用于控制在首次打开数据库后是否以及如何修改它。以下列表描述了可变性级别。

    • 固定
        

      打开数据库后,无法在数据库的整个生命周期内更改这些配置选项

    • GLOBAL_OFFLINE
        

      只有在关闭所有实例时,才能立即为整个数据库集群更改这些选项

    • GLOBAL
        

      这些选项只能在整个数据库群集中进行全局更改   屏蔽的   这些选项是全局的,但可以由本地配置文件覆盖

    • LOCAL
        

      这些选项只能通过本地配置文件提供

    您可以从以下链接

    获取任何配置的可变性级别

    来源:http://docs.janusgraph.org/latest/config-ref.html