Skip to content
/ kvs Public
forked from wencaiwulue/kvs

A distribute key-value system, base on raft protocal and hashmap, (a memory k-v system), still developing... if anyone have good idea to develop some interesting framework stuff, let me know, :) thanks in advance

Notifications You must be signed in to change notification settings

LeoNumber1/kvs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

Distribute key-value system, Base on Raft protocol and in memory storage, still developing

Reference document

Function

Already finished functions

  • Election function
  • Add/Remove cluster node dynamically

Still developing functions

  • Log synchronize
  • Backup data

How to bootstrap this project?

  • Clone this project to your idea
  • Build and run
    mvn clean package
    then start the first node:
    port=8000 java -jar target/kvs.jar
    start the second node:
    port=8001 java -jar target/kvs.jar
    start the third node:
    port=8002 java -jar target/kvs.jar

How to verify the correctness

  • After elected, shutdown the follower node, cluster will work nominally
  • After elected, shutdown the leader node, cluster will reelect successfully

Step

  • Bootstrap node1, node2 and node3 manually
  • Find the test case class AppTest.java
    • Run method addPeer1And2() notify node1 and node2 each other
    • Run method addPeer3() notify node2 to add a peer node3, so node2 will be leader theoretically
  • Congratulations, you already learned how to add a peer to a cluster
    • Run method removePeer1() remove peer the cluster leader will notify the followers to remove this node, and node3 will power off atomically, at the same time, the cluster keep working properly
  • Enjoy, you can try to edit the nodes which one you want to add and remove dynamically!

About

A distribute key-value system, base on raft protocal and hashmap, (a memory k-v system), still developing... if anyone have good idea to develop some interesting framework stuff, let me know, :) thanks in advance

Resources

Stars

Watchers

Forks

Packages

No packages published