在弹性搜索上使用YCSB

时间:2017-06-22 18:07:43

标签: elasticsearch ycsb

我试图使用YCSB将一些数据加载到弹性搜索中,但我经常遇到错误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中启动客户端的部分代码如下:

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;
}

1 个答案:

答案 0 :(得分:0)

您是否尝试在ES的配置文件中注释掉transport.host?它将传输层绑定到localhost,并且您已经通过network.host指定了机器的IP。 (您需要重新启动节点)

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

我设法使用version of risdenk