docker 安裝叢集es
阿新 • • 發佈:2021-08-09
宿主機準備外掛資料夾
從原來的單體外掛複製一份過來,刪除 data、log資料夾裡面的歷史檔案
配置elasticsearch.yml檔案
elasticsearch1
cluster.name: "docker-cluster" network.host: 0.0.0.0 node.name: node-1 node.master: true node.data: false node.ingest: false http.port: 9201 transport.port: 9301 discovery.seed_hosts: ["127.0.0.1:9301","127.0.0.1:9302","127.0.0.1:9303"] cluster.initial_master_nodes: ["node-1"]
elasticsearch2
cluster.name: "docker-cluster"
network.host: 0.0.0.0
node.name: node-2
node.master: true
node.data: false
node.ingest: false
http.port: 9202
transport.port: 9302
discovery.seed_hosts: ["127.0.0.1:9301","127.0.0.1:9302","127.0.0.1:9303"]
elasticsearch3
cluster.name: "docker-cluster" network.host: 0.0.0.0 node.name: node-3 node.master: true node.data: false node.ingest: false http.port: 9203 transport.port: 9303 discovery.seed_hosts: ["127.0.0.1:9301","127.0.0.1:9302","127.0.0.1:9303"]
依次啟動es服務,需要注意的是啟動指令碼去掉了指定單機執行環境
docker run -it --name es1 \ -p 9201:9200 -p 9301:9300 \ -e "ES_JAVA_OPTS=-Xms512m -Xmx512m" \ -v /data/elasticsearch1/config:/usr/share/elasticsearch/config \ -v /data/elasticsearch1/data:/usr/share/elasticsearch/data \ -v /data/elasticsearch1/logs:/usr/share/elasticsearch/logs \ -v /data/elasticsearch1/plugins:/usr/share/elasticsearch/plugins \ elasticsearch:7.14.0
docker run -it --name es1 \
-p 9201:9200 -p 9301:9300 \
-e "ES_JAVA_OPTS=-Xms512m -Xmx512m" \
-v /data/elasticsearch1/config:/usr/share/elasticsearch/config \
-v /data/elasticsearch1/data:/usr/share/elasticsearch/data \
-v /data/elasticsearch1/logs:/usr/share/elasticsearch/logs \
-v /data/elasticsearch1/plugins:/usr/share/elasticsearch/plugins \
elasticsearch:7.14.0
docker run -it --name es1 \
-p 9201:9200 -p 9301:9300 \
-e "ES_JAVA_OPTS=-Xms512m -Xmx512m" \
-v /data/elasticsearch1/config:/usr/share/elasticsearch/config \
-v /data/elasticsearch1/data:/usr/share/elasticsearch/data \
-v /data/elasticsearch1/logs:/usr/share/elasticsearch/logs \
-v /data/elasticsearch1/plugins:/usr/share/elasticsearch/plugins \
elasticsearch:7.14.0