1.环境准备
主机 | 服务 | 端口 |
10.0.0.11 | es-node_1 | 9200,9300 |
10.0.0.12 | es-node_2 | 9200,9300 |
10.0.0.13 | es-node_3 | 9200,9300 |
2.安装JDK
rpm -ivh jdk-8u181-linux-x64.rpm
3.安装ES
rpm -ivh elasticsearch-6.5.4-x86_64.rpm
4.配置内存锁定
systemctl edit elasticsearch.service
[Service]
LimitMEMLOCK=infinity
5.编写配置文件
#es_node_1配置:
vim /etc/elasticsearch/elasticsearch.yml
cluster.name: zhongtai_group
node.name: es_node_1
path.data: /es/data
path.logs: /es/logs
bootstrap.memory_lock: false
network.host: 0.0.0.0
http.port: 9200
discovery.zen.ping.unicast.hosts: ["10.0.0.11","10.0.0.12","10.0.0.13"]
discovery.zen.mininum_master_nodes: 2
bootstrap.system_call_filter: false
################################################
#es_node_2配置:
vim /etc/elasticsearch/elasticsearch.yml
cluster.name: zhongtai_group
node.name: es_node_2
path.data: /es/data
path.logs: /es/logs
bootstrap.memory_lock: false
network.host: 0.0.0.0
http.port: 9200
discovery.zen.ping.unicast.hosts: ["10.0.0.11","10.0.0.12","10.0.0.13"]
discovery.zen.mininum_master_nodes: 2
bootstrap.system_call_filter: false
################################################
#es_node_3配置:
vim /etc/elasticsearch/elasticsearch.yml
cluster.name: zhongtai_group
node.name: es_node_3
path.data: /es/data
path.logs: /es/logs
bootstrap.memory_lock: false
network.host: 0.0.0.0
http.port: 9200
discovery.zen.ping.unicast.hosts: ["10.0.0.11","10.0.0.12","10.0.0.13"]
discovery.zen.mininum_master_nodes: 2
bootstrap.system_call_filter: false
6.创建目录授权
(尽量选择数据盘)
mkdir -p /es/data
mkdir -p /es/logs
chown -R elasticsearch:elasticsearch /es/
chown -R elasticsearch:elasticsearch /etc/init.d/elasticsearch
7.启动服务
systemctl daemon-reload
systemctl restart elasticsearch.service
8.集群验证
netstat -tnulp|grep 9200
netstat -tnulp|grep 9300
浏览器访问:http://${es_ip}:9200/_cat/nodes
或者curl http://${es_ip}:9200/_cluster/health?pretty
注意:green代表正常。