elasticsearch 是非常流行的全文搜索引擎,但网上的教程多是初次使用,并没有一些高级用法demo。这次遇到需要跨网段组网问题,自己摸索了文档很久,发现确实可行,于是着手做了个实验,最终实验成功。在跨网段下实现了自动发现和组网。

总共运行了三个节点,一个节点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将其加入集群中。

192.168.45.67:9300添加日志

172.20.5.161:9300添加日志

172.20.5.161:9301添加

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

配置的中文注释请看:

http://www.tuicool.com/articles/Nryu2i

elasticsearch 跨网段组集群的更多相关文章

  1. Elasticsearch(二)--集群原理及优化

    一.ES原理 1.索引结构ES是面向文档的 各种文本内容以文档的形式存储到ES中,文档可以是一封邮件.一条日志,或者一个网页的内容.一般使用 JSON 作为文档的序列化格式,文档可以有很多字段,在创建 ...

  2. elasticsearch(四) 之 elasticsearch常用的一些集群命令

    目录 elasticsearch常用的一些集群命令 查看集群健康状态 查看集群的节点列表 查看所有的索引 删除索引 查询索引的某个文档内容 更新文档 删除文档 自动创建索引 定时删除索引 elasti ...

  3. Elasticsearch(ES)集群的搭建

    1. 概述 Elasticsearch(ES)集群支持分片和副本,能够很容易的实现负载均衡.扩容.容灾.高可用. 今天我们就来聊一下,Elasticsearch(ES)集群是如何搭建的. 2. 场景介 ...

  4. ElasticSearch 5.0.0 集群安装部署文档

    1.  搭建环境 3台物理机 操作系统 centos7 es1   192.168.31.141   4g内存   2核 es2   192.168.31.142   4g内存   2核 es3    ...

  5. 【拆分版】Docker-compose构建Elasticsearch 7.1.0集群

    写在前边 搞了两三天了,一直有个问题困扰着我,ES集群中配置怎么能正确映射到主机上,这边经常报ClusterFormationFailureHelper master not discovered o ...

  6. ElasticSearch 7.1.1 集群环境搭建

    1. 集群简介 三台机器,均用于保存数据且可被选为master节点 服务版本 服务 版本 elasticsearch 7.1.1 jdk 1.8 1. 创建elsearch用户 不建议直接使用root ...

  7. Elasticsearch(ELK)集群搭建

    一.前言 Elasticsearch是一个开源的高扩展的分布式全文检索引擎,它可以近乎实时的存储.检索数据:本身扩展性很好,可以扩展到上百台服务器,处理PB级别的数据.Elasticsearch也使用 ...

  8. elasticsearch + kibana + x-pack + logstash_集群部署安装

    elasticsearch 部分总体描述: 1.elasticsearch 的概念及特点.概念:elasticsearch 是一个基于 lucene 的搜索服务器.lucene 是全文搜索的一个框架. ...

  9. elasticSearch数据库、skywalking集群部署

    Centos6上面安装elasticsearc数据库的集群 安装的是6.3.2版本,安装之前首先要先安装jdk1.8版本 安装之前首先需要关闭防火墙 Centos6 sudo service ipta ...

随机推荐

  1. Inno Setup使用上的几个问题

    Inno Setup使用上的几个问题 分类: Install Setup 2013-02-02 15:48 1781人阅读 评论(0) 收藏 举报 Inno Setup使用上的几个问题: [问题一:I ...

  2. buildroot httpd php

    /******************************************************************** * buildroot httpd php * 说明: * ...

  3. LeetCode Combination Sum III (DFS)

    题意: 在1-9这9个数字中选择k个出来,若他们的和为n,则加入答案序列,注意升序. 思路: 用DFS的方式,每次决定一个数字,共决策k次.假设上个决策是第i位为5,那么i+1位的范围就是6-9. c ...

  4. 【Avalon源码】dateGetter

    function dateGetter(name, size, offset, trim) { return function(date) { var value = date["get&q ...

  5. RelativeLayout相对布局

    RelativeLayout相对布局常用属性: 第一类:属性值为true或false android:layout_centerHrizontal 水平居中 android:layout_center ...

  6. Java Servlet——改进的CGI

    一.关于Servlet 在上一篇随笔中,我们看到了CGI存在的不足,其每次请求都需加载和运行一个CGI程序.若使用Java编写CGI程序,需要为每个请求都启动一个系统进程以及JVM,其执行效率大大降低 ...

  7. linux死锁检测的一种思路

    前言: 上一篇博文讲述了pstack的使用和原理. 和jstack一样, pstack能获取进程的线程堆栈快照, 方便检验和性能评估. 但jstack功能更加的强大, 它能对潜在的死锁予以提示, 而p ...

  8. [转载]在Android C/C++层添加LOG调试

    原文地址:C/C++层添加LOG调试">在Android C/C++层添加LOG调试作者:谢轩昂 在Android C/C++层添加LOG调试,并且在Logcat中输出的方法 第一步: ...

  9. Codeforces Round #303 (Div. 2) C dp 贪心

    C. Woodcutters time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  10. 2015GitWebRTC编译实录7

    2015.07.20 libvoiceengine 编译通过去除了mock测试代码,mock是用来进行测试的,意义不大.另外会报一个常量错误,需要定义WEBRTC_MAC宏,只定义WEBRTC_IOS ...