https://www.elastic.co/guide/en/elasticsearch/reference/7.16/docker.html
文件结构
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
| └── elasticsearch ├── node-00 │ ├── config │ │ └── elasticsearch.yml │ ├── data │ ├── docker-compose.yml │ ├── logs │ └── plugins │ └── ik ├── node-01 │ ├── config │ │ └── elasticsearch.yml │ ├── data │ ├── docker-compose.yml │ ├── logs │ └── plugins │ └── ik └── node-02 ├── config │ └── elasticsearch.yml ├── data ├── docker-compose.yml ├── logs └── plugins └── ik
|
1 2
| chown 1000:1000 data chown 1000:1000 logs
|
配置
- 创建公用docker network
1 2
| docker network ls docker network create --driver bridge elastic
|
- 创建各个node的docker-compose.yml
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
| version: "3" services: es-node-00: image: docker.elastic.co/elasticsearch/elasticsearch:7.16.3 container_name: es-node-00 environment: - "TZ=Asia/Shanghai" - "ES_JAVA_OPTS=-Xms1g -Xmx1g" restart: always ulimits: memlock: soft: -1 hard: -1 nofile: soft: 65536 hard: 65536 ports: - 9200:9200 - 9300:9300 networks: - elastic volumes: - ./config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml - ./data:/usr/share/elasticsearch/data - ./plugins:/usr/share/elasticsearch/plugins - ./logs:/usr/share/elasticsearch/logs networks: elastic: external: true
|
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
| version: "3" services: es-node-01: image: docker.elastic.co/elasticsearch/elasticsearch:7.16.3 container_name: es-node-01 environment: - "TZ=Asia/Shanghai" - "ES_JAVA_OPTS=-Xms1g -Xmx1g" restart: always ulimits: memlock: soft: -1 hard: -1 nofile: soft: 65536 hard: 65536 ports: - 9201:9200 - 9301:9300 networks: - elastic volumes: - ./config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml - ./data:/usr/share/elasticsearch/data - ./plugins:/usr/share/elasticsearch/plugins - ./logs:/usr/share/elasticsearch/logs networks: elastic: external: true
|
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
| version: "3" services: es-node-02: image: docker.elastic.co/elasticsearch/elasticsearch:7.16.3 container_name: es-node-02 environment: - "TZ=Asia/Shanghai" - "ES_JAVA_OPTS=-Xms1g -Xmx1g" restart: always ulimits: memlock: soft: -1 hard: -1 nofile: soft: 65536 hard: 65536 ports: - 9202:9200 - 9302:9300 networks: - elastic volumes: - ./config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml - ./data:/usr/share/elasticsearch/data - ./plugins:/usr/share/elasticsearch/plugins - ./logs:/usr/share/elasticsearch/logs networks: elastic: external: true
|
- config/elasticsearch.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| cluster.name: my-es-cluster node.name: es-node-00 network.host: es-node-00 http.port: 9200 transport.port: 9300 http.cors.enabled: true http.cors.allow-origin: "*" discovery.seed_hosts: ["es-node-01", "es-node-02"] bootstrap.memory_lock: true cluster.initial_master_nodes: ["es-node-00", "es-node-01", "es-node-02"]
ingest.geoip.downloader.enabled: false
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| cluster.name: my-es-cluster node.name: es-node-01 network.host: es-node-01 http.port: 9200 transport.port: 9300 http.cors.enabled: true http.cors.allow-origin: "*" discovery.seed_hosts: ["es-node-00", "es-node-02"] bootstrap.memory_lock: true cluster.initial_master_nodes: ["es-node-00", "es-node-01", "es-node-02"]
ingest.geoip.downloader.enabled: false
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| cluster.name: my-es-cluster node.name: es-node-02 network.host: es-node-02 http.port: 9200 transport.port: 9300 http.cors.enabled: true http.cors.allow-origin: "*" discovery.seed_hosts: ["es-node-00", "es-node-01"] bootstrap.memory_lock: true cluster.initial_master_nodes: ["es-node-00", "es-node-01", "es-node-02"]
ingest.geoip.downloader.enabled: false
|
kibana
https://www.elastic.co/guide/en/kibana/7.16/docker.html
1 2 3 4 5
| kibana/ ├── config │ ├── kibana.yml │ └── node.options └── docker-compose.yml
|
docker-compose.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| version: "3" services: kibana: image: docker.elastic.co/kibana/kibana:7.16.3 container_name: kibana environment: - TZ=Asia/Shanghai - ELASTICSEARCH_URL=http://es-node-00:9200 - ELASTICSEARCH_HOSTS=["http://es-node-00:9200","http://es-node-01:9200","http://es-node-02:9200"] volumes: - ./config/kibana.yml:/usr/share/kibana/config/kibana.yml - ./config/node.options:/usr/share/kibana/config/node.options restart: always ports: - 5601:5601 networks: - elastic networks: elastic: external: true
|
kibana.yml
1 2 3 4 5 6 7 8 9
|
server.host: "0.0.0.0" server.shutdownTimeout: "5s" elasticsearch.hosts: [ "http://es-node-00:9200" ] monitoring.ui.container.elasticsearch.enabled: true
|
node.options
1 2 3 4 5 6 7 8 9
|
--unhandled-rejections=warn
|
cerebro
docker-compose.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| version: "3" services: cerebro: image: lmenezes/cerebro:0.9.4 container_name: cerebro environment: - TZ=Asia/Shanghai restart: always ports: - 9000:9000 networks: - elastic networks: elastic: external: true
|