运行程序
/Users/liyuechun/go
liyuechun:go yuechunli$ go install main
liyuechun:go yuechunli$ main
My details: NodeInfo:{ nodeId:53163002, nodeIpAddr:127.0.0.1/8, port:8001 }
不能连接到集群. 53163002
Quitting system. Set makeMasterOnError flag to make the node master. 53163002
liyuechun:go yuechunli$
获取相关帮助信息
$ ./bin/main -h
liyuechun:go yuechunli$ ./bin/main -h
Usage of ./bin/main:
-clusterip string
ip address of any node to connnect (default "127.0.0.1:8001")
-makeMasterOnError
make this node master if unable to connect to the cluster ip provided.
-myport string
ip address to run this node on. default is 8001. (default "8001")
liyuechun:go yuechunli$
启动Node1主节点
$ ./bin/main --makeMasterOnError
liyuechun:go yuechunli$ ./bin/main --makeMasterOnError
My details: NodeInfo:{ nodeId:82381143, nodeIpAddr:127.0.0.1/8, port:8001 }
未连接到集群. 82381143
Will start this node as master.
添加节点Node2到集群
$ ./bin/main --myport 8002 --clusterip 127.0.0.1:8001
添加节点Node3到集群
main --myport 8004 --clusterip 127.0.0.1:8001
添加节点Node4到集群
$ main --myport 8003 --clusterip 127.0.0.1:8002

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持易采站长站。










