mongodb副本集,执行 rs.addArb(“172.18.30.110:27019”) 或者rs.add(“172.18.30.110:27019”, true) 添加仲裁节点,客户端卡住,半天没有反应,解决方法
1、可以退出主节点后,重新登录,
# Ctrl + C 或者: exit 退出主节点
myrs: PRIMARY > exit
bye
# 重新登录客户端
root@WIN - 20240529 BJA : / usr/ local/ mongodb# . /mongodb- linux- x86_64- ubuntu1804- 5.0 .28 / bin/ mongo -- host= 172.18 .30 .110 -- port= 27017
2、执行 以下 命令
myrs: PRIMARY > db. adminCommand ( { "setDefaultRWConcern" : 1 , "defaultWriteConcern" : { "w" : 2 } } )
3、再次执行添加仲裁节点命令
myrs: PRIMARY > rs. addArb ( "172.18.30.110:27019" ) :
4、演示:
myrs: PRIMARY > db. adminCommand ( { "setDefaultRWConcern" : 1 , "defaultWriteConcern" : { "w" : 2 } } )
{
"defaultReadConcern" : {
"level" : "local"
} ,
"defaultWriteConcern" : {
"w" : 2 ,
"wtimeout" : 0
} ,
"updateOpTime" : Timestamp ( 1722423661 , 1 ) ,
"updateWallClockTime" : ISODate ( "2024-07-31T11:01:02.859Z" ) ,
"defaultWriteConcernSource" : "global" ,
"defaultReadConcernSource" : "implicit" ,
"localUpdateWallClockTime" : ISODate ( "2024-07-31T11:01:03.141Z" ) ,
"ok" : 1 ,
"$clusterTime" : {
"clusterTime" : Timestamp ( 1722423663 , 1 ) ,
"signature" : {
"hash" : BinData ( 0 , "AAAAAAAAAAAAAAAAAAAAAAAAAAA=" ) ,
"keyId" : NumberLong ( 0 )
}
} ,
"operationTime" : Timestamp ( 1722423663 , 1 )
}
myrs: PRIMARY >
myrs: PRIMARY >
myrs: PRIMARY > rs. addArb ( "172.18.30.110:27019" )
{
"ok" : 1 ,
"$clusterTime" : {
"clusterTime" : Timestamp ( 1722423719 , 1 ) ,
"signature" : {
"hash" : BinData ( 0 , "AAAAAAAAAAAAAAAAAAAAAAAAAAA=" ) ,
"keyId" : NumberLong ( 0 )
}
} ,
"operationTime" : Timestamp ( 1722423719 , 1 )
}
myrs: PRIMARY >