Couchbase重新平衡不匹配

时间:2016-09-23 07:33:48

标签: couchbase

配置我的群集后,使用cuchbase Rest API,当我想添加新节点,然后重新平衡时,我遇到了问题。

我正在做什么

为机器A创建帐户和群集

createAccount(){
    ip=$1
    curl -s -u ${USER}:${PASSWORD} -X POST http://${ip}:8091/pools/default -d memoryQuota=${QUOTA} }

createCluster(){
    ip=$1
    # Initialize Node
    curl  -u ${USER}:${PASSWORD} -v -X POST http://${ip}:8091/nodes/self/controller/settings \
      -d 'data_path=%2Fopt%2Fcouchbase%2Fvar%2Flib%2Fcouchbase%2Fdata& \
      index_path=%2Fopt%2Fcouchbase%2Fvar%2Flib%2Fcouchbase%2Fdata'

    # Rename Node
    curl  -u ${USER}:${PASSWORD} -v -X POST http://${ip}:8091/node/controller/rename \
      -d 'hostname=127.0.0.1'

    # Setup Services
    curl  -u ${USER}:${PASSWORD} -v -X POST http://${ip}:8091/node/controller/setupServices \
      -d 'services=kv%2Cn1ql%2Cindex'

    # Setup Administrator username and password
    curl  -u ${USER}:${PASSWORD} -v -X POST http://${ip}:8091/settings/web \
      -d "password=$PASSWORD&username=$USER&port=SAME"

}

为机器B创建帐户和群集(与上面相同的脚本)

然后添加服务器B呼叫服务器A

addServer(){
    curl -u ${USER}:${PASSWORD} http://A:8091/controller/addNode \
          -d "hostname=B&user=$USER&password=$PASSWORD&services=kv%2Cn1ql%2Cindex"

}

然后我可以看到A和B服务器中的B如何等待重新平衡。 但是当我尝试重新平衡呼叫A

rebalance(){
    masterIp=$1
    couchbaseNode=$2
    curl -v  -u ${USER}:${PASSWORD} -X POST http://A:8091/controller/rebalance \
    -d "knownNodes=ns_1@A, ns_1@B"
 }

服务器返回

  {"mismatch":1}

我在这里做错了什么?

此致

编辑:

这是提供额外信息的HTTP堆栈

第一台机器

----- CREATING COUCHBASE CLUSTER ON 172.31.35.67
*   Trying 172.31.35.67...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to 172.31.35.67 (172.31.35.67) port 8091 (#0)
* Server auth using Basic with user 'Administrator'
> POST /nodes/self/controller/settings HTTP/1.1
> Authorization: Basic QWRtaW5pc3RyYXRvcjpwb2xpdHJvbg==
> User-Agent: curl/7.40.0
> Host: 172.31.35.67:8091
> Accept: */*
> Content-Length: 129
> Content-Type: application/x-www-form-urlencoded
> 
} [129 bytes data]
* upload completely sent off: 129 out of 129 bytes

100   129    0     0  100   129      0    107  0:00:01  0:00:01 --:--:--   107< HTTP/1.1 200 OK
< Server: Couchbase Server
< Pragma: no-cache
< Date: Tue, 27 Sep 2016 09:27:59 GMT
< Content-Length: 0
< Cache-Control: no-cache
< 

100   129    0     0  100   129      0     79  0:00:01  0:00:01 --:--:--    80
* Connection #0 to host 172.31.35.67 left intact
*   Trying 172.31.35.67...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to 172.31.35.67 (172.31.35.67) port 8091 (#0)
* Server auth using Basic with user 'Administrator'
> POST /node/controller/rename HTTP/1.1
> Authorization: Basic QWRtaW5pc3RyYXRvcjpwb2xpdHJvbg==
> User-Agent: curl/7.40.0
> Host: 172.31.35.67:8091
> Accept: */*
> Content-Length: 18
> Content-Type: application/x-www-form-urlencoded
> 
} [18 bytes data]
* upload completely sent off: 18 out of 18 bytes
< HTTP/1.1 200 OK
< Server: Couchbase Server
< Pragma: no-cache
< Date: Tue, 27 Sep 2016 09:27:59 GMT
< Content-Length: 0
< Cache-Control: no-cache
< 

100    18    0     0  100    18      0   5253 --:--:-- --:--:-- --:--:--  6000
* Connection #0 to host 172.31.35.67 left intact
*   Trying 172.31.35.67...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to 172.31.35.67 (172.31.35.67) port 8091 (#0)
* Server auth using Basic with user 'Administrator'
> POST /node/controller/setupServices HTTP/1.1
> Authorization: Basic QWRtaW5pc3RyYXRvcjpwb2xpdHJvbg==
> User-Agent: curl/7.40.0
> Host: 172.31.35.67:8091
> Accept: */*
> Content-Length: 26
> Content-Type: application/x-www-form-urlencoded
> 
} [26 bytes data]
* upload completely sent off: 26 out of 26 bytes
< HTTP/1.1 200 OK
< Server: Couchbase Server
< Pragma: no-cache
< Date: Tue, 27 Sep 2016 09:27:59 GMT
< Content-Length: 0
< Cache-Control: no-cache
< 

100    26    0     0  100    26      0   3992 --:--:-- --:--:-- --:--:--  4333
* Connection #0 to host 172.31.35.67 left intact
*   Trying 172.31.35.67...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to 172.31.35.67 (172.31.35.67) port 8091 (#0)
* Server auth using Basic with user 'Administrator'
> POST /settings/web HTTP/1.1
> Authorization: Basic QWRtaW5pc3RyYXRvcjpwb2xpdHJvbg==
> User-Agent: curl/7.40.0
> Host: 172.31.35.67:8091
> Accept: */*
> Content-Length: 50
> Content-Type: application/x-www-form-urlencoded
> 
} [50 bytes data]
* upload completely sent off: 50 out of 50 bytes
< HTTP/1.1 200 OK
< Server: Couchbase Server
< Pragma: no-cache
< Date: Tue, 27 Sep 2016 09:27:59 GMT
< Content-Type: application/json
< Content-Length: 42
< Cache-Control: no-cache
< 
{ [42 bytes data]

第二台机器

   Trying 172.31.134.213...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to 172.31.134.213 (172.31.134.213) port 8091 (#0)
* Server auth using Basic with user 'Administrator'
> POST /nodes/self/controller/settings HTTP/1.1
> Authorization: Basic QWRtaW5pc3RyYXRvcjpwb2xpdHJvbg==
> User-Agent: curl/7.40.0
> Host: 172.31.134.213:8091
> Accept: */*
> Content-Length: 129
> Content-Type: application/x-www-form-urlencoded
> 
} [129 bytes data]
* upload completely sent off: 129 out of 129 bytes
100   129    0     0  100   129      0    107  0:00:01  0:00:01 --:--:--   107< HTTP/1.1 200 OK
< Server: Couchbase Server
< Pragma: no-cache
< Date: Tue, 27 Sep 2016 09:34:03 GMT
< Content-Length: 0
< Cache-Control: no-cache
< 

100   129    0     0  100   129      0     81  0:00:01  0:00:01 --:--:--    81
* Connection #0 to host 172.31.134.213 left intact
*   Trying 172.31.134.213...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to 172.31.134.213 (172.31.134.213) port 8091 (#0)
* Server auth using Basic with user 'Administrator'
> POST /node/controller/rename HTTP/1.1
> Authorization: Basic QWRtaW5pc3RyYXRvcjpwb2xpdHJvbg==
> User-Agent: curl/7.40.0
> Host: 172.31.134.213:8091
> Accept: */*
> Content-Length: 18
> Content-Type: application/x-www-form-urlencoded
> 
} [18 bytes data]
* upload completely sent off: 18 out of 18 bytes
< HTTP/1.1 200 OK
< Server: Couchbase Server
< Pragma: no-cache
< Date: Tue, 27 Sep 2016 09:34:03 GMT
< Content-Length: 0
< Cache-Control: no-cache
< 

100    18    0     0  100    18      0   1976 --:--:-- --:--:-- --:--:--  2000
* Connection #0 to host 172.31.134.213 left intact
*   Trying 172.31.134.213...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to 172.31.134.213 (172.31.134.213) port 8091 (#0)
* Server auth using Basic with user 'Administrator'
> POST /node/controller/setupServices HTTP/1.1
> Authorization: Basic QWRtaW5pc3RyYXRvcjpwb2xpdHJvbg==
> User-Agent: curl/7.40.0
> Host: 172.31.134.213:8091
> Accept: */*
> Content-Length: 26
> Content-Type: application/x-www-form-urlencoded
> 
} [26 bytes data]
* upload completely sent off: 26 out of 26 bytes
< HTTP/1.1 200 OK
< Server: Couchbase Server
< Pragma: no-cache
< Date: Tue, 27 Sep 2016 09:34:03 GMT
< Content-Length: 0
< Cache-Control: no-cache
< 

100    26    0     0  100    26      0   9626 --:--:-- --:--:-- --:--:-- 13000
* Connection #0 to host 172.31.134.213 left intact
*   Trying 172.31.134.213...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to 172.31.134.213 (172.31.134.213) port 8091 (#0)
* Server auth using Basic with user 'Administrator'
> POST /settings/web HTTP/1.1
> Authorization: Basic QWRtaW5pc3RyYXRvcjpwb2xpdHJvbg==
> User-Agent: curl/7.40.0
> Host: 172.31.134.213:8091
> Accept: */*
> Content-Length: 50
> Content-Type: application/x-www-form-urlencoded
> 
} [50 bytes data]
* upload completely sent off: 50 out of 50 bytes
< HTTP/1.1 200 OK
< Server: Couchbase Server
< Pragma: no-cache
< Date: Tue, 27 Sep 2016 09:34:03 GMT
< Content-Type: application/json
< Content-Length: 44
< Cache-Control: no-cache
< 
{ [44 bytes data]

100    94  100    44  100    50  15422  17525 --:--:-- --:--:-- --:--:-- 25000
* Connection #0 to host 172.31.134.213 left intact
{"newBaseUri":"http://172.31.134.213:8091/"}----- ADD NODE 172.31.134.213 IN COUCHBASE CLUSTER 172.31.35.67
masterID:172.31.35.67
node:172.31.134.213
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100    87    0     0  100    87      0  55769 --:--:-- --:--:-- --:--:-- 43500
 32   268    0     0  100    87      0     81  0:00:01  0:00:01 --:--:--    81
100   268  100   181  100    87    169     81  0:00:01  0:00:01 --:--:--   169
["Join completion call failed. Got HTTP status 500 from REST call post to http://172.31.134.213:8091/completeJoin. Body was: \"[\\\"Unexpected server error, request logged.\\\"]\""]----- REBALANCING NODE 172.31.134.213 IN COUCHBASE CLUSTER 172.31.35.67
*   Trying 172.31.35.67...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to 172.31.35.67 (172.31.35.67) port 8091 (#0)
* Server auth using Basic with user 'Administrator'
> POST /controller/rebalance HTTP/1.1
> Authorization: Basic QWRtaW5pc3RyYXRvcjpwb2xpdHJvbg==
> User-Agent: curl/7.40.0
> Host: 172.31.35.67:8091
> Accept: */*
> Content-Length: 30
> Content-Type: application/x-www-form-urlencoded
> 
} [30 bytes data]
* upload completely sent off: 30 out of 30 bytes
< HTTP/1.1 400 Bad Request
< Server: Couchbase Server
< Pragma: no-cache
< Date: Tue, 27 Sep 2016 09:34:04 GMT
< Content-Type: application/json
< Content-Length: 14
< Cache-Control: no-cache
< 
{ [14 bytes data]

100    44  100    14  100    30  11965  25641 --:--:-- --:--:-- --:--:-- 30000
* Connection #0 to host 172.31.35.67 left intact
{"mismatch":1}

正如您所看到的,最后一个请求因400代码而失败

1 个答案:

答案 0 :(得分:1)

在knownNodes列表中,删除节点之间的空格。我能够复制它。使用空格,{“mismatch”:1}。没有空格,它就有效。

我在这个问题的文档上打开了一个错误。