我正在关注本文档:
http://docs.couchdb.org/en/latest/cluster/setup.html#the-cluster-setup-api
11.1部分:群集设置API
我有3台安装了CouchDB和Curl的ubuntu机器,并具有以下ips:
第一步,正如文档所述,我正在3台计算机上分别输入以下命令(已设置管理员密码。):
> curl -X POST -H "Content-Type: application/json"
> http://admin:password@127.0.0.1:5984/_cluster_setup -d '{"action":
> "enable_cluster", "bind_address":"0.0.0.0", "username": "admin",
> "password":"password", "node_count":"3"}'
它在每台机器上都这样说:
{"ok":true}
第二步,我进入192.168.219.139(设置协调节点)并尝试添加节点,因此我输入这些命令,就像文档中提到的那样:
curl -X POST -H "Content-Type: application/json" http://admin:password@127.0.0.1:5984/_cluster_setup -d '{"action": "enable_cluster", "bind_address":"0.0.0.0", "username": "admin", "password":"password", "port": 15984, "node_count": "3", "remote_node": "192.168.219.138", "remote_current_user": "admin", "remote_current_password": "password" }'
curl -X POST -H "Content-Type: application/json" http://admin:password@127.0.0.1:5984/_cluster_setup -d '{"action": "add_node", "host":"192.168.219.138", "port": 5684, "username": "admin", "password":"password"}'
curl -X POST -H "Content-Type: application/json" http://admin:password@127.0.0.1:5984/_cluster_setup -d '{"action": "enable_cluster", "bind_address":"0.0.0.0", "username": "admin", "password":"password", "port": 15984, "node_count": "3", "remote_node": "192.168.219.140", "remote_current_user": "admin", "remote_current_password": "password" }'
curl -X POST -H "Content-Type: application/json" http://admin:password@127.0.0.1:5984/_cluster_setup -d '{"action": "add_node", "host":"192.168.219.140", "port": 5684, "username": "admin", "password":"password"}'
然后,我执行此命令检查集群是否正常:
curl http://admin:password@127.0.0.1:5984/_membership
这就是答案,所有节点都丢失了:
{
"all_nodes": [
"couchdb@localhost"
],
"cluster_nodes": [
"couchdb@192.168.219.138",
"couchdb@192.168.219.140",
"couchdb@locahost"
]
}
请注意,医生说我应该得到这个:
{
"all_nodes": [
"couchdb@couch1",
"couchdb@couch2",
"couchdb@couch3"
],
"cluster_nodes": [
"couchdb@couch1",
"couchdb@couch2",
"couchdb@couch3"
]
}
我想我的集群无法正常工作,请您告诉我我做错了什么吗?
谢谢。
例如,然后我转到192.168.219.139,添加一个名为“ Establishments”的新数据库,而其他两个节点上都什么都没有发生!
答案 0 :(得分:0)
不确定这是否是错字,但是在第二步中,您有:
curl -X POST -H "Content-Type: application/json" http://admin:password@127.0.0.1:5984/_cluster_setup -d '{"action": "enable_cluster", "bind_address":"0.0.0.0", "username": "admin", "password":"password", "port": 15984, "node_count": "3", "remote_node": "192.168.219.138", "remote_current_user": "admin", "remote_current_password": "password" }'
通知"port": 15984
但是,如果这不是问题,那么可能会有很多问题。群集操作发生在erlang端口上,因此不同的节点也必须通过EPMD端口(4396)以及您可以限制的其他范围的端口进行讲话。每个节点都应具有一个带有此erlang标志-name couchdb@${node-ip-address|FQDN}
的配置(例如,在vm.args文件中),以及一个可供长沙发节点用来相互交谈的cookie。当然,根据您共享内容之外的因素,可能还会有其他考虑因素。