前置 docker & docker-compose 环境
最好挂载国内 docker 镜像加速
docker & docker-compose 版本信息
docker-compose.yaml 配置文件
前置 docker network 准备
创建名为 ‘es_app’ 的 docker network 网络配置。方便后续接入其他 docker compose 文件
1
| docker network create es_app
|
docker-compose.yaml
- cerebro es集群管理插件
- kibana es可视化管理工具插件
- elasticsearch & elasticsearch2 es的两个集群节点
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
| 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: - es_app kibana: image: 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: - es_app
elasticsearch: image: elasticsearch:7.1.0 container_name: es7_01 restart: always environment: - cluster.name=theembers-es - 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:/tools/elasticsearch/data ports: - 9200:9200 networks: - es_app
elasticsearch2: image: elasticsearch:7.1.0 container_name: es7_02 restart: always environment: - cluster.name=theembers-es - 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:/tools/elasticsearch/data networks: - es_app
volumes: es7data1: driver: local es7data2: driver: local
networks: es_app: driver: bridge external: true
|
启动 docker-compose
- 把以上文件放置在 名为 'docker-compose.yaml’的文件中
- 进入目录
- 执行启动,首次启动会检索docker image,如果不存在相关镜像则会自动下载镜像
1 2 3 4 5 6 7
| docker-compose up
docker-compose up -d
docker-compose -f [file path] up -d
|
- 停止es服务
1 2 3 4 5
| docker-compose down
docker-compose stop
|
完成
Kibana 界面
Cerebro 界面