public static void main(String... args) throws Exception {
PropertyConfigurator.configure("D:/log4j.properties");
try {
List<Replica> members = Lists.newArrayList();
members.add(Replica.fromString("localhost:10001"));
members.add(Replica.fromString("localhost:10002"));
File logDir = new File("D:/raft");
logDir.mkdir();
// configure the service
RaftService raft = RaftService.newBuilder().local(Replica.fromString("localhost:10000")).members(members).logDir(logDir).timeout(300).build(new Test());
// start this replica
Service guavaservice = raft.startAsync();
guavaservice.awaitRunning();
// let's commit some things
// for (int i = 0; i < 10; i++) {
// raft.commit(new byte[] { 'O', '_', 'o' });
// }
} catch (Exception e) {
e.printStackTrace();
}
}
Test.java 文件源码
java
阅读 23
收藏 0
点赞 0
评论 0
项目:TakinRPC
作者:
评论列表
文章目录