2017-06-12 55 views
0

添加節點向單節點集羣,我目前正在運行與安全原因nginx的代理單節點集羣。我想將一個新節點添加到我的羣集中。 所以我安裝elasticsearch和kibana在我的新節點和nginx代理轉發。對於端口轉發我使用8000而不是9200。但是,當我修改新的節點單播變量到我的主節點。並且在重新啓動兩個節點之後。我有錯誤,當我打以下網址不能在elasticsearch [master_not_discovered_exception]

IP:8000/_cluster /健康

{"error":{"root_cause":[{"type":"master_not_discovered_exception","reason":null}],"type":"master_not_discovered_exception","reason":null},"status":503} 

我可以看到elasticsearch運行時我打IP:8000

舊節點配置:

# ---------------------------------- 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

有兩個端口,則768,16能夠兩名來自每個節點看:
- 爲REST
默認端口 - 爲nodes communication

默認的端口,因此可以在每個節點看到其他節點的9300端口?

+0

我不能得到你。你能解釋一下嗎? – Tamizharasan

+0

在端口'9200'上,您可以將REST請求發送到elasticsearch。對於其他任務,如羣集管理和節點同步,彈性在每個節點上使用默認的'9300'端口。你應該可以連接到從每個節點到另一個IP:9300。考試你可以使用'telnet ip 9300'。 –

+0

當我打telnet ip。它給出了以下輸出。 'telnet:無法連接到遠程主機:連接被拒絕' – Tamizharasan

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本地到節點的IP。所有的API都可以在沒有基本認證的情況下訪問。

我改變network.hostnetwork.publish_host使節點的IP只公佈了不API節點連接。但我無法連接節點。任何人都有想法。提前致謝 !