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

JanusGraph can not connect to ElasticSearch after Cluster Name change

我正在尝试使用以下配置实例化 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.access1(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. 从存储后端 (Cassandra) 清除所有数据
  2. 重新启动所有 janusgraph 节点

在 JanusGraph 中

Each configuration option has a certain mutability level that governs whether and how it can be modified after the database is opened for the first time. The following listing describes the mutability levels.

  • 已修复

    Once the database has been opened, these configuration options cannot be changed for the entire life of the database

  • GLOBAL_OFFLINE

    These options can only be changed for the entire database cluster at once when all instances are shut down

  • 全球

    These options can only be changed globally across the entire database cluster MASKABLE These options are global but can be overwritten by a local configuration file

  • 本地

    These options can only be provided through a local configuration file

您可以从下面link

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

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