This is in response to issue #18900.
It shows how to set up an arangodb cluster with 3 agents, 2 coordinators and 3 db severs, using docker-compose. This
is not the way I would set up a cluster in production, but it is ok for testing the cluster functionality. I recommend
checking out the official documentation,
especially Using the ArangoDB Starter.
docker-compose.yml
version: '3.7'
services:
agency1:
image: arangodb:3.9
hostname: 'arangodb-agency1'
container_name: 'arangodb-agency1'
networks:
- arango_net
environment:
- ARANGO_NO_AUTH=1
expose:
- '5001'
volumes:
- /home/arangodb/agency1.conf:/etc/arangodb3/arangod.conf
- /home/arangodb/data/agency1:/var/lib/arangodb3/
agency2:
image: arangodb:3.9
hostname: 'arangodb-agency2'
container_name: 'arangodb-agency2'
depends_on:
- "agency1"
networks:
- arango_net
environment:
- ARANGO_NO_AUTH=1
expose:
- '5002'
volumes:
- /home/arangodb/agency2.conf:/etc/arangodb3/arangod.conf
- /home/arangodb/data/agency2:/var/lib/arangodb3/
agency3:
image: arangodb:3.9
hostname: 'arangodb-agency3'
container_name: 'arangodb-agency3'
depends_on:
- "agency1"
networks:
- arango_net
environment:
- ARANGO_NO_AUTH=1
expose:
- '5003'
volumes:
- /home/arangodb/agency3.conf:/etc/arangodb3/arangod.conf
- /home/arangodb/data/agency3:/var/lib/arangodb3/
coordinator1:
image: arangodb:3.9
hostname: 'arangodb-coordinator1'
container_name: 'arangodb-coordinator1'
networks:
- arango_net
environment:
- ARANGO_NO_AUTH=1
ports:
- '7001:7001'
expose:
- '7001'
volumes:
- /home/arangodb/coord1.conf:/etc/arangodb3/arangod.conf
- /home/arangodb/data/coordinator1:/var/lib/arangodb3/
coordinator2:
image: arangodb:3.9
hostname: 'arangodb-coordinator2'
container_name: 'arangodb-coordinator2'
networks:
- arango_net
environment:
- ARANGO_NO_AUTH=1
ports:
- '7002:7002'
expose:
- '7002'
volumes:
- /home/arangodb/coord2.conf:/etc/arangodb3/arangod.conf
- /home/arangodb/data/coordinator2:/var/lib/arangodb3/
db1:
image: arangodb:3.9
hostname: 'arangodb-db1'
container_name: 'arangodb-db1'
networks:
- arango_net
environment:
- ARANGO_NO_AUTH=1
expose:
- '6001'
volumes:
- /home/arangodb/dbserver1.conf:/etc/arangodb3/arangod.conf
- /home/arangodb/data/db1:/var/lib/arangodb3
db2:
image: arangodb:3.9
hostname: 'arangodb-db2'
container_name: 'arangodb-db2'
networks:
- arango_net
environment:
- ARANGO_NO_AUTH=1
expose:
- '6002'
volumes:
- /home/arangodb/dbserver2.conf:/etc/arangodb3/arangod.conf
- /home/arangodb/data/db2:/var/lib/arangodb3
db3:
image: arangodb:3.9
hostname: 'arangodb-db3'
container_name: 'arangodb-db3'
networks:
- arango_net
environment:
- ARANGO_NO_AUTH=1
expose:
- '6003'
volumes:
- /home/arangodb/dbserver3.conf:/etc/arangodb3/arangod.conf
- /home/arangodb/data/db3:/var/lib/arangodb3
networks:
arango_net:
driver: bridge
agency1.conf
[database]
directory = /var/lib/arangodb3
[server]
endpoint = tcp://0.0.0.0:5001
storage-engine = auto
authentication = false
# gather server statistics
statistics = true
[log]
level = info
file = -
[agency]
activate = true
my-address = tcp://agency1:5001
size = 3
endpoint = tcp://agency1:5001
supervision = true
agency2.conf
[database]
directory = /var/lib/arangodb3
[server]
endpoint = tcp://0.0.0.0:5002
storage-engine = auto
authentication = false
# gather server statistics
statistics = true
[log]
level = info
file = -
[agency]
activate = true
my-address = tcp://agency2:5002
size = 3
endpoint = tcp://agency1:5001
supervision = true
agency3.conf
[database]
directory = /var/lib/arangodb3
[server]
endpoint = tcp://0.0.0.0:5003
storage-engine = auto
authentication = false
# gather server statistics
statistics = true
[log]
level = info
file = -
[agency]
activate = true
my-address = tcp://agency3:5003
size = 3
endpoint = tcp://agency1:5001
supervision = true
coord1.conf
[database]
directory = /var/lib/arangodb3
[server]
endpoint = tcp://0.0.0.0:7001
storage-engine = auto
authentication = false
# gather server statistics
statistics = true
[log]
level = info
file = -
[cluster]
my-address = tcp://coordinator1:7001
my-role = COORDINATOR
agency-endpoint = tcp://agency1:5001
agency-endpoint = tcp://agency2:5002
agency-endpoint = tcp://agency3:5003
[javascript]
startup-directory = /usr/share/arangodb3/js
app-path = /var/lib/arangodb3-apps
coord2.conf
[database]
directory = /var/lib/arangodb3
[server]
endpoint = tcp://0.0.0.0:7002
storage-engine = auto
authentication = false
# gather server statistics
statistics = true
[log]
level = info
file = -
[cluster]
my-address = tcp://coordinator2:7002
my-role = COORDINATOR
agency-endpoint = tcp://agency1:5001
agency-endpoint = tcp://agency2:5002
agency-endpoint = tcp://agency3:5003
[javascript]
startup-directory = /usr/share/arangodb3/js
app-path = /var/lib/arangodb3-apps
dbserver1.conf
[database]
directory = /var/lib/arangodb3
[server]
endpoint = tcp://0.0.0.0:6001
storage-engine = auto
authentication = false
# gather server statistics
statistics = true
[log]
level = info
file = -
[cluster]
my-address = tcp://db1:6001
my-role = DBSERVER
agency-endpoint = tcp://agency1:5001
agency-endpoint = tcp://agency2:5002
agency-endpoint = tcp://agency3:5003
dbserver2.conf
[database]
directory = /var/lib/arangodb3
[server]
endpoint = tcp://0.0.0.0:6002
storage-engine = auto
authentication = false
# gather server statistics
statistics = true
[log]
level = info
file = -
[cluster]
my-address = tcp://db2:6002
my-role = DBSERVER
agency-endpoint = tcp://agency1:5001
agency-endpoint = tcp://agency2:5002
agency-endpoint = tcp://agency3:5003
dbserver3.conf
[database]
directory = /var/lib/arangodb3
[server]
endpoint = tcp://0.0.0.0:6003
storage-engine = auto
authentication = false
# gather server statistics
statistics = true
[log]
level = info
file = -
[cluster]
my-address = tcp://db3:6003
my-role = DBSERVER
agency-endpoint = tcp://agency1:5001
agency-endpoint = tcp://agency2:5002
agency-endpoint = tcp://agency3:5003
To start the cluster, run docker-compose up
. Both coordinators can be accessed from the host, on ports 7001 and 7002.
You're right, it was a copy/paste error. It follows the same structure as the other two dbs. I updated the gist accordingly. Thanks for pointing that out!