0

我正在尝试使用 YCSB 将一些数据加载到 Elastic Search 中,但我经常遇到错误NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{gdVShcjUToSDe3eJkHJNxw}{192.168.3.87}{192.168.3.87:9300}]]

这是我对弹性搜索节点的配置。

cluster.name: my-application
node.name: reconf-6
network.host: 192.168.3.87
http.port: 9200
transport.tcp.port: 9300
transport.host: 0.0.0.0
discovery.zen.ping.unicast.hosts: ["elasticsearch-1"]
path.data: data_mount/es
path.logs: data_mount/es

我首先像这样启动了 10 个节点,curl -XGET 'http://elasticsearch-1:9200/_cluster/state?pretty'我可以看到集群中有 10 个节点。

然后我尝试在远程模式下运行 YCSB。然后它报告异常:

Exception in thread "Thread-3" NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{gdVShcjUToSDe3eJkHJNxw}{192.168.3.87}{192.168.3.87:9300}]]
        at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:344)
        at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:242)
        at org.elasticsearch.client.transport.TransportProxyClient.execute(TransportProxyClient.java:59)
        at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:356)
        at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:403)
        at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:392)
        at org.elasticsearch.client.support.AbstractClient$IndicesAdmin.execute(AbstractClient.java:1220)
        at org.elasticsearch.client.support.AbstractClient$IndicesAdmin.exists(AbstractClient.java:1242)
        at com.yahoo.ycsb.db.elasticsearch5.ElasticsearchClient.init(ElasticsearchClient.java:142)
        at com.yahoo.ycsb.DBWrapper.init(DBWrapper.java:85)
        at com.yahoo.ycsb.ClientThread.run(Client.java:415)
        at java.lang.Thread.run(Thread.java:748)

YCSB中启动Client的部分代码如下:

if (remoteMode) {
  settings.put("client.transport.sniff", true)
      .put("client.transport.ignore_cluster_name", false)
      .put("client.transport.ping_timeout", "30s")
      .put("client.transport.nodes_sampler_interval", "30s");
  // Default it to localhost:9300
  String[] nodeList = props.getProperty("es.hosts.list", DEFAULT_REMOTE_HOST).split(",");
  System.out.println("Elasticsearch Remote Hosts = " + props.getProperty("es.hosts.list", DEFAULT_REMOTE_HOST));
  TransportClient tClient = new PreBuiltTransportClient(settings.build());
  for (String h : nodeList) {
    String[] nodes = h.split(":");
    try {
      tClient.addTransportAddress(new InetSocketTransportAddress(
          InetAddress.getByName(nodes[0]),
          Integer.parseInt(nodes[1])
      ));
    } catch (NumberFormatException e) {
      throw new IllegalArgumentException("Unable to parse port number.", e);
    } catch (UnknownHostException e) {
      throw new IllegalArgumentException("Unable to Identify host.", e);
    }
  }
  client = tClient;
}
4

1 回答 1

0

transport.host您是否尝试在 ES 的配置文件中注释掉?它将传输层绑定到本地主机,并且您已经通过network.host. (你需要重启你的节点)

您正在测试哪个版本的 ES?我看到你也在他们的github上留下了评论,所以你已经知道它不适用于 ES 5.xx 原因是 ES 5.xx 拒绝与以前版本的驱动程序连接。

我设法使它与risdenk 的版本一起工作。

于 2017-07-11T14:17:50.040 回答