Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Distributed, fault-tolerant, persistent, auto-increment ID generation service with Raft consensus

NotificationsYou must be signed in to change notification settings

ldmtam/raft-auto-increment

Repository files navigation

Distributed, fault-tolerant, persistent, auto-increment ID generation service with Raft consensus.

Support bothREST API andgRPC protocol.

Support different storage for Raft log:Bitcask andBadger via--storage flag

What is Raft consensus?

Please refer to thispage for more detail.

How to run

Clone the project:

git clone https://github.com/ldmtam/raft-auto-increment

Change directory toraft-auto-increment

cd raft-auto-increment

Startnode 1, this node will be the leader by default.node 1 will serve requests at port3000.

make run1

Start other 2 nodes by running following commands.node 2 andnode 3 will be slaves ofnode 1 and serve requests at port13000,23000 respectively.

make run2make run3

Get next available ID for keyfoo:

curl http://localhost:3000/auto-increment/one/foo

Get last inserted ID for keyfoo:

curl http://localhost:3000/auto-increment/last-inserted/foo

Get next 10 available IDs for keybar:

curl http://localhost:3000/auto-increment/many/bar/10

You can send request tonode 2 andnode 3 as well. Requests will be automatically forwarded to master node (node 1),

curl http://localhost:13000/auto-increment/one/bar
curl http://localhost:23000/auto-increment/last-inserted/bar

About

Distributed, fault-tolerant, persistent, auto-increment ID generation service with Raft consensus

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp