主机:172.30.3.231
sudo chown 999 /work/redis-cluster/redis-node1/data/ /work/redis-cluster/redis-node1/logs/
sudo chown 999 /work/redis-cluster/redis-node2/data/ /work/redis-cluster/redis-node2/logs/
主机:172.30.3.234
sudo chown 999 /work/redis-cluster/redis-node3/data/ /work/redis-cluster/redis-node3/logs/
sudo chown 999 /work/redis-cluster/redis-node4/data/ /work/redis-cluster/redis-node4/logs/
主机:172.30.3.238
sudo chown 999 /work/redis-cluster/redis-node5/data/ /work/redis-cluster/redis-node5/logs/
sudo chown 999 /work/redis-cluster/redis-node6/data/ /work/redis-cluster/redis-node6/logs/
/work/mongo-cluster/config/bin/start.sh
连接任意节点
docker exec -it config mongo --port 27018
初始化副本
redis-cli --cluster create 172.30.3.231:30001 172.30.3.231:30002 172.30.3.234:30001 172.30.3.234:30002 172.30.3.238:30001 172.30.3.238:30002 --cluster-replicas 1
返回值
{
"ok" : 1,
"$gleStats" : {
"lastOpTime" : Timestamp(1586588112, 1),
"electionId" : ObjectId("000000000000000000000000")
},
"lastCommittedOpTime" : Timestamp(0, 0)
}
rs.status()
返回值
{
"set" : "configs",
"date" : ISODate("2020-04-11T06:55:43.899Z"),
"myState" : 1,
"term" : NumberLong(1),
"syncingTo" : "",
"syncSourceHost" : "",
"syncSourceId" : -1,
"configsvr" : true,
"heartbeatIntervalMillis" : NumberLong(2000),
"majorityVoteCount" : 2,
"writeMajorityCount" : 2,
"optimes" : {
"lastCommittedOpTime" : {
"ts" : Timestamp(1586588143, 1),
"t" : NumberLong(1)
},
"lastCommittedWallTime" : ISODate("2020-04-11T06:55:43.562Z"),
"readConcernMajorityOpTime" : {
"ts" : Timestamp(1586588143, 1),
"t" : NumberLong(1)
},
"readConcernMajorityWallTime" : ISODate("2020-04-11T06:55:43.562Z"),
"appliedOpTime" : {
"ts" : Timestamp(1586588143, 1),
"t" : NumberLong(1)
},
"durableOpTime" : {
"ts" : Timestamp(1586588143, 1),
"t" : NumberLong(1)
},
"lastAppliedWallTime" : ISODate("2020-04-11T06:55:43.562Z"),
"lastDurableWallTime" : ISODate("2020-04-11T06:55:43.562Z")
},
"lastStableRecoveryTimestamp" : Timestamp(1586588123, 1),
"lastStableCheckpointTimestamp" : Timestamp(1586588123, 1),
"electionCandidateMetrics" : {
"lastElectionReason" : "electionTimeout",
"lastElectionDate" : ISODate("2020-04-11T06:55:22.969Z"),
"electionTerm" : NumberLong(1),
"lastCommittedOpTimeAtElection" : {
"ts" : Timestamp(0, 0),
"t" : NumberLong(-1)
},
"lastSeenOpTimeAtElection" : {
"ts" : Timestamp(1586588112, 1),
"t" : NumberLong(-1)
},
"numVotesNeeded" : 2,
"priorityAtElection" : 1,
"electionTimeoutMillis" : NumberLong(10000),
"numCatchUpOps" : NumberLong(0),
"newTermStartDate" : ISODate("2020-04-11T06:55:23.013Z"),
"wMajorityWriteAvailabilityDate" : ISODate("2020-04-11T06:55:23.593Z")
},
"members" : [
{
"_id" : 0,
"name" : "172.30.3.231:27018",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"uptime" : 283,
"optime" : {
"ts" : Timestamp(1586588143, 1),
"t" : NumberLong(1)
},
"optimeDate" : ISODate("2020-04-11T06:55:43Z"),
"syncingTo" : "",
"syncSourceHost" : "",
"syncSourceId" : -1,
"infoMessage" : "could not find member to sync from",
"electionTime" : Timestamp(1586588122, 1),
"electionDate" : ISODate("2020-04-11T06:55:22Z"),
"configVersion" : 1,
"self" : true,
"lastHeartbeatMessage" : ""
},
{
"_id" : 1,
"name" : "172.30.3.234:27018",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 31,
"optime" : {
"ts" : Timestamp(1586588131, 1),
"t" : NumberLong(1)
},
"optimeDurable" : {
"ts" : Timestamp(1586588131, 1),
"t" : NumberLong(1)
},
"optimeDate" : ISODate("2020-04-11T06:55:31Z"),
"optimeDurableDate" : ISODate("2020-04-11T06:55:31Z"),
"lastHeartbeat" : ISODate("2020-04-11T06:55:42.991Z"),
"lastHeartbeatRecv" : ISODate("2020-04-11T06:55:42.499Z"),
"pingMs" : NumberLong(0),
"lastHeartbeatMessage" : "",
"syncingTo" : "172.30.3.238:27018",
"syncSourceHost" : "172.30.3.238:27018",
"syncSourceId" : 2,
"infoMessage" : "",
"configVersion" : 1
},
{
"_id" : 2,
"name" : "172.30.3.238:27018",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 31,
"optime" : {
"ts" : Timestamp(1586588131, 1),
"t" : NumberLong(1)
},
"optimeDurable" : {
"ts" : Timestamp(1586588131, 1),
"t" : NumberLong(1)
},
"optimeDate" : ISODate("2020-04-11T06:55:31Z"),
"optimeDurableDate" : ISODate("2020-04-11T06:55:31Z"),
"lastHeartbeat" : ISODate("2020-04-11T06:55:42.991Z"),
"lastHeartbeatRecv" : ISODate("2020-04-11T06:55:42.003Z"),
"pingMs" : NumberLong(0),
"lastHeartbeatMessage" : "",
"syncingTo" : "172.30.3.231:27018",
"syncSourceHost" : "172.30.3.231:27018",
"syncSourceId" : 0,
"infoMessage" : "",
"configVersion" : 1
}
],
"ok" : 1,
"$gleStats" : {
"lastOpTime" : Timestamp(1586588112, 1),
"electionId" : ObjectId("7fffffff0000000000000001")
},
"lastCommittedOpTime" : Timestamp(1586588143, 1),
"$clusterTime" : {
"clusterTime" : Timestamp(1586588143, 1),
"signature" : {
"hash" : BinData(0,"y6G4iMqVbLG/vu3tmPZy2421Y3s="),
"keyId" : NumberLong("6814344100507025437")
}
},
"operationTime" : Timestamp(1586588143, 1)
}
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。