raft-sample

command module
v0.0.0-...-29ffe3e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2021 License: Apache-2.0 Imports: 24 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

raft-sample

A handy raft demo repository of helloworld example from https://github.com/lni/dragonboat-example

How it works

Before playing the demo, you must build the binary main,

docker compose up build

Then to play demo,

docker compose up node1 node2 node3

Now you'll get

node2_1  | from ExampleStateMachine.Update(), msg: 2021-07-03 12:59:26.2165754 +0000 UTC m=+7.025916201, count:1
node3_1  | from ExampleStateMachine.Update(), msg: 2021-07-03 12:59:26.2165754 +0000 UTC m=+7.025916201, count:1
node1_1  | from ExampleStateMachine.Update(), msg: 2021-07-03 12:59:26.2165754 +0000 UTC m=+7.025916201, count:1
node1_1  | from ExampleStateMachine.Update(), msg: 2021-07-03 12:59:28.2459868 +0000 UTC m=+9.055463001, count:2
node2_1  | from ExampleStateMachine.Update(), msg: 2021-07-03 12:59:28.2459868 +0000 UTC m=+9.055463001, count:2
node3_1  | from ExampleStateMachine.Update(), msg: 2021-07-03 12:59:28.2459868 +0000 UTC m=+9.055463001, count:2
node1_1  | from ExampleStateMachine.Update(), msg: 2021-07-03 12:59:29.2168722 +0000 UTC m=+10.026242901, count:3
node2_1  | from ExampleStateMachine.Update(), msg: 2021-07-03 12:59:29.2168722 +0000 UTC m=+10.026242901, count:3
node3_1  | from ExampleStateMachine.Update(), msg: 2021-07-03 12:59:29.2168722 +0000 UTC m=+10.026242901, count:3

After playing demo, you should

docker-compose down

Note

In the original example, both of the following are required when adding members!

  1. you have to "add localhost:63100 4" from the node that currently constitutes the cluster
  2. on the new node "./example-helloworld -nodeid 4 -addr localhost:63100 -join" is required on the new node!

That is,

  1. is not possible to add a node with the same nodeID as a node that has been removed once.
  2. The new nodeID can use the port that has been used once before. Of course, currently used ports cannot be used.
  3. If a process is dropped without "remove", unreachable will be detected on other nodes. When dropping a process, be sure to drop it gracefully.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址