docker安装ES8细节处理

我这边用的是一台虚拟机三个不同的端口搭建的

1、master节点的docker-compose文件和配置文件 

version: '3'
services:
  es:
    image: elasticsearch:8.3.3
    container_name: es-node1
    environment:
      - "ES_JAVA_OPTS=-Xms256m -Xmx256m"
      - "http.host=0.0.0.0"
    volumes:
      - /home/mydocker/es/elasticsearch-node-1/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
    #  - /home/mydocker/es/elasticsearch-node-1/data:/usr/share/elasticsearch/data
    #  - /home/mydocker/es/elasticsearch-node-1/plugins/ik:/usr/share/elasticsearch/plugins/ik
    ports:
      - 9200:9200
      - 9300:9300

 elasticsearch.yml文件

cluster.name: es-cluster
node.name: es-node1
network.host: 0.0.0.0
network.publish_host: 172.20.10.8
http.port: 9200
transport.port: 9300
node.roles: [master,data]
cluster.initial_master_nodes: ["es-node1"]
http.cors.enabled: true
http.cors.allow-origin: "*"
action.destructive_requires_name: false
discovery.seed_hosts: ["172.20.10.8:9300","172.20.10.8:9301","172.20.10.8:9302"]

xpack.security.enabled: false
xpack.security.transport.ssl.enabled: false #关闭使用ssl证书
xpack.security.transport.ssl.verification_mode: none
#xpack.security.transport.ssl.keystore.path: /elasticsearch8.2/config/certs/elastic-certificates.p12
#xpack.security.transport.ssl.truststore.path: /elasticsearch8.2/config/certs/elastic-certificates.p12
ingest.geoip.downloader.enabled: false

 2、节点2的docker-compose文件和配置文件

cluster.name: es-cluster
node.name: es-node2
network.host: 0.0.0.0
http.port: 9201
transport.port: 9301
network.publish_host: 172.20.10.8
node.roles: [master,data]
cluster.initial_master_nodes: ["es-node1"]
http.cors.enabled: true
http.cors.allow-origin: "*"
action.destructive_requires_name: false
discovery.seed_hosts: ["172.20.10.8:9300","172.20.10.8:9301","172.20.10.8:9302"]
xpack.security.enabled: false
xpack.security.transport.ssl.enabled: false
xpack.security.transport.ssl.verification_mode: none
#xpack.security.transport.ssl.keystore.path: /elasticsearch8.2/config/certs/elastic-certificates.p12
#xpack.security.transport.ssl.truststore.path: /elasticsearch8.2/config/certs/elastic-certificates.p12
ingest.geoip.downloader.enabled: false

 配置文件

version: '3'
services:
  es:
    image: elasticsearch:8.3.3
    container_name: es-node2
    environment:
      - "ES_JAVA_OPTS=-Xms256m -Xmx256m"
      - "http.host=0.0.0.0"
    volumes:
      - /home/mydocker/es/elasticsearch-node-2/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
    #  - /home/mydocker/es/elasticsearch-node-2/data:/usr/share/elasticsearch/data
    #  - /home/mydocker/es/elasticsearch-node-2/plugins/ik:/usr/share/elasticsearch/plugins/ik
    ports:
      - 9201:9201
      - 9301:9301

3、节点3的docker-compose文件和配置文件

cluster.name: es-cluster
node.name: es-node3
network.host: 0.0.0.0
http.port: 9202
transport.port: 9302
network.publish_host: 172.20.10.8
node.roles: [data]
cluster.initial_master_nodes: ["es-node1"]
http.cors.enabled: true
http.cors.allow-origin: "*"
action.destructive_requires_name: false
discovery.seed_hosts: ["172.20.10.8:9300","172.20.10.8:9301","172.20.10.8:9302"]

xpack.security.enabled: false
xpack.security.transport.ssl.enabled: false
xpack.security.transport.ssl.verification_mode: none
#xpack.security.transport.ssl.keystore.path: /elasticsearch8.2/config/certs/elastic-certificates.p12
#xpack.security.transport.ssl.truststore.path: /elasticsearch8.2/config/certs/elastic-certificates.p12
ingest.geoip.downloader.enabled: false

配置文件

version: '3'
services:
  es:
    image: elasticsearch:8.3.3
    container_name: es-node3
    environment:
      - "ES_JAVA_OPTS=-Xms256m -Xmx256m"
      - "http.host=0.0.0.0"
    volumes:
      - /home/mydocker/es/elasticsearch-node-3/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
    #  - /home/mydocker/es/elasticsearch-node-2/data:/usr/share/elasticsearch/data
    #  - /home/mydocker/es/elasticsearch-node-2/plugins/ik:/usr/share/elasticsearch/plugins/ik
    ports:
      - 9202:9202
      - 9302:9302

4、如果觉得麻烦,可以把三个compose文件合成一个,我这边这么弄是喜欢这种方式看日志。本文章只是简单的介绍一下8版本的一些配置参数跟7版本有些不一样。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值