技术库 > Java

Elasticsearch 跨网段组集群

技术库:tec.5lulu.com

from:tec.5lulu.com

在跨网段下实现了自动发现和组网。

总共运行了三个节点,一个节点IP是192.168.45.67,另外两个节点IP都是172.20.5.161三个文件的配置文件都改为如下配置文件,先后启动三个节点,记录日志在后面。

192.168.45.67节点启动后,自动用9300作为通信端口,将自身作为master节点存在。

172.20.5.161节点启动后,自动用9300作为通信端口,发现hosts列表中有master存在,master将其加入集群中。

172.20.5.161节点启动后,发现9300被占用,自动用9301作为通信端口,发现hosts列表中有master存在,master将其加入集群中。

 

elasticsearch-1.5.2/config/elasticsearch.yml需要修改部分为

discovery.zen.ping.multicast.enabled和discovery.zen.ping.unicast.hosts,修改如下: 

################################## Discovery ##################################

# Discovery infrastructure ensures nodes can be found within a cluster
# and master node is elected. Multicast discovery is the default.

# Set to ensure a node sees N other master eligible nodes to be considered
# operational within the cluster. This should be set to a quorum/majority of
# the master-eligible nodes in the cluster.
#
#discovery.zen.minimum_master_nodes: 1

# Set the time to wait for ping responses from other nodes when discovering.
# Set this option to a higher value on a slow or congested network
# to minimize discovery failures:
#
#discovery.zen.ping.timeout: 3s

# For more information, see
# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/modules-discovery-zen.html> # Unicast discovery allows to explicitly control which nodes will be used
# to discover the cluster. It can be used when multicast is not present,
# or to restrict the cluster communication-wise.
#
# 1. Disable multicast discovery (enabled by default):
#
discovery.zen.ping.multicast.enabled: false
#
# 2. Configure an initial list of master nodes in the cluster
#    to perform discovery when new nodes (master or data) are started:
#
discovery.zen.ping.unicast.hosts: ["192.168.45.67", "172.20.5.161:9300"]

# EC2 discovery allows to use AWS EC2 API in order to perform discovery.
#
# You have to install the cloud-aws plugin for enabling the EC2 discovery.
#
# For more information, see
# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/modules-discovery-ec2.html> #
# See <http://elasticsearch.org/tutorials/elasticsearch-on-ec2/> # for a step-by-step tutorial.

# GCE discovery allows to use Google Compute Engine API in order to perform discovery.
#
# You have to install the cloud-gce plugin for enabling the GCE discovery.
#
# For more information, see <https://github.com/elasticsearch/elasticsearch-cloud-gce>.

# Azure discovery allows to use Azure API in order to perform discovery.
#
# You have to install the cloud-azure plugin for enabling the Azure discovery.
#
# For more information, see <https://github.com/elasticsearch/elasticsearch-cloud-azure>.

Elasticsearch 跨网段组集群


标签: 集群 elasticsearch api本文链接 http://tec.5lulu.com/detail/110dpn2eheg7m85fa.html

我来评分 :6.1
0

转载注明:转自5lulu技术库

本站遵循:署名-非商业性使用-禁止演绎 3.0 共享协议

www.5lulu.com