Skip to content

Latest commit

 

History

History
64 lines (52 loc) · 1.8 KB

Setup.md

File metadata and controls

64 lines (52 loc) · 1.8 KB

👩‍🏭 How to set up time machine

Build the binary from code

❯ go test ./...
❯ go build

Alternatively, if you choose to build the proto files

❯ ./scripts/build.sh

Clean and data and raft folders

# ./scripts/clean-create.sh num_nodes
❯ ./scripts/clean-create.sh 5

Spawn multiple nodes

# ./scripts/spawn.sh num_nodes is_bootstrap 
❯ ./scripts/spawn.sh 5 true 

Here the spawn.sh script accepts the number of nodes to spawn and true specifies if we should start in bootstrap mode. Bootstrap mode is necessary only when starting the cluster for the first time.

Create a cluster

# ./scripts/join.sh num_nodes
❯ ./scripts/join.sh 5

This script uses curl command to request the node1 to accept node2, node3, node4 and node5 as followers.

Check status

# ./scripts/status.sh num_nodes
❯ ./scripts/status.sh 5

| No | Leader | Host:Port      | Health |
|----+--------+----------------+--------|
| 1  || 127.0.0.1:8001 |   🟢   |
| 2  |        | 127.0.0.1:8002 |   🟢   |
| 3  |        | 127.0.0.1:8003 |   🟢   |
| 4  |        | 127.0.0.1:8004 |   🟢   |
| 5  |        | 127.0.0.1:8005 |   🟢   |

Health and status checks completed for 5 nodes.

This script uses jq command to format json output.

If you check the cluster status before forming a cluster, you will find that all the nodes we spawned are leaders in bootstrap mode

Configure the startup params

  • slot_per_node_count : Specify the number of slots per node. This will decide the slots in each node to create the DHT. Required only for the first time.
# ./scripts/configure.sh slot_per_node_count
❯ ./scripts/configure.sh 4

Kill all nodes

pkill -f ./timeMachine