elasticsearch 集群

ES 集群

一、系统环境

系统
环境包
ES 运行账户
地址规划

centos6.7

128G 500GB

java 1.8.0_92

jdk-8u92-linux-x64

elasticsearch-5.6.8

kibana-5.6.7

elasticsearch

IP:
172.16.2.31

172.16.2.32

172.16.2.33

port :

9201 9301

9202 9302

9203 9303

 二、节点规划: 单机多实例;

一般 做master 也不会做data node

 master 

172.16.2.31:9301

172.16.2.32:9301

172.16.2.33:9301

node 172.16.2.31:9301

172.16.2.31:9302

172.16.2.31:9303

172.16.2.32:9301

172.16.2.32:9302

172.16.2.32:9303

172.16.2.33:9301

172.16.2.33:9302

172.16.2.33:9303

二、数据配置文件: 

数据文件 /opt/elasticsearch/{data1,data2}
配置启动文件 /opt/elasticsearch/config/{node1,node2}

三、JVM 相关配置  启动内存根据实际情况配置

# cat jvm.options |grep -v ^$ |grep -v ^#

-Xms30g
-Xmx30g
-XX:+UseConcMarkSweepGC
-XX:CMSInitiatingOccupancyFraction=75
-XX:+UseCMSInitiatingOccupancyOnly
-XX:+AlwaysPreTouch
-server
-Xss1m
-Djava.awt.headless=true
-Dfile.encoding=UTF-8
-Djna.nosys=true
-Djdk.io.permissionsUseCanonicalPath=true
-Dio.netty.noUnsafe=true
-Dio.netty.noKeySetOptimization=true
-Dio.netty.recycler.maxCapacityPerThread=0
-Dlog4j.shutdownHookEnabled=false
-Dlog4j2.disable.jmx=true
-Dlog4j.skipJansi=true
-XX:+HeapDumpOnOutOfMemoryError

四、elasticsearch.yml 启动文件参数配置:

集群名称 dss-cluster
节点名称 node1
指定节点的索引数据
对外服务端口
交互tcp端口
es5.0 以上 node.ingest 数据转换,不配置默认开启
集群节点存活量数据恢复
设置集群中master节点的初始列表

1、master 和 node 配置有几处不一样:

master 配置 node.master: true
 node.data: false
node 配置  node.master: false
 node.data: true

2、elasticsearch 配置示例:

  master 配置示例:

# cat elasticsearch.yml |grep -v ^$ |grep -v ^#
cluster.name: "cluster_name"
node.master: true
node.name: "node_name"
node.data: false
node.ingest: false
path.data: /opt/elasticsearch/"dataname"
path.logs: /opt/elasticsearch/logs/"nodename"
network.host: "IP"
http.port: 9201
transport.tcp.port: 9301
discovery.zen.ping.unicast.hosts: ["172.16.2.31:9301", "172.16.2.32:9301", "172.16.2.33:9301"]
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
discovery.zen.minimum_master_nodes: 2
gateway.recover_after_nodes: 6
search.remote.connect: false
cluster.routing.allocation.same_shard.host: true

  node 配置示例:

# cat elasticsearch.yml |grep -v ^$ |grep -v ^#

cluster.name: "cluster_name"
node.master: false
node.name: "node_name"
node.data: true
node.ingest: false
path.data: /opt/elasticsearch/"dataname"
path.logs: /opt/elasticsearch/logs/"nodename"
network.host: "IP"
http.port: 9202
transport.tcp.port: 9302
discovery.zen.ping.unicast.hosts: ["172.16.2.31:9301", "172.16.2.32:9301", "172.16.2.33:9301"] 
bootstrap.memory_lock: false
bootstrap.system_call_filter:
false
discovery.zen.minimum_master_nodes:
2
gateway.recover_after_nodes:
6
search.remote.connect:
false
cluster.routing.allocation.same_shard.host:
true

3、默认启动验证:

默认启动:
# ./elasticsearch -d
检测进程: # ps
-ef|grep elasticearch
检测端口:
ss -ltn

elasticsearch 账户启动示例:

node 节点1:
su elasticsearch -c "sh /opt/elasticsearch/bin/elasticsearch -Epath.conf=/opt/elasticsearch/config/node1 -d"
node 节点2:
su elasticsearch -c "sh /opt/elasticsearch/bin/elasticsearch -Epath.conf=/opt/elasticsearch/config/node2 -d"

ES 5.0 版本启动注意:

5.0之前启动:
./bin/elasticsearch -Des.path.conf=/path/to/your/config
5.0 之后启动:
ElasticSearch5.0.0的版本采用 .bin/elasticsearch -Epath.conf=/path/to/your/config

  另外 在 ES5 中,新增数据转换功能节点(Ingest Nodes);elasticsearch.yml 不配置默认是开启的;如果关闭需要配置成false。

# vi elasticsearch.yml 添加一行

node.ingest:
false

 

posted @ 2018-07-27 16:31  01234567  阅读(296)  评论(0编辑  收藏  举报