ElasticSearch - 不能同时 运行 两个 es docker 容器
ElasticSearch - cannot run two es docker containers at the same time
ElasticSearch - 不能同时运行两个es docker容器
我正在尝试使用 docker-compose.yaml
运行 ElasticSearch
的 2 项服务
每次我 运行 docker-compose up -d
只有一项服务在工作。当我尝试启动停止服务时,它 运行s 但之前工作的第一个服务立即停止。
这是我的 docker-compose.yaml
的样子:
version: '3.1'
services:
es-write:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.0
container_name: es-write
environment:
- discovery.type=single-node
- TAKE_FILE_OWNERSHIP=true
ulimits:
memlock:
soft: -1
hard: -1
ports:
- 9200:9200
es-read:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.0
container_name: es-read
environment:
- discovery.type=single-node
- TAKE_FILE_OWNERSHIP=true
ulimits:
memlock:
soft: -1
hard: -1
ports:
- 9201:9200
sqs:
image: "roribio16/alpine-sqs:latest"
container_name: "sqs"
ports:
- "9324:9324"
- "9325:9325"
volumes:
- "./.docker-configuration:/opt/custom"
stdin_open: true
tty: true
Tldr;
我相信您遇到了已知的 <container name> exited with code 137
错误。
这是 docker 告诉您它是 OOM(内存不足)的方式。
解决
定义每个容器允许使用的最大内存量。
我允许4GB
,但你选择适合你的。
version: '3.1'
services:
es-write:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.0
container_name: es-write
environment:
- discovery.type=single-node
ports:
- 9200:9200
deploy:
resources:
limits:
memory: 4GB # Use at most 50 MB of RAM
es-read:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.0
container_name: es-read
environment:
- discovery.type=single-node
ports:
- 9201:9200
deploy:
resources:
limits:
memory: 4GB # Use at most 50 MB of RAM
ElasticSearch - 不能同时运行两个es docker容器
我正在尝试使用 docker-compose.yaml
ElasticSearch
的 2 项服务
每次我 运行 docker-compose up -d
只有一项服务在工作。当我尝试启动停止服务时,它 运行s 但之前工作的第一个服务立即停止。
这是我的 docker-compose.yaml
的样子:
version: '3.1'
services:
es-write:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.0
container_name: es-write
environment:
- discovery.type=single-node
- TAKE_FILE_OWNERSHIP=true
ulimits:
memlock:
soft: -1
hard: -1
ports:
- 9200:9200
es-read:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.0
container_name: es-read
environment:
- discovery.type=single-node
- TAKE_FILE_OWNERSHIP=true
ulimits:
memlock:
soft: -1
hard: -1
ports:
- 9201:9200
sqs:
image: "roribio16/alpine-sqs:latest"
container_name: "sqs"
ports:
- "9324:9324"
- "9325:9325"
volumes:
- "./.docker-configuration:/opt/custom"
stdin_open: true
tty: true
Tldr;
我相信您遇到了已知的 <container name> exited with code 137
错误。
这是 docker 告诉您它是 OOM(内存不足)的方式。
解决
定义每个容器允许使用的最大内存量。
我允许4GB
,但你选择适合你的。
version: '3.1'
services:
es-write:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.0
container_name: es-write
environment:
- discovery.type=single-node
ports:
- 9200:9200
deploy:
resources:
limits:
memory: 4GB # Use at most 50 MB of RAM
es-read:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.0
container_name: es-read
environment:
- discovery.type=single-node
ports:
- 9201:9200
deploy:
resources:
limits:
memory: 4GB # Use at most 50 MB of RAM