- Shardman documentation: http://repo.postgrespro.ru/doc/pgprosm/14beta2.1/en/html
- Clone repo:
git clone [email protected]:pkonotopov/shardman-docker.git shardman
- Limitations: Linux systems only. No MacosX and WSL supported.
- Inital cluster config in spec.json file: one node, no replication, no monitor.
After cloning shardman-docker repo please execute these steps.
docker-compose up -d
This command bring up two containers: etcd
and shardman
in simple configuration without additional nodes, replicas and monitor.
docker exec shardman_shard_1 shardman-ladle init -f /etc/shardman/spec.json
This command uploads initial configuraion into the etcd storage.
docker ps --filter "label=com.shardman.role=shard" -aq
The expected output should be like this:
2ca4e1984120
docker exec shardman_shard_1 shardman-ladle addnodes -n 2ca4e1984120
docker-compose up --scale shard=4 --no-recreate -d
docker ps --filter "label=com.shardman.role=shard" -a --format "table {{.ID}} {{.Names}}"
Expected output:
CONTAINER ID NAMES
ba2e956b5095 shardman_shard_4
d500d2c70b3e shardman_shard_3
5c42f00bca5a shardman_shard_2
2ca4e1984120 shardman_shard_1
Containers ID's are the hostnames of new containers, so add new hosts to the cluster:
docker exec shardman_shard_1 shardman-ladle addnodes -n 5c42f00bca5a,d500d2c70b3e,ba2e956b5095
docker exec shardman_shard_1 shardman-ladle rmnodes -n 5c42f00bca5a,d500d2c70b3e,ba2e956b5095
docker-compose up --scale shard=1 --no-recreate -d
If you want to create cluster with replicas and monitors you should change some parameters in the specification file spec.json:
"Repfactor": 1
"MonitorsNum": 1
Then at the Up step (1.1) run cluster with minimal nodes count 2: docker-compose up --scale shard=2 -d
.
At the Initialization step (1.2) upload configuration file into etcd k/v store.
Finally, add two created nodes to the cluster.
Get nodes names: docker ps --filter "label=com.shardman.role=shard" -aq
The expected output should be:
2ca4e1984120
5c42f00bca5a
Add nodes: docker exec shardman_shard_1 shardman-ladle addnodes -n 2ca4e1984120,5c42f00bca5a
.