按语法创建CouchDB群集失败

您所在的位置:网站首页 docker登录失败 按语法创建CouchDB群集失败

按语法创建CouchDB群集失败

2023-07-07 10:29| 来源: 网络整理| 查看: 265

我正在尝试以编程方式设置一个集群。为此,我遵循了文档(这里是https://docs.couchdb.org/en/stable/setup/cluster.html#the-cluster-setup-api),并为我创建了一个快速的python脚本。

然后,我得到以下输出:{'error': 'setup_error', 'reason': 'Cluster setup unable to sync admin passwords'}。因此,我决定尝试一下Fauxton接口(它可以工作),看看有什么问题。

对python脚本进行了一些更改,以便与Fauxton发送到集群的内容完全匹配。但是如果手动界面(通过Fauxton)工作,当复制幕后发生的事情时,我仍然得到这个"unable to sync“错误。这快把我逼疯了。

使用以下启动脚本:

for i in {1..3}; \ do echo "$i"5984:5984; \ docker run -d --rm -p "$i"5984:5984 \ -e NODENAME=box0$i.couch -e ERL_FLAGS='-setcookie "brumbrum"' \ -e COUCHDB_USER=admin -e COUCHDB_PASSWORD=admin \ --name box0$i --network couch \ couchdb:3.1.1; \ done

它使用couchdb的3.1.1版本创建了三个新的docker容器。我用来进行集群的脚本可以在这里找到:https://github.com/wasperen/couchdb_clusterify/blob/main/clusterize.py

谢谢你的帮助。但不管怎样:新年快乐!

只需一步一步地遵循文档,得到相同的结果:

root@75c127f35ad6:~# curl -X POST -H "Content-Type: application/json" http://admin:[email protected]:5984/_cluster_setup -d '{"action": "enable_cluster", "bind_address":"0.0.0.0", "username": "admin", "password":"admin", "node_count":"3"}' {"error":"bad_request","reason":"Cluster is already enabled"} root@75c127f35ad6:~# curl -X POST -H "Content-Type: application/json" http://admin:[email protected]:5984/_cluster_setup -d '{"action": "enable_cluster", "bind_address":"0.0.0.0", "username": "admin", "password":"admin", "port": 5984, "node_count": "3", "remote_node": "box02.couch", "remote_current_user": "admin", "remote_current_password": "admin" }' {"ok":true} root@75c127f35ad6:~# curl -X POST -H "Content-Type: application/json" http://admin:[email protected]:5984/_cluster_setup -d '{"action": "add_node", "host":"box02.couch", "port": 5984, "username": "admin", "password":"admin"}' {"ok":true} root@75c127f35ad6:~# curl -X POST -H "Content-Type: application/json" http://admin:[email protected]:5984/_cluster_setup -d '{"action": "enable_cluster", "bind_address":"0.0.0.0", "username": "admin", "password":"admin", "port": 5984, "node_count": "3", "remote_node": "box03.couch", "remote_current_user": "admin", "remote_current_password": "admin" }' {"ok":true} root@75c127f35ad6:~# curl -X POST -H "Content-Type: application/json" http://admin:[email protected]:5984/_cluster_setup -d '{"action": "add_node", "host":"box03.couch", "port": 5984, "username": "admin", "password":"admin"}' {"ok":true} root@75c127f35ad6:~# curl -X POST -H "Content-Type: application/json" http://admin:[email protected]:5984/_cluster_setup -d '{"action": "finish_cluster"}' {"error":"setup_error","reason":"Cluster setup unable to sync admin passwords"}

这是从浏览器日志中,使用Fauxton用户界面(在box01上):

POST http://localhost:15984//_cluster_setup DATA {"action":"enable_cluster","username":"admin","password":"admin","bind_address":"0.0.0.0","port":5984,"node_count":3,"singlenode":false} RESPONSE 400 {"error":"bad_request","reason":"Cluster is already enabled"} POST http://localhost:15984//_cluster_setup DATA {"action":"enable_cluster","username":"admin","password":"admin","bind_address":"0.0.0.0","port":5984,"node_count":3,"remote_node":"box02.couch","remote_current_user":"admin","remote_current_password":"admin"} RESPONSE 201 {"ok":true} POST http://localhost:15984//_cluster_setup DATA {"action":"add_node","username":"admin","password":"admin","host":"box02.couch","port":5984,"singlenode":false} RESPONSE 201 {"ok":true} POST http://localhost:15984//_cluster_setup DATA {"action":"enable_cluster","username":"admin","password":"admin","bind_address":"0.0.0.0","port":5984,"node_count":3,"remote_node":"box03.couch","remote_current_user":"admin","remote_current_password":"admin"} RESPONSE 201 {"ok":true} POST http://localhost:15984//_cluster_setup DATA {"action":"add_node","username":"admin","password":"admin","host":"box03.couch","port":5984,"singlenode":false} RESPONSE 201 {"ok":true} POST http://localhost:15984//_cluster_setup DATA {"action":"finish_cluster"} RESPONSE 201 {"ok":true} GET http://localhost:15984/_membership RESPONSE 200 {"all_nodes":["[email protected]","[email protected]","[email protected]"],"cluster_nodes":["[email protected]","[email protected]","[email protected]"]}


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3