Skip to content

2. Create a three‐node instance

Potato edited this page Jan 5, 2024 · 1 revision

In the previous chapter, we described how to quickly start a single-node instance, but three nodes are generally used in production environments.

Before that, we need to plan the port

----------------------------
| node   | raft-rpc | grpc |
| rqd-n1 |   5290   | 5230 |
| rqd-n2 |   4290   | 4230 |
| rqd-n3 |   3290   | 3230 |
----------------------------
docker run -it --name rqd-n1 -p 5290:5290 -p 5230:5230 \
                  -e RQ_NODE_ID=node-1 \
                  -e RQ_NUTS_RW_MODE=mmap \
                  -e RQ_LISTEN_PEER_ADDR="rqd-n1:5290" \
                  -e RQ_LISTEN_CLIENT_ADDR="0.0.0.0:5230" \
                  -e RQ_CLUSTER_BOOTSTRAP="node-1@rqd-n1:5290,node-2@rqd-n2:4290,node-3@rqd-n3:3290" \
                  -d ghcr.io/realfax/redqueen:latest

docker run -it --name rqd-n2 -p 4290:4290 -p 4230:4230 \
                  -e RQ_NODE_ID=node-1 \
                  -e RQ_NUTS_RW_MODE=mmap \
                  -e RQ_LISTEN_PEER_ADDR="rqd-n2:4290" \
                  -e RQ_LISTEN_CLIENT_ADDR="0.0.0.0:4230" \
                  -e RQ_CLUSTER_BOOTSTRAP="node-1@rqd-n1:5290,node-2@rqd-n2:4290,node-3@rqd-n3:3290" \
                  -d ghcr.io/realfax/redqueen:latest

docker run -it --name rqd-n3 -p 3290:3290 -p 3230:3230 \
                  -e RQ_NODE_ID=node-3 \
                  -e RQ_NUTS_RW_MODE=mmap \
                  -e RQ_LISTEN_PEER_ADDR="rqd-n3:3290" \
                  -e RQ_LISTEN_CLIENT_ADDR="0.0.0.0:3230" \
                  -e RQ_CLUSTER_BOOTSTRAP="node-1@rqd-n1:5290,node-2@rqd-n2:4290,node-3@rqd-n3:3290" \
                  -d ghcr.io/realfax/redqueen:latest

However, people usually use multiple machines to deploy RedQueen, and at this time you need to make it listen on other addresses/ports.

Note: raft-rpc cannot listen on address 0.0.0.0

Clone this wiki locally