先构建一个secret文件
arangodb create jwt-secret --secret=arangodb.secret
docker-compose.yml
version: "3"
services:
agency:
image: arangodb:latest
container_name: arango-agency
volumes:
- ./arangodb.secret:/etc/arangodb.secret
- ./cluster/a1:/var/lib/arangodb3
- ./cluster/a1apps:/var/lib/arangodb3-apps
command: arangod --server.jwt-secret-keyfile=/etc/arangodb.secret --server.endpoint tcp://0.0.0.0:8531 --agency.my-address tcp://agency:8531 --server.authentication true --agency.activate true --agency.size 1 --agency.endpoint tcp://agency:8531 --agency.supervision true --cluster.require-persisted-id true
coordinator1:
image: arangodb:latest
container_name: arango-coordinator1
volumes:
- ./arangodb.secret:/etc/arangodb.secret
- ./cluster/c1:/var/lib/arangodb3
- ./cluster/c1apps:/var/lib/arangodb3-apps
command: arangod --server.jwt-secret-keyfile=/etc/arangodb.secret --server.authentication=true --server.endpoint tcp://0.0.0.0:8529 --cluster.my-address tcp://coordinator1:8529 --cluster.my-role COORDINATOR --cluster.agency-endpoint tcp://agency:8531 --cluster.require-persisted-id true
ports:
- "8000:8529"
depends_on:
- agency
coordinator2:
image: arangodb:latest
container_name: arango-coordinator2
volumes:
- ./arangodb.secret:/etc/arangodb.secret
- ./cluster/c2:/var/lib/arangodb3
- ./cluster/c2apps:/var/lib/arangodb3-apps
command: arangod --server.jwt-secret-keyfile=/etc/arangodb.secret --server.authentication=true --server.endpoint tcp://0.0.0.0:8529 --cluster.my-address tcp://coordinator2:8529 --cluster.my-role COORDINATOR --cluster.agency-endpoint tcp://agency:8531 --cluster.require-persisted-id true
ports:
- "8001:8529"
depends_on:
- agency
db1:
image: arangodb:latest
container_name: arango-db1
volumes:
- ./arangodb.secret:/etc/arangodb.secret
- ./cluster/db1:/var/lib/arangodb3
- ./cluster/db1apps:/var/lib/arangodb3-apps
command: arangod --server.jwt-secret-keyfile=/etc/arangodb.secret --server.endpoint tcp://0.0.0.0:8529 --cluster.my-address tcp://db1:8529 --cluster.my-role PRIMARY --cluster.agency-endpoint tcp://agency:8531 --cluster.require-persisted-id true
depends_on:
- agency
db2:
image: arangodb:latest
container_name: arango-db2
volumes:
- ./arangodb.secret:/etc/arangodb.secret
- ./cluster/db2:/var/lib/arangodb3
- ./cluster/db2apps:/var/lib/arangodb3-apps
command: arangod --server.jwt-secret-keyfile=/etc/arangodb.secret --server.endpoint tcp://0.0.0.0:8529 --cluster.my-address tcp://db2:8529 --cluster.my-role PRIMARY --cluster.agency-endpoint tcp://agency:8531 --cluster.require-persisted-id true
depends_on:
- agency
db3:
image: arangodb:latest
container_name: arango-db3
volumes:
- ./arangodb.secret:/etc/arangodb.secret
- ./cluster/db3:/var/lib/arangodb3
- ./cluster/db3apps:/var/lib/arangodb3-apps
command: arangod --server.jwt-secret-keyfile=/etc/arangodb.secret --server.endpoint tcp://0.0.0.0:8529 --cluster.my-address tcp://db3:8529 --cluster.my-role PRIMARY --cluster.agency-endpoint tcp://agency:8531 --cluster.require-persisted-id true
depends_on:
- agency
首次运行,--cluster.require-persisted-id false,运行一次后,修改密码,添加database,然后第二次运行,改成--cluster.require-persisted-id true