简体   繁体   English

Couchbase REST API与CLI

[英]Couchbase REST API vs CLI

I'm trying to use the REST API on Couchbase 2.2 and I'm finding two things that I cannot seem to do via REST: 我正在尝试在Couchbase 2.2上使用REST API,并且发现了我似乎无法通过REST完成的两件事:

  1. Init a new cluster when no other nodes exist. 当不存在其他节点时,初始化一个新集群。 CLI version: couchbase-cli cluster-init -u admin -p mypw -c localhost:8091 --cluster-init-ramsize=1024 CLI版本: couchbase-cli cluster-init -u admin -p mypw -c localhost:8091 --cluster-init-ramsize=1024

  2. Remove a healthy node from the cluster. 从群集中删除运行状况良好的节点。 CLI version: couchbase-cli rebalance -u admin -p mypw -c 10.10.1.10:8091 --server-remove=10.10.1.12 CLI版本: couchbase-cli rebalance -u admin -p mypw -c 10.10.1.10:8091 --server-remove=10.10.1.12

As for removing a node, I've tried: 至于删除节点,我尝试过:

curl -u admin:mypw -d otpNode=ns_1@10.10.1.12 \
http://10.10.1.10:8091/controller/ejectNode

Which returns: "Cannot remove active server." 返回:“无法删除活动服务器。”

I've also tried: 我也尝试过:

curl -s -u Administrator:myclusterpw \
-d 'ejectedNodes=ns_1%4010.10.1.12&knownNodes=ns_1%4010.10.1.10%2Cns_1%4010.10.1.11' \
http://10.10.1.10:8091/controller/rebalance

Which returns: {"mismatch":1} (presumably due to the node actually not being marked for ejection?) 哪个返回: {"mismatch":1} (大概是由于该节点实际上未标记为退出?)

Am I crazy, or are there no ways to do these things using curl? 我疯了吗,还是没有办法使用curl来做这些事情?

I span up a two node cluster on aws (10.170.76.236 and 10.182.151.86), I was able to remove node 10.182.151.86 using the below curl request 我在aws(10.170.76.236和10.182.151.86)上跨了两个节点群集,我可以使用以下curl请求删除节点10.182.151.86

curl -v -u Administrator:password -X POST 'http://10.182.151.86:8091/controller/rebalance' -d 'ejectedNodes=ns_1@10.182.151.86&knownNodes=ns_1@10.182.151.86,ns_1@10.170.76.236'

That removes the node and performs the rebalance leaving only '10.170.76.236' as the single node. 这将删除该节点并执行重新平衡,仅将“ 10.170.76.236”作为单个节点。 Running this request below results in 'Cannot remove active server' as you have experienced. 根据您的经验,在下面运行此请求将导致“无法删除活动服务器”。

curl -u Administrator:password -d otpNode=ns_1@10.170.76.236 http://10.170.76.236:8091/controller/ejectNode

This is because you can't remove the last node as you can't perform a rebalance, this issue is covered here http://www.couchbase.com/issues/browse/MB-7517 这是因为您无法删除最后一个节点,因为您无法执行重新平衡,因此此问题已在此处http://www.couchbase.com/issues/browse/MB-7517涵盖

I left the real IP's in that I used so the curl requests are as clear as possible, I've terminated the nodes now though :) 我留下了我使用的真实IP,因此卷曲请求尽可能清晰了,尽管现在我已经终止了节点:)

Combo of: 组合:

curl -X POST -u admin:password -d username=Administrator \
-d password=letmein \
-d port=8091 \
http://localhost:8091/settings/web

and

curl -X POST -u admin:password -d memoryQuota=400 \
http://localhost:8091/pools/default

Ticket raised against this indicates that the ejectnode command itself won't work by design. 对此提出的票证表明,ejectnode命令本身在设计上不会起作用。

Server needs to either be pending or failover state to use that command seemingly 服务器需要处于挂起或故障转移状态才能使用该命令

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM