集群环境的搭建,Elasticsearch多节点集群配置文件

作者: win10  发布:2019-08-02

在事先 ElasticSearch 搭建好之后,大家由此 elasticsearch-header 插件在查看 ES 服务的时候,开掘 cluster-health 展现的是 YELLOW。
2019篮球世界杯投注官网 1

Elasticsearch多节点集群配置文件

Why?
首先,我们供给精通的是:颜色代表集群的正规状态。以后的颜料状态有:

192.168.18.186  安装七个Elasticsearch节点
192.168.18.187  安装多个Elasticsearch节点

* RED(红): 代表具体的分片还没有在集群中分配好;
* YELLOW(黄): 代表主分片已经分配好,但是副本尚未分配;
* GREEN(绿):表示所有的分片都已分配好,群集正常运行;

长机1装置二个节点的配备文件(192.168.18.186 )
/usr/local/elasticsearch-1.7.3/config/elasticsearch.yml
cluster.name: elastic-product
node.name: "node18.186"
bootstrap.mlockall: true
network.host: 192.168.18.186
discovery.zen.ping.timeout: 60s
discovery.zen.fd.ping_timeout: 60s
discovery.zen.minimum_master_nodes: 2
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["192.168.18.186","192.168.18.187","192.168.18.187:9301"]
index.cache.field.max_size: 50000
index.cache.field.expire: 10m
index.cache.field.type: soft
indices.fielddata.cache.size: 10%
#path.data: /path/to/data  

有了上述的简单介绍之后,小编认为,单节点导致彰显的 YELLOW 还是能圆满,所以起始搭建 ** ES Cluster **。
率先,大家需求更新此前的安排。踏入后面包车型地铁解压目录,展开配置文件:

申明:为了以免“脑裂”出现,discovery.zen.minimum_master_nodes参数设置的数字=(集群中节点数/2) 1,如两台恐怕三台主机则安顿,借使唯有四个节点,此安插可去掉或配备1。

vim elasticsearch.yml

主机2装置七个节点的布局文件(192.168.18.187)
1、节点一
/usr/local/elasticsearch-1.7.3/config/elasticsearch.yml
cluster.name: elastic-product
node.name: "node18.187"
bootstrap.mlockall: true
network.host: 192.168.18.187
discovery.zen.ping.timeout: 60s
discovery.zen.fd.ping_timeout: 60s
discovery.zen.minimum_master_nodes: 2
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["192.168.18.186","192.168.18.187","192.168.18.187:9301"]
index.cache.field.max_size: 50000
index.cache.field.expire: 10m
index.cache.field.type: soft
indices.fielddata.cache.size: 10%
#path.data: /path/to/data

我们供给更新那样多少个参数:

2、节点二
/usr/local/elasticsearch-1.7.3-rep2/config/elasticsearch.yml
cluster.name: elastic-product
node.name: "node18.187-rep2"
bootstrap.mlockall: true
network.host: 192.168.18.187
discovery.zen.ping.timeout: 60s
discovery.zen.fd.ping_timeout: 60s
discovery.zen.minimum_master_nodes: 2
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["192.168.18.186","192.168.18.187","192.168.18.187:9301"]
transport.tcp.port: 9301
http.port: 9201
index.cache.field.max_size: 50000
index.cache.field.expire: 10m
index.cache.field.type: soft
indices.fielddata.cache.size: 10%
#path.data: /path/to/data  

  • node.name: 钦定当前节点的名目。作者未来有两台机子,能够安装多少个节点,所以,这里贰个起名字为master,二个为 node1;
  • node.master: 内定主节点。值一个装置为 true,另三个为 false;
  • discovery.zen.ping.unicast.hosts:这里安装的是节点的 ip,也许本人安顿 hosts 文件,钦赐 ip映射关系,直接写ip对应的名目;
  • discovery.zen.minimum_master_nodes:这里,小编的主节点是1个,所以本人在那配置的是 1;具体的可以参谋discovery.zen.minimum_master_nodes

增多为开机自启方法:
sudo vim /etc/rc.local
/usr/local/elasticsearch-1.7.3-2/bin/elasticsearch -d /usr/local/elasticsearch-1.7.3-2/conf/elasticsearch.yml

在主节点配置好后,通过 scp 传输到 node1 节点上边,参数也做相应的改换就能够。比如 node.name 更新成 node1, node.master: false。其余的保持一致。
自个儿当下的主节点配置如下:

2019篮球世界杯投注官网,Linux上安装安排ElasticSearch全程记录  http://www.linuxidc.com/Linux/2015-09/123241.htm

# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
#cluster.name: my-application
cluster.name: es-demo
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
#node.name: node-1
node.name: master
node.master: true
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
#path.data: /path/to/data
path.data: /data/elasticsearch
#
# Path to log files:
#
#path.logs: /path/to/logs
path.logs: /data/logs/elasticsearch
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
# bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 192.168.1.58 # 从节点成对应的 ip
#
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- 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: ["192.168.1.58", "192.168.1.54"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2   1):
#
discovery.zen.minimum_master_nodes: 1
#
# For more information, consult the zen discovery module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true


# --------------------------------- 其他配置 -----------------------------------
http.cors.enabled: true
http.cors.allow-origin: "*"

Elasticsearch安装使用教程 http://www.linuxidc.com/Linux/2015-02/113615.htm

立异好布局之后吧,大家初阶运行 ElasticSearch 服务。我起步 master 和 node1,开采出现了上面的不当:

ElasticSearch 配置文件译文分析 http://www.linuxidc.com/Linux/2015-02/114244.htm

max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]

ElasticSearch集群搭建实例  http://www.linuxidc.com/Linux/2015-02/114243.htm

查询发掘,导致这种不当,是因为系统暗中同意的 max_map_count 过低所致,大家须要设置大学一年级些(按报错直接翻译也能够哦^(^)。大家需求设置一下以此参数:

布满式寻觅ElasticSearch单机与服务器情况搭建  http://www.linuxidc.com/Linux/2012-05/60787.htm

sudo vim /etc/sysctl.conf

ElasticSearch的干活体制  http://www.linuxidc.com/Linux/2014-11/109922.htm 

在最末尾增多:

Elasticsearch的安装,启动和中坚配置 http://www.linuxidc.com/Linux/2016-07/133057.htm

vm.max_map_count=262144

使用Elasticsearch Logstash Kibana搭建日志集中深入分析平台实践  http://www.linuxidc.com/Linux/2015-12/126587.htm

两台机子配置好未来,大家再一次起动下 elasticsearch。那时候 log 也已经提示了:

Ubuntu 14.04搭建ELK日志剖判系统(Elasticsearch Logstash Kibana) http://www.linuxidc.com/Linux/2016-06/132618.htm

Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[movies][0]] ...])

Elasticsearch1.7荣升到2.3实践计算  http://www.linuxidc.com/Linux/2016-11/137282.htm

好了。刷新下 elasticsearch-head,发现如下图所示:
2019篮球世界杯投注官网 2

Ubuntu 14.04中Elasticsearch集群配置  http://www.linuxidc.com/Linux/2017-01/139460.htm

迄今,集群遇到到底配置好了,集群状态也从 YELLOW 转到 GREEN 了。

Elasticsearch-5.0.0移植到Ubuntu 16.04 http://www.linuxidc.com/Linux/2017-01/139505.htm

Linux上安装布置ElasticSearch全程记录  http://www.linuxidc.com/Linux/2015-09/123241.htm

ElasticSearch 5.2.2 集群意况的搭建  http://www.linuxidc.com/Linux/2017-04/143136.htm

Elasticsearch安装使用教程 http://www.linuxidc.com/Linux/2015-02/113615.htm

ElasticSearch 的详实介绍:请点这里
ElasticSearch 的下载地址:请点这里 

ElasticSearch 配置文件译文解析 http://www.linuxidc.com/Linux/2015-02/114244.htm

本文恒久更新链接地址:http://www.linuxidc.com/Linux/2017-04/143181.htm

ElasticSearch集群搭建实例  http://www.linuxidc.com/Linux/2015-02/114243.htm

2019篮球世界杯投注官网 3

分布式搜索ElasticSearch单机与服务器情况搭建  http://www.linuxidc.com/Linux/2012-05/60787.htm

ElasticSearch的劳作体制  http://www.linuxidc.com/Linux/2014-11/109922.htm 

Elasticsearch的安装,运营和着力配备 http://www.linuxidc.com/Linux/2016-07/133057.htm

行使Elasticsearch Logstash Kibana搭建日志聚集深入分析平台举办  http://www.linuxidc.com/Linux/2015-12/126587.htm

Ubuntu 14.04搭建ELK日志解析系统(Elasticsearch Logstash Kibana) http://www.linuxidc.com/Linux/2016-06/132618.htm

Elasticsearch1.7晋级到2.3实践总括  http://www.linuxidc.com/Linux/2016-11/137282.htm

Ubuntu 14.04中Elasticsearch集群配置  http://www.linuxidc.com/Linux/2017-01/139460.htm

Elasticsearch-5.0.0移植到Ubuntu 16.04 http://www.linuxidc.com/Linux/2017-01/139505.htm

ElasticSearch 的详实介绍:请点这里
ElasticSearch 的下载地址:请点这里 

正文恒久更新链接地址:http://www.linuxidc.com/Linux/2017-04/143136.htm

2019篮球世界杯投注官网 4

本文由篮球世界杯投注-2019篮球世界杯投注官网发布于win10,转载请注明出处:集群环境的搭建,Elasticsearch多节点集群配置文件

关键词: 篮球世

上一篇:发布下载
下一篇:没有了