this is a demo project for acquiring a lock given task id in distributed application.
-
Standalone cluster
: acquire locks depends on property. -
Radis cluster
: acquire locks by using redis. -
Zookeeper cluster
: acquire locks by using zookeeper. -
Raft cluster
: acquire locks by using raft algorithm.
// start server1
$ ./gradlew bootRun \
-PjvmArgs="-Dserver.port=8080 -Dcluster.id=server1" \
-Pargs="--spring.config.location=classpath:/standalone.yaml"
// start server2
$ ./gradlew bootRun \
-PjvmArgs="-Dserver.port=8081 -Dcluster.id=server2" \
-Pargs="--spring.config.location=classpath:/standalone.yaml"
$ cd compose/zookeeper
$ docker-compose up
// start server1
$ ./gradlew bootRun \
-PjvmArgs="-Dserver.port=8080 -Dcluster.id=server1" \
-Pargs="--spring.config.location=classpath:/zookeeper.yaml"
// start server2
$ ./gradlew bootRun \
-PjvmArgs="-Dserver.port=8081 -Dcluster.id=server1" \
-Pargs="--spring.config.location=classpath:/zookeeper.yaml"
$ cd compose/redis
$ docker-compose up
// start server1
$ ./gradlew bootRun \
-PjvmArgs="-Dserver.port=8080 -Dcluster.id=server1" \
-Pargs="--spring.config.location=classpath:/redis.yaml"
// start server2
$ ./gradlew bootRun \
-PjvmArgs="-Dserver.port=8081 -Dcluster.id=server1" \
-Pargs="--spring.config.location=classpath:/redis.yaml"