为了账号安全,请及时绑定邮箱和手机立即绑定

老师,docker-compose实现es集群,主节点宕机后,kibana也不可用了,这是我的配置

version: '3.1'


services:

  elasticsearch:

    image: elasticsearch:7.5.1

    container_name: es

    environment:

      - node.name=es

      - cluster.name=es-docker-dev

      - discovery.seed_hosts=es:9300,es01:9302,es02:9303

      - cluster.initial_master_nodes=es,es01,es02

      - bootstrap.memory_lock=true

      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"

      - TZ=Asia/Shanghai

      - node.master=true

      - node.data=true

      - http.cors.enabled=true

      - http.cors.allow-origin=*

      - http.cors.allow-headers=Authorization,X-Requested-With,Content-Length,Content-Type

      - xpack.security.enabled=true

      - xpack.security.transport.ssl.enabled=true

      - xpack.security.audit.enabled=true

      - xpack.license.self_generated.type=basic

      - xpack.monitoring.collection.enabled=true

      - xpack.security.transport.ssl.verification_mode=certificate

      - xpack.security.transport.ssl.keystore.path=elastic-certificates.p12

      - xpack.security.transport.ssl.truststore.path=elastic-certificates.p12

    volumes:

      - /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins #插件文件挂载

      - /mydata/elasticsearch/data:/usr/share/elasticsearch/data #数据文件挂载

      - /mydata/elasticsearch/config/elastic-certificates.p12:/usr/share/elasticsearch/config/elastic-certificates.p12 #集群认证证书

    ports:

      - 9200:9200

      - 9300:9300

    networks:

      - elk


  elasticsearch1:

    image: elasticsearch:7.5.1

    container_name: es01

    environment:

      - node.name=es01

      - cluster.name=es-docker-dev

      - discovery.seed_hosts=es:9300,es01:9302,es02:9303

      - discovery.cluster_formation_warning_timeout=30s

      - discovery.zen.minimum_master_nodes=2

      - discovery.zen.fd.ping_interval=1s

      - discovery.zen.fd.ping_timeout=30s

      - discovery.zen.fd.ping_retries=3

      - cluster.initial_master_nodes=es,es01,es02

      - bootstrap.memory_lock=true

      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"

      - TZ=Asia/Shanghai

      - node.master=true

      - node.data=true

      - http.cors.enabled=true

      - http.cors.allow-origin=*

      - http.cors.allow-headers=Authorization,X-Requested-With,Content-Length,Content-Type

      - xpack.security.enabled=true

      - xpack.security.transport.ssl.enabled=true

      - xpack.security.audit.enabled=true

      - xpack.license.self_generated.type=basic

      - xpack.monitoring.collection.enabled=true

      - xpack.security.transport.ssl.verification_mode=certificate

      - xpack.security.transport.ssl.keystore.path=elastic-certificates.p12

      - xpack.security.transport.ssl.truststore.path=elastic-certificates.p12

    volumes:

      - /mydata/elasticsearch1/plugins:/usr/share/elasticsearch/plugins #插件文件挂载

      - /mydata/elasticsearch1/data:/usr/share/elasticsearch/data #数据文件挂载

      - /mydata/elasticsearch1/config/elastic-certificates.p12:/usr/share/elasticsearch/config/elastic-certificates.p12 #集群认证证书

    ports:

      - 9202:9200

      - 9302:9300

    networks:

      - elk

 

  elasticsearch2:

    image: elasticsearch:7.5.1

    container_name: es02

    environment:

      - node.name=es02

      - cluster.name=es-docker-dev

      - discovery.seed_hosts=es:9300,es01:9302,es02:9303

      - discovery.cluster_formation_warning_timeout=30s

      - discovery.zen.minimum_master_nodes=2

      - discovery.zen.fd.ping_interval=1s

      - discovery.zen.fd.ping_timeout=30s

      - discovery.zen.fd.ping_retries=3

      - cluster.initial_master_nodes=es,es01,es02

      - bootstrap.memory_lock=true

      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"

      - TZ=Asia/Shanghai

      - node.master=true

      - node.data=true

      - http.cors.enabled=true

      - http.cors.allow-origin=*

      - http.cors.allow-headers=Authorization,X-Requested-With,Content-Length,Content-Type

      - xpack.security.enabled=true

      - xpack.security.transport.ssl.enabled=true

      - xpack.security.audit.enabled=true

      - xpack.license.self_generated.type=basic

      - xpack.monitoring.collection.enabled=true

      - xpack.security.transport.ssl.verification_mode=certificate

      - xpack.security.transport.ssl.keystore.path=elastic-certificates.p12

      - xpack.security.transport.ssl.truststore.path=elastic-certificates.p12

    volumes:

      - /mydata/elasticsearch2/plugins:/usr/share/elasticsearch/plugins #插件文件挂载

      - /mydata/elasticsearch2/data:/usr/share/elasticsearch/data #数据文件挂载

      - /mydata/elasticsearch2/config/elastic-certificates.p12:/usr/share/elasticsearch/config/elastic-certificates.p12 #集群认证证书

    ports:

      - 9203:9200

      - 9303:9300

    networks:

      - elk

      

  kibana:

    image: kibana:7.5.1

    environment:

      - elasticsearch.url=http://es:9200

      - elasticsearch.hosts=http://es:9200,http://es01:9202,http://es02:9203

      - elasticsearch.username=kibana

      - elasticsearch.password=iColor#2020

      - i18n.locale=zh-CN   

      - TZ=Asia/Shanghai

    volumes:

      - /mydata/kibana/config/kibana.yml:/usr/share/kibana/config/kibana.yml

    ports:

      - 5601:5601

    networks:

      - elk

    depends_on:

      - elasticsearch


  logstash:

    image: logstash:7.5.1

    environment:

      XPACK_MONITORING_ENABLED: "false"

      XPACK_MONITORING_ELASTICSEARCH_HOSTS: http://es:9200,http://es01:9202,http://es02:9203

    volumes:

      - /mydata/logstash/config:/usr/share/logstash/pipeline

    ports:

      - 5000:5000

    networks:

      - elk

    depends_on:

      - elasticsearch


networks:

  elk:

    driver: bridge




正在回答

举报

0/150
提交
取消

老师,docker-compose实现es集群,主节点宕机后,kibana也不可用了,这是我的配置

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信