添加节点使本地集群 Elasticsearch [7.8]
Add nodes to make local cluster Elasticsearch [7.8]
我正在学习 Elastic Search (v7.8),所以我做了一个本地集群来测试它。
我制作了 3 个 Ubuntu 18 的虚拟机,相同数量的资源,在具有 IP 的同一网络中:
- 192.168.1.77
- 192.168.1.76
- 192.168.1.75
所有正确的个人安装,每个都回复她API:
curl -XGET localhost:9200/?pretty
但是当我尝试编辑集群时 /etc/elasticsearch/elasticsearch.yml
每个节点都形成了自己的同名集群。
这是我的文件:https://gist.github.com/RedxLus/f8eb561157c7f2b61fb4dfaa74fe8868
这是每个节点的输出。一模一样:
curl -XGET 192.168.1.77:9200/_cluster/health?pretty
{
"cluster_name" : "luisiblog",
"status" : "green",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 0,
"active_shards" : 0,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 0,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0,
"task_max_waiting_in_queue_millis" : 0,
"active_shards_percent_as_number" : 100.0
}
我不知道这是配置错误还是我跳过了任何添加节点的步骤。我希望他们能帮助我。非常感谢大家。
首先是您缺少 network.host
正确的值,该值应该是 0.0.0.0
以确保它在非环回地址上可见。
你能试试下面的配置吗:
#这是针对节点 1
cluster.name: elasticsearch
node.name: node-1
network.host: 0.0.0.0
discovery.seed_hosts: ["192.168.1.77","192.168.1.76","192.168.1.75"]
cluster.initial_master_nodes: ["192.168.1.77"]
discovery.zen.minimum_master_nodes : 1
node.master: true
#这是针对节点 2
cluster.name: elasticsearch
node.name: node-2
network.host: 0.0.0.0
discovery.seed_hosts: ["192.168.1.77","192.168.1.76","192.168.1.75"]
cluster.initial_master_nodes: ["192.168.1.77"]
discovery.zen.minimum_master_nodes : 1
node.master: false
# 这是节点 3
cluster.name: elasticsearch
node.name: node-3
network.host: 0.0.0.0
discovery.seed_hosts: ["192.168.1.77","192.168.1.76","192.168.1.75"]
cluster.initial_master_nodes: ["192.168.1.77"]
discovery.zen.minimum_master_nodes : 1
node.master: false
请注意,我正在创建一个专用主节点,在本例中为 node-1
我正在学习 Elastic Search (v7.8),所以我做了一个本地集群来测试它。 我制作了 3 个 Ubuntu 18 的虚拟机,相同数量的资源,在具有 IP 的同一网络中:
- 192.168.1.77
- 192.168.1.76
- 192.168.1.75
所有正确的个人安装,每个都回复她API:
curl -XGET localhost:9200/?pretty
但是当我尝试编辑集群时 /etc/elasticsearch/elasticsearch.yml
每个节点都形成了自己的同名集群。
这是我的文件:https://gist.github.com/RedxLus/f8eb561157c7f2b61fb4dfaa74fe8868
这是每个节点的输出。一模一样:
curl -XGET 192.168.1.77:9200/_cluster/health?pretty
{
"cluster_name" : "luisiblog",
"status" : "green",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 0,
"active_shards" : 0,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 0,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0,
"task_max_waiting_in_queue_millis" : 0,
"active_shards_percent_as_number" : 100.0
}
我不知道这是配置错误还是我跳过了任何添加节点的步骤。我希望他们能帮助我。非常感谢大家。
首先是您缺少 network.host
正确的值,该值应该是 0.0.0.0
以确保它在非环回地址上可见。
你能试试下面的配置吗:
#这是针对节点 1
cluster.name: elasticsearch
node.name: node-1
network.host: 0.0.0.0
discovery.seed_hosts: ["192.168.1.77","192.168.1.76","192.168.1.75"]
cluster.initial_master_nodes: ["192.168.1.77"]
discovery.zen.minimum_master_nodes : 1
node.master: true
#这是针对节点 2
cluster.name: elasticsearch
node.name: node-2
network.host: 0.0.0.0
discovery.seed_hosts: ["192.168.1.77","192.168.1.76","192.168.1.75"]
cluster.initial_master_nodes: ["192.168.1.77"]
discovery.zen.minimum_master_nodes : 1
node.master: false
# 这是节点 3
cluster.name: elasticsearch
node.name: node-3
network.host: 0.0.0.0
discovery.seed_hosts: ["192.168.1.77","192.168.1.76","192.168.1.75"]
cluster.initial_master_nodes: ["192.168.1.77"]
discovery.zen.minimum_master_nodes : 1
node.master: false
请注意,我正在创建一个专用主节点,在本例中为 node-1