美文网首页
七、docker部署Elasticsearch集群

七、docker部署Elasticsearch集群

作者: 我爱福尔摩斯呀 | 来源:发表于2021-11-22 19:26 被阅读0次

    docker-compose文件

    version: "2.2"
    services:
      elasticsearch-head:
        image: mobz/elasticsearch-head:5
        container_name: elasticsearch-head
        ports:
          - 9100:9100
        expose:
          - 9100
        restart: always
      es-0:
        image: elasticsearch:7.12.1
        container_name: es-0
        environment:
          - cluster.name=es
          - bootstrap.memory_lock=true
          - "ES_JAVA_OPTS=-Xms2g -Xmx2g"
        ulimits:
          memlock:
            soft: -1
            hard: -1
        volumes:
          - D:/cluster/logs/es-0:/usr/share/elasticsearch/logs
          - D:/cluster/data/es-0:/usr/share/elasticsearch/data
          - D:/cluster/node/es-0/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
          - D:/cluster/analysis/analysis-ik:/usr/share/elasticsearch/plugins/ik
        ports:
          - 9200:9200
          - 9300:9300
        expose:
          - 9200
        restart: always
      es-1:
        image: elasticsearch:7.12.1
        container_name: es-1
        environment:
          - cluster.name=es
          - bootstrap.memory_lock=true
          - "ES_JAVA_OPTS=-Xms2g -Xmx2g"
        ulimits:
          memlock:
            soft: -1
            hard: -1
        volumes:
          - D:/cluster/logs/es-1:/usr/share/elasticsearch/logs
          - D:/cluster/data/es-1:/usr/share/elasticsearch/data
          - D:/cluster/node/es-1/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
          - D:/cluster/analysis/analysis-ik:/usr/share/elasticsearch/plugins/ik
        ports:
          - 9201:9200
          - 9301:9300
        restart: always
        depends_on:
          - es-0
      es-2:
        image: elasticsearch:7.12.1
        container_name: es-2
        environment:
          - cluster.name=es
          - bootstrap.memory_lock=true
          - "ES_JAVA_OPTS=-Xms2g -Xmx2g"
        ulimits:
          memlock:
            soft: -1
            hard: -1
        volumes:
          - D:/cluster/logs/es-2:/usr/share/elasticsearch/logs
          - D:/cluster/data/es-2:/usr/share/elasticsearch/data
          - D:/cluster/node/es-2/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
          - D:/cluster/analysis/analysis-ik:/usr/share/elasticsearch/plugins/ik
        ports:
          - 9202:9200
          - 9302:9300
        restart: always
        depends_on:
          - es-1
      es-3:
        image: elasticsearch:7.12.1
        container_name: es-3
        environment:
          - cluster.name=es
          - bootstrap.memory_lock=true
          - "ES_JAVA_OPTS=-Xms2g -Xmx2g"
        ulimits:
          memlock:
            soft: -1
            hard: -1
        volumes:
          - D:/cluster/logs/es-3:/usr/share/elasticsearch/logs
          - D:/cluster/data/es-3:/usr/share/elasticsearch/data
          - D:/cluster/node/es-3/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
          - D:/cluster/analysis/analysis-ik:/usr/share/elasticsearch/plugins/ik
        ports:
          - 9203:9200
          - 9303:9300
        restart: always
        depends_on:
          - es-2
      es-4:
        image: elasticsearch:7.12.1
        container_name: es-4
        environment:
          - cluster.name=es
          - bootstrap.memory_lock=true
          - "ES_JAVA_OPTS=-Xms2g -Xmx2g"
        ulimits:
          memlock:
            soft: -1
            hard: -1
        volumes:
          - D:/cluster/logs/es-4:/usr/share/elasticsearch/logs
          - D:/cluster/data/es-4:/usr/share/elasticsearch/data
          - D:/cluster/node/es-4/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
          - D:/cluster/analysis/analysis-ik:/usr/share/elasticsearch/plugins/ik
        ports:
          - 9204:9200
          - 9304:9300
        restart: always
        depends_on:
          - es-3
      es-5:
        image: elasticsearch:7.12.1
        container_name: es-5
        environment:
          - cluster.name=es
          - bootstrap.memory_lock=true
          - "ES_JAVA_OPTS=-Xms2g -Xmx2g"
        ulimits:
          memlock:
            soft: -1
            hard: -1
        volumes:
          - D:/cluster/logs/es-5:/usr/share/elasticsearch/logs
          - D:/cluster/data/es-5:/usr/share/elasticsearch/data
          - D:/cluster/node/es-5/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
          - D:/cluster/analysis/analysis-ik:/usr/share/elasticsearch/plugins/ik
        ports:
          - 9205:9200
          - 9305:9300
        restart: always
        depends_on:
          - es-4
    

    es0

    cluster.name: "es"
    node.name: "es-0"
    node.master: true
    node.data: false
    http.cors.enabled: true
    http.cors.allow-origin: "*"
    cluster.initial_master_nodes: ["es-0"]
    network.host: 0.0.0.0
    discovery.zen.minimum_master_nodes: 2
    discovery.zen.ping.unicast.hosts: ["192.168.1.115:9300", "192.168.1.115:9301", "192.168.1.115:9302"]
    

    es1

    cluster.name: "es"
    node.name: "es-1"
    node.master: true
    node.data: false
    http.cors.enabled: true
    http.cors.allow-origin: "*"
    cluster.initial_master_nodes: ["es-0"]
    network.host: 0.0.0.0
    discovery.zen.minimum_master_nodes: 2
    discovery.zen.ping.unicast.hosts: ["192.168.1.115:9300", "192.168.1.115:9301", "192.168.1.115:9302"]
    

    es2

    cluster.name: "es"
    node.name: "es-2"
    node.master: true
    node.data: false
    http.cors.enabled: true
    http.cors.allow-origin: "*"
    cluster.initial_master_nodes: ["es-0"]
    network.host: 0.0.0.0
    discovery.zen.minimum_master_nodes: 2
    discovery.zen.ping.unicast.hosts: ["192.168.1.115:9300", "192.168.1.115:9301", "192.168.1.115:9302"]
    

    相关文章

      网友评论

          本文标题:七、docker部署Elasticsearch集群

          本文链接:https://www.haomeiwen.com/subject/digbtrtx.html