one of options to run multiple instances is to use Docker Swarm.
with example below you can run multiple instances of ArangoDB
you'll need
then save code below as docker-stack-arango.yml
version: '3.3'
services:
arangodb:
image: "${ARANGO_IMAGE}"
environment:
ARANGO_ROOT_PASSWORD: "${ARANGO_ROOT_PASSWORD}"
ARANGO_STORAGE_ENGINE: "${ARANGO_STORAGE_ENGINE}"
volumes:
- arangodb:/var/lib/arangodb3
- arangodb_apps:/var/lib/arangodb3-apps
ports:
- target: 8529
published: $ARANGO_PUBLISHED_PORT
protocol: tcp
mode: ingress
deploy:
mode: replicated
replicas: 1
endpoint_mode: vip
placement:
constraints:
- node.labels.group==$INSTANCE_GROUP
resources:
limits:
cpus: $LIMITS_CPU
memory: $LIMITS_MEMORY
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 60s
update_config:
parallelism: 1
delay: 30s
stop_grace_period: 60s
volumes:
arangodb:
external:
name: ${ARANGO_VOLUME}
arangodb_apps:
external:
name: ${ARANGO_APPS_VOLUME}
update and run config in shell/bash
export INSTANCE_GROUP="group1"
export INSTANCE_NAME="arango1"
export INSTANCE_PORT=8529
export INSTANCE_PASSWORD="do-not-use-this-password-in-production"
export ARANGO_IMAGE_TAG="3.4.0"
export ARANGO_IMAGE_REPO="arangodb/arangodb"
export ARANGO_IMAGE="${ARANGO_IMAGE_REPO}:${ARANGO_IMAGE_TAG}"
export ARANGO_VOLUME="arangodb-${INSTANCE_NAME}--3.4.0"
export ARANGO_APPS_VOLUME="arangodb-apps-${INSTANCE_NAME}--3.4.0"
export ARANGO_PUBLISHED_PORT=$INSTANCE_PORT
export ARANGO_STORAGE_ENGINE="rocksdb"
export ARANGO_ROOT_PASSWORD=$INSTANCE_PASSWORD
export LIMITS_CPU=1
export LIMITS_MEMORY=1024M
and then run deploy
docker stack deploy -c ./docker-stack-arango.yml $INSTANCE_NAME
to deploy second instance change INSTANCE_NAME
, INSTANCE_PORT
and INSTANCE_GROUP
and run deploy again
then you can access instances via ip of any node with configured port