出于安全原因,我目前正在使用nginx代理运行单节点集群。我想在我的集群中添加一个新节点。 所以我在我的新节点和nginx中安装elasticsearch和kibana以进行代理转发。对于端口转发,我使用8000而不是9200。但是当我将新节点单播变量修改为我的主节点时。并在重新启动两个节点之后。当我点击以下网址时出现错误
IP:8000 / _cluster /健康
{"error":{"root_cause":[{"type":"master_not_discovered_exception","reason":null}],"type":"master_not_discovered_exception","reason":null},"status":503}
当我点击ip:8000
时,我可以看到elasticsearch正在运行旧节点配置:
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: <Cluster Name>
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: elasticsearch-24-384-node-1
#
# Add custom attributes to the node:
#
# node.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /mnt/elastic_data/data
#
# Path to log files:
#
path.logs: /mnt/elastic_data/logs
#
# ----------------------------------- Memory -----------------------------------
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: ["127.0.0.1", <new-node-ip>]
#
# Set a custom port for HTTP:
#
# http.port: 9200
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html>
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
discovery.zen.ping.unicast.hosts: ["127.0.0.1", "<new-node-ip>"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1):
#
discovery.zen.minimum_master_nodes: 2
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery.html>
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
# gateway.recover_after_nodes: 3
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway.html>
#
# ---------------------------------- Various -----------------------------------
#
# Disable starting multiple nodes on a single system:
#
# node.max_local_storage_nodes: 1
#
# Require explicit names when deleting indices:
#
# action.destructive_requires_name: true
新节点配置:
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: <Cluster Name>
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: elasticsearch-24-384-node-2
#
# Add custom attributes to the node:
#
# node.rack: r1
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: ["127.0.0.1", <old-node-ip>]
#
# Set a custom port for HTTP:
#
# http.port: 9200
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html>
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
discovery.zen.ping.unicast.hosts: ["127.0.0.1", "<Older-node-ip>:9300"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1):
#
discovery.zen.minimum_master_nodes: 2
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery.html>
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
# gateway.recover_after_nodes: 3
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway.html>
#
# ---------------------------------- Various ----------------------------------
所以任何人都可以告诉我做错了什么?
答案 0 :(得分:0)
每个节点有两个端口可以看到两个端口:
- 9200 是REST
的默认端口
- 9300 是nodes communication
那么每个节点都可以看到其他节点9300端口吗?
答案 1 :(得分:0)
我将network.host
作为当前节点ip,因此它将发布此ip以连接其他节点。
节点 - 1
cluster.name: <Cluster Name>
node.name: <Node Name>
network.host: <node1-ip>
discovery.zen.ping.unicast.hosts: ["127.0.0.1:9300", "<node2-ip>:9300"]
discovery.zen.minimum_master_nodes: 1
节点 - 2
cluster.name: <Cluster Name>
node.name: <Node Name - 2>
network.host: <node2-ip>
discovery.zen.ping.unicast.hosts: ["127.0.0.1:9300", "<node1-ip>:9300"]
discovery.zen.minimum_master_nodes: 1
以上配置可行。但是,如果您尝试使用Nginx来保护elasticsearch API,那么这里是棘手的部分。传输模块不允许你。将network.host
从 local 修改为node ip后。无需基本身份验证即可访问所有API。
我将network.host
更改为network.publish_host
,以便仅针对节点连接发布节点ip,而不是针对API。但我无法连接节点。任何人都有这个想法。在此先感谢!