没有显示Elasticsearch集群

时间:2020-05-26 11:32:27

标签: linux elasticsearch curl ansible

嗨,我在具有3个节点的集群上安装了带Ansible剧本的Elasticsearch 6.6。 所有节点都在同一端口上。

当我运行查询时:

curl  -u es_admin:<pass> -X GET 'https://<hostname1>:9201/_nodes/process?pretty' -k

我在集群中仅看到一个节点:

{
  "_nodes" : {
    "total" : 1,
    "successful" : 1,
    "failed" : 0
  },
  "cluster_name" : "new_cluster",
  "nodes" : {
    "Qlqcbgs_QmWXpglNVoOApQ" : {
      "name" : "node1",
      "transport_address" : "<IP_address>:9301",
      "host" : "<hostname1>",
      "ip" : "<IP_address>",
      "version" : "6.6.0",
      "build_flavor" : "default",
      "build_type" : "rpm",
      "build_hash" : "<build_hash_number>",
      "roles" : [
        "master",
        "data",
        "ingest"
      ],
      "attributes" : {
        "ml.machine_memory" : "16653647872",
        "xpack.installed" : "true",
        "ml.max_open_jobs" : "20",
        "ml.enabled" : "true"
      },
      "process" : {
        "refresh_interval_in_millis" : 1000,
        "id" : 11674,
        "mlockall" : false
      }
    }
  }
}

我分别为每个节点获得相同的输出:

curl  -u es_admin:<pass> -X GET 'https://<hostname2>:9201/_nodes/process?pretty' -k
curl  -u es_admin:<pass> -X GET 'https://<hostname3>:9201/_nodes/process?pretty' -k

在elasticsearch.template.yml下,我确实看到了其他节点。例如,如果我转到node1,我会看到另外两个:

discovery.zen.ping.unicast.hosts:
- <hostname2>:9301
- <hostname3>:9301

这是elasticsearch.yml:

node.name: node1

network.host: <hostname>

http.port: 9201

transport.tcp.port: 9301

node.master: true

node.data: true

node.ingest: true

search.remote.connect: true



#################################### Paths ####################################

# Path to directory containing configuration (this file and logging.yml):

path.data: /var/lib/elasticsearch/node1

path.logs: /var/log/elasticsearch/node1

discovery.zen.ping.unicast.hosts:
- <hostname2>:9301
- <hostname3>:9301



xpack.license.self_generated.type: trial


node.ml: true


xpack.ml.enabled: true


xpack.security.audit.enabled: true

xpack.security.enabled: true



xpack.security.transport.ssl.enabled: true
xpack.security.http.ssl.enabled: true
xpack.ssl.keystore.path: **path**
xpack.ssl.keystore.password: *passwd*
xpack.ssl.truststore.path: **path**
xpack.ssl.truststore.password: *passwd*

要查看同一集群下的所有节点应该怎么做?

2 个答案:

答案 0 :(得分:1)

在6.X中,您还需要设置discovery.zen.minimum_master_nodes,以对您的节点说出形成集群所需的最小主节点数。

由于您未设置它,所以每个节点都认为它们是主节点,并且它们不会加入任何群集。

在每个stripos(serialize($my_array),$needle)文件中将其设置为discovery.zen.minimum_master_nodes: 2,然后重新启动节点。

答案 1 :(得分:0)

我认为所有Discovery.zen.ping.unicast.hosts在所有节点中都必须相同。

discovery.zen.ping.unicast.hosts:
- <hostname1>:9301
- <hostname2>:9301
- <hostname3>:9301

请尝试以下操作或

discovery.zen.ping.unicast.hosts: ["hostname1:9301"]