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

来源:5-4 实战指Kibana数据可视化演示

慕粉4314927

2021-03-03 11:19

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回答

还没有人回答问题,可以看看其他问题

Elastic Stack入门

Elasticsearch、Logstash、Beats、Kibana基础知识入门

32729 学习 · 76 问题

查看课程

相似问题