![](/img/trans.png)
[英]ArangoDB Single Instance as a Docker Container Fills memory and restarts
[英]What are some of the docker container settings for running a single instance of ArangoDB?
我对 ArangoDB 很陌生,我需要在执行 GO 代码时为 ArangoDB 分拆一个 docker 容器。 限制是启用分拆(testcontainers)的模块为 docker 容器的 env 设置接受一些参数,可能是为了优化资源利用(例如,在“ES_JAVA_OPTS”的情况下,JVM 的 1gb 到剥离一个 Elasticsearch 容器)。
请让我知道这些环境设置对于 Arango docker 容器(可能是独立映像而不是集群容器)可能是什么,以及如何对它们进行最佳设置,以便在运行时实际发生分拆。
我建议使用 docker compose 并设置不同的容器来运行 Arango 和另一个容器来运行 GO 代码。 这样你就可以为它们中的每一个设置不同的环境设置。 下面你可以看到一个示例 docker-compose.yml 文件,其中包含 Arano、GO 和 redis。 我添加 Redis 是为了向您展示,如果需要,您可以在那里添加更多服务
version: '3.9'
# Define services
services:
arangodb:
image: arangodb/arangodb:latest
ports:
- 8529:8529
volumes:
- /my/database/copy/for/arango/data:/var/lib/arangodb3
environment:
- ARANGODB_USERNAME=myuser
- ARANGODB_PASSWORD=mypassword
- ARANGODB_DBNAME=graphdb
- ARANGO_ROOT_PASSWORD=myrootpassword
container_name: "arango_docker_compose"
mem_limit: 2048m
networks:
- backend
# Golang Service
app:
# Building the docker image for the service based on a Dockerfile of your choice
build:
context: . # Use an image built from the specified dockerfile in the current directory.
dockerfile: Dockerfile
ports:
- "8080:8080" # Forward the exposed port 8080 on the container to port 8080 on the host machine, if needed
restart: unless-stopped
depends_on:
- redis # This service depends on redis and arangodb. Start them first.
- arangodb
environment: # Pass environment variables to the service
- REDIS_URL: redis:6379
- ARANGO_PORT: 8529
networks: # Networks to join (Services on the same network can communicate with each other using their name)
- backend
# Redis Service
redis:
image: "redis:alpine" # Use a public Redis image to build the redis service
restart: unless-stopped
networks:
- backend
networks:
backend:
有关 ArangoDB docker 映像上允许的参数的更多信息,请参阅ArangoDB docker hub
可以在此处找到 GO 容器的示例 Dockerfile。 请记住,这些文件只是示例,您需要在它们上添加/替换所需的配置。 当您想使用测试容器时,您也可以在此处使用testcontainers
请让我知道这是否有帮助
谢谢!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.