编写一个docker-compose.yaml文件,内容如下
- version: '2.2'
- services:
- es01:
- image: elasticsearch:7.12.1
- container_name: es01
- environment:
- - node.name=es01
- - cluster.name=es-docker-cluster
- - discovery.seed_hosts=es02,es03
- - cluster.initial_master_nodes=es01,es02,es03
- - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- volumes:
- - data01:/usr/share/elasticsearch/data
- ports:
- - 9200:9200
- networks:
- - elastic
- es02:
- image: elasticsearch:7.12.1
- container_name: es02
- environment:
- - node.name=es02
- - cluster.name=es-docker-cluster
- - discovery.seed_hosts=es01,es03
- - cluster.initial_master_nodes=es01,es02,es03
- - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- volumes:
- - data02:/usr/share/elasticsearch/data
- ports:
- - 9201:9200
- networks:
- - elastic
- es03:
- image: elasticsearch:7.12.1
- container_name: es03
- environment:
- - node.name=es03
- - cluster.name=es-docker-cluster
- - discovery.seed_hosts=es01,es02
- - cluster.initial_master_nodes=es01,es02,es03
- - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- volumes:
- - data03:/usr/share/elasticsearch/data
- networks:
- - elastic
- ports:
- - 9202:9200
- volumes:
- data01:
- driver: local
- data02:
- driver: local
- data03:
- driver: local
-
- networks:
- elastic:
- driver: bridge
修改/etc/sysctl.conf
文件
vi /etc/sysctl.conf
添加下面的内容
vm.max_map_count=262144
然后执行命令,让配置生效
sysctl -p
通过docker-compose启动集群
docker-compose up -d
docker pull lmenezes/cerebro:0.9.4
docker run -d --name cerebro -p 9000:9000 lmenezes/cerebro:0.9.4
输入ip加端口访问