elasticsearch集群多主机部署
2023-01-05
3 min read
节点ip | 程序目录 | 数据目录 |
---|---|---|
192.168.234.201 | /apps/elasticsearch | /data/elasticsearch |
192.168.234.202 | /apps/elasticsearch | /data/elasticsearch |
192.168.234.203 | /apps/elasticsearch | /data/elasticsearch |
一、下载软件包目录准备
1、下载
#三台均要执行
cd /apps
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.0.0-linux-x86_64.tar.gz
tar xf elasticsearch-8.0.0-linux-x86_64.tar.gz
ln -sv elasticsearch-8.0.0 elasticsearch
2、权限
groupadd es
useradd es -g es
3、目录
mkdir -p /data/elasticsearch/data
mkdir -p /data/elasticsearch/logs
chown -R /apps/elasticsearch
chown -R /apps/elasticsearch-8.0.0
chown -R /data/elasticsearch
二、配置
192.168.234.201配置
[es@es1-234-201 elasticsearch]$ vim config/elasticsearch.yml
cluster.name: elasticsearch
node.name: node-1
path.data: /data/elasticsearch/data
path.logs: /data/elasticsearch/data
network.host: 0.0.0.0
http.port: 9200
transport.tcp.port: 9300
discovery.seed_hosts: ["192.168.234.201", "192.168.234.202","192.168.234.202"]
cluster.initial_master_nodes: ["node-1"]
cluster.routing.allocation.cluster_concurrent_rebalance: 32
cluster.routing.allocation.node_concurrent_recoveries: 32
cluster.routing.allocation.node_initial_primaries_recoveries: 32
http.cors.enabled: true
http.cors.allow-origin: “*”
xpack.ml.enabled: false
xpack.security.enabled: false
192.168.234.202配置
[es@es2-234-202 elasticsearch]$ vim config/elasticsearch.yml
cluster.name: elasticsearch
node.name: node-2
path.data: /data/elasticsearch/data
path.logs: /data/elasticsearch/data
network.host: 0.0.0.0
http.port: 9200
transport.tcp.port: 9300
discovery.seed_hosts: ["192.168.234.201", "192.168.234.202","192.168.234.202"]
cluster.initial_master_nodes: ["node-1"]
cluster.routing.allocation.cluster_concurrent_rebalance: 32
cluster.routing.allocation.node_concurrent_recoveries: 32
cluster.routing.allocation.node_initial_primaries_recoveries: 32
http.cors.enabled: true
http.cors.allow-origin: “*”
xpack.ml.enabled: false
xpack.security.enabled: false
192.168.234.202配置
[es@es3-234-203 elasticsearch]$ vim config/elasticsearch.yml
cluster.name: elasticsearch
node.name: node-3
path.data: /data/elasticsearch/data
path.logs: /data/elasticsearch/data
network.host: 0.0.0.0
http.port: 9200
transport.tcp.port: 9300
discovery.seed_hosts: ["192.168.234.201", "192.168.234.202","192.168.234.202"]
cluster.initial_master_nodes: ["node-1"]
cluster.routing.allocation.cluster_concurrent_rebalance: 32
cluster.routing.allocation.node_concurrent_recoveries: 32
cluster.routing.allocation.node_initial_primaries_recoveries: 32
http.cors.enabled: true
http.cors.allow-origin: “*”
xpack.ml.enabled: false
xpack.security.enabled: false
三、启动
su es
./apps/elasticsearch/bin/elasticsearch -d