Docker运行 Elasticsearch Kibana和Cerebro 电脑版发表于:2020/7/27 19:45 ![Docker远征](https://img.tnblog.net/arcimg/hb/656ec4beace04f5e9a7b1d58b6368639.jpg "Docker远征") >#Docker运行 Elasticsearch Kibana和Cerebro [TOC] Demo ------------ - 运行 Docker-compose,本地构建更高效的开发环境,更直观地了解 Elasticsearch 分布式特性 - 集成 Cerebro,方便查看集群状态 >创建一个文件夹与docker-compose.yaml,内容如下: (服务器上) ```yaml version: '2.2' services: cerebro: image: lmenezes/cerebro:0.8.3 container_name: cerebro ports: - "9000:9000" command: - -Dhosts.0.host=http://elasticsearch:9200 kibana: image: docker.elastic.co/kibana/kibana:7.1.0 container_name: kibana7 environment: - I18N_LOCALE=zh-CN - XPACK_GRAPH_ENABLED=true - TIMELION_ENABLED=true - XPACK_MONITORING_COLLECTION_ENABLED="true" ports: - "5601:5601" elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch:7.1.0 container_name: es7_01 environment: - cluster.name=xttblog - node.name=es7_01 - bootstrap.memory_lock=true - "ES_JAVA_OPTS=-Xms512m -Xmx512m" - discovery.seed_hosts=es7_01 - cluster.initial_master_nodes=es7_01,es7_02 ulimits: memlock: soft: -1 hard: -1 volumes: - es7data1:/usr/share/elasticsearch/data ports: - 9200:9200 elasticsearch2: image: docker.elastic.co/elasticsearch/elasticsearch:7.1.0 container_name: es7_02 environment: - cluster.name=xttblog - node.name=es7_02 - bootstrap.memory_lock=true - "ES_JAVA_OPTS=-Xms512m -Xmx512m" - discovery.seed_hosts=es7_01 - cluster.initial_master_nodes=es7_01,es7_02 ulimits: memlock: soft: -1 hard: -1 volumes: - es7data2:/usr/share/elasticsearch/data volumes: es7data1: driver: local es7data2: driver: local ``` >通过`docker-compose up -d`运行 ![](https://img.tnblog.net/arcimg/hb/d4b0245934e945b3a8866e13bfe6bc24.png) (普通环境下) ```yaml version: '2.2' services: cerebro: image: lmenezes/cerebro:0.8.3 container_name: cerebro ports: - "9000:9000" command: - -Dhosts.0.host=http://elasticsearch:9200 networks: - es7net kibana: image: docker.elastic.co/kibana/kibana:7.1.0 container_name: kibana7 environment: - I18N_LOCALE=zh-CN - XPACK_GRAPH_ENABLED=true - TIMELION_ENABLED=true - XPACK_MONITORING_COLLECTION_ENABLED="true" ports: - "5601:5601" networks: - es7net elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch:7.1.0 container_name: es7_01 environment: - cluster.name=geektime - node.name=es7_01 - bootstrap.memory_lock=true - "ES_JAVA_OPTS=-Xms512m -Xmx512m" - discovery.seed_hosts=es7_01,es7_02 - cluster.initial_master_nodes=es7_01,es7_02 ulimits: memlock: soft: -1 hard: -1 volumes: - es7data1:/usr/share/elasticsearch/data ports: - 9200:9200 networks: - es7net elasticsearch2: image: docker.elastic.co/elasticsearch/elasticsearch:7.1.0 container_name: es7_02 environment: - cluster.name=geektime - node.name=es7_02 - bootstrap.memory_lock=true - "ES_JAVA_OPTS=-Xms512m -Xmx512m" - discovery.seed_hosts=es7_01,es7_02 - cluster.initial_master_nodes=es7_01,es7_02 ulimits: memlock: soft: -1 hard: -1 volumes: - es7data2:/usr/share/elasticsearch/data networks: - es7net volumes: es7data1: driver: local es7data2: driver: local networks: es7net: driver: bridge ``` >访问 Kibana ![](https://img.tnblog.net/arcimg/hb/8a0ccedadb6d47bb8b81414ae086b61e.png) ![](https://img.tnblog.net/arcimg/hb/1ad1d2b791d049b1bb1dc26610e147d0.png) >网络拓扑图 ![](https://img.tnblog.net/arcimg/hb/16cbf42eb5fa4ca6a713bc3a14a42db2.png) Cerebro 的简单运用 ------------ tn>Cerebro 工具更加方便我们管理Elasticsearch,我们通过访问 9000端口访问看看。 通过链接访问到需要访问的 Elasticsearch ![](https://img.tnblog.net/arcimg/hb/502c3e31e65946caa183c1801aed8dee.png)