{"id":614,"date":"2018-07-11T16:08:17","date_gmt":"2018-07-11T08:08:17","guid":{"rendered":"https:\/\/vinta.ws\/code\/?p=614"},"modified":"2026-03-17T01:16:50","modified_gmt":"2026-03-16T17:16:50","slug":"mongodb-operations-replica-set","status":"publish","type":"post","link":"https:\/\/vinta.ws\/code\/mongodb-operations-replica-set.html","title":{"rendered":"MongoDB operations: Replica Set"},"content":{"rendered":"<p>A replica set is a group of servers (<code>mongod<\/code> actually) that maintain the same data set, with one primary which takes client requests, and multiple secondaries that keep copies of the primary's data. If the primary crashes, secondaries can elect a new primary from amongst themselves.<\/p>\n<p>Replication from primary to secondaries is asynchronous.<\/p>\n<p>ref:<br \/>\n<a href=\"https:\/\/docs.mongodb.com\/v3.6\/replication\/\">https:\/\/docs.mongodb.com\/v3.6\/replication\/<\/a><br \/>\n<a href=\"https:\/\/www.safaribooksonline.com\/library\/view\/mongodb-the-definitive\/9781491954454\/ch08.html\">https:\/\/www.safaribooksonline.com\/library\/view\/mongodb-the-definitive\/9781491954454\/ch08.html<\/a><br \/>\n<a href=\"https:\/\/www.percona.com\/blog\/2018\/10\/10\/mongodb-replica-set-scenarios-and-internals\/\">https:\/\/www.percona.com\/blog\/2018\/10\/10\/mongodb-replica-set-scenarios-and-internals\/<\/a><\/p>\n<h2>Concepts<\/h2>\n<ul>\n<li>Primary: A node that accepts writes and is the leader for voting. There can be only one primary.<\/li>\n<li>Secondary: A node that replicates from the primary or another secondary and can be used for reads. There can be a max of 127.<\/li>\n<li>Arbiter: The node does not hold data and only participates in the voting. Also, it cannot be elected as the primary.\n<ul>\n<li>In the event your node count is an even number, add one of these to break the tie. Never add one where it would make the count even.<\/li>\n<\/ul>\n<\/li>\n<li>Priority 0 node: The node cannot be selected as the primary. You might want to lower priority of some slow nodes.\n<ul>\n<li>Priority allows you to prefer specific nodes are primary.<\/li>\n<\/ul>\n<\/li>\n<li>Vote 0 node: The node does not participate in the voting.\n<ul>\n<li>In some cases, having more than eight nodes means additional nodes must not vote.<\/li>\n<\/ul>\n<\/li>\n<li>Hidden node: The hidden node must be a priority 0 node and is invisible to the driver which  unable to take queries from clients.<\/li>\n<li>Delayed node: The delayed node must be a hidden node, and its data lag behind the primary for some time.<\/li>\n<li>Tags: Grants special ability to make queries directly to specific nodes. Useful for BI, geo-locality, and other advanced functions.<\/li>\n<\/ul>\n<p>ref:<br \/>\n<a href=\"https:\/\/docs.mongodb.com\/manual\/core\/replica-set-elections\/\">https:\/\/docs.mongodb.com\/manual\/core\/replica-set-elections\/<\/a><br \/>\n<a href=\"https:\/\/docs.mongodb.com\/manual\/core\/replica-set-priority-0-member\/\">https:\/\/docs.mongodb.com\/manual\/core\/replica-set-priority-0-member\/<\/a><br \/>\n<a href=\"https:\/\/docs.mongodb.com\/manual\/core\/replica-set-hidden-member\/\">https:\/\/docs.mongodb.com\/manual\/core\/replica-set-hidden-member\/<\/a><br \/>\n<a href=\"https:\/\/docs.mongodb.com\/manual\/core\/replica-set-delayed-member\/\">https:\/\/docs.mongodb.com\/manual\/core\/replica-set-delayed-member\/<\/a><\/p>\n<h2>Common Architectures<\/h2>\n<p>ref:<br \/>\n<a href=\"https:\/\/docs.mongodb.com\/v3.6\/core\/replica-set-architectures\/\">https:\/\/docs.mongodb.com\/v3.6\/core\/replica-set-architectures\/<\/a><br \/>\n<a href=\"https:\/\/www.percona.com\/blog\/2018\/03\/22\/the-anatomy-of-a-mongodb-replica-set\/\">https:\/\/www.percona.com\/blog\/2018\/03\/22\/the-anatomy-of-a-mongodb-replica-set\/<\/a><\/p>\n<h3>Three-Node Replica Set: Primary, Secondary, Secondary<\/h3>\n<p>ref:<br \/>\n<a href=\"https:\/\/docs.mongodb.com\/v3.6\/tutorial\/deploy-replica-set\/\">https:\/\/docs.mongodb.com\/v3.6\/tutorial\/deploy-replica-set\/<\/a><br \/>\n<a href=\"https:\/\/docs.mongodb.com\/v3.6\/tutorial\/expand-replica-set\/\">https:\/\/docs.mongodb.com\/v3.6\/tutorial\/expand-replica-set\/<\/a><\/p>\n<p>If you are running MongoDB cluster on Kubernetes, PLEASE USE THE FULL DNS NAME (FQDN). DO NOT use something like <code>pod-name.service-name<\/code>.<\/p>\n<pre class=\"line-numbers\"><code class=\"language-js\">$ mongo mongodb-rs0-0.mongodb-rs0.default.svc.cluster.local\n&gt; rs.initiate({\n   _id : \"rs0\",\n   members: [\n      {_id: 0, host: \"mongodb-rs0-0.mongodb-rs0.default.svc.cluster.local:27017\"},\n      {_id: 1, host: \"mongodb-rs0-1.mongodb-rs0.default.svc.cluster.local:27017\"},\n      {_id: 2, host: \"mongodb-rs0-2.mongodb-rs0.default.svc.cluster.local:27017\"}\n   ]\n})\n{\n    \"ok\" : 1,\n    \"operationTime\" : Timestamp(1531223087, 1),\n    \"$clusterTime\" : {\n        \"clusterTime\" : Timestamp(1531223087, 1),\n        \"signature\" : {\n            \"hash\" : BinData(0,\"AAAAAAAAAAAAAAAAAAAAAAAAAAA=\"),\n            \"keyId\" : NumberLong(0)\n        }\n    }\n}\nrs0:PRIMARY&gt; db.isMaster()<\/code><\/pre>\n<p>ref:<br \/>\n<a href=\"https:\/\/docs.mongodb.com\/v3.6\/reference\/method\/rs.initiate\/\">https:\/\/docs.mongodb.com\/v3.6\/reference\/method\/rs.initiate\/<\/a><\/p>\n<pre class=\"line-numbers\"><code class=\"language-js\">$ mongo mongodb-rs0-2.mongodb-rs0.default.svc.cluster.local\nrs0:SECONDARY&gt; rs.slaveOk()\nrs0:SECONDARY&gt; show dbs\nrs0:SECONDARY&gt; rs.conf()\n{\n    \"_id\" : \"rs0\",\n    \"version\" : 1,\n    \"protocolVersion\" : NumberLong(1),\n    \"members\" : [\n        {\n            \"_id\" : 0,\n            \"host\" : \"mongodb-rs0-0.mongodb-rs0.default.svc.cluster.local:27017\",\n            \"arbiterOnly\" : false,\n            \"buildIndexes\" : true,\n            \"hidden\" : false,\n            \"priority\" : 1,\n            \"tags\" : {\n\n            },\n            \"slaveDelay\" : NumberLong(0),\n            \"votes\" : 1\n        },\n        {\n            \"_id\" : 1,\n            \"host\" : \"mongodb-rs0-1.mongodb-rs0.default.svc.cluster.local:27017\",\n            \"arbiterOnly\" : false,\n            \"buildIndexes\" : true,\n            \"hidden\" : false,\n            \"priority\" : 1,\n            \"tags\" : {\n\n            },\n            \"slaveDelay\" : NumberLong(0),\n            \"votes\" : 1\n        },\n        {\n            \"_id\" : 2,\n            \"host\" : \"mongodb-rs0-2.mongodb-rs0.default.svc.cluster.local:27017\",\n            \"arbiterOnly\" : false,\n            \"buildIndexes\" : true,\n            \"hidden\" : false,\n            \"priority\" : 1,\n            \"tags\" : {\n\n            },\n            \"slaveDelay\" : NumberLong(0),\n            \"votes\" : 1\n        }\n    ],\n    \"settings\" : {\n        \"chainingAllowed\" : true,\n        \"heartbeatIntervalMillis\" : 2000,\n        \"heartbeatTimeoutSecs\" : 10,\n        \"electionTimeoutMillis\" : 10000,\n        \"catchUpTimeoutMillis\" : -1,\n        \"catchUpTakeoverDelayMillis\" : 30000,\n        \"getLastErrorModes\" : {\n\n        },\n        \"getLastErrorDefaults\" : {\n            \"w\" : 1,\n            \"wtimeout\" : 0\n        },\n        \"replicaSetId\" : ObjectId(\"5b449c2f9269bb1a807a8cdf\")\n    }\n}\nrs0:SECONDARY&gt; rs.status()\n{\n    \"set\" : \"rs0\",\n    \"date\" : ISODate(\"2018-07-10T11:47:48.474Z\"),\n    \"myState\" : 1,\n    \"term\" : NumberLong(1),\n    \"heartbeatIntervalMillis\" : NumberLong(2000),\n    \"optimes\" : {\n        \"lastCommittedOpTime\" : {\n            \"ts\" : Timestamp(1531223260, 1),\n            \"t\" : NumberLong(1)\n        },\n        \"readConcernMajorityOpTime\" : {\n            \"ts\" : Timestamp(1531223260, 1),\n            \"t\" : NumberLong(1)\n        },\n        \"appliedOpTime\" : {\n            \"ts\" : Timestamp(1531223260, 1),\n            \"t\" : NumberLong(1)\n        },\n        \"durableOpTime\" : {\n            \"ts\" : Timestamp(1531223260, 1),\n            \"t\" : NumberLong(1)\n        }\n    },\n    \"members\" : [\n        {\n            \"_id\" : 0,\n            \"name\" : \"mongodb-rs0-0.mongodb-rs0.default.svc.cluster.local:27017\",\n            \"health\" : 1,\n            \"state\" : 1,\n            \"stateStr\" : \"PRIMARY\",\n            \"uptime\" : 381,\n            \"optime\" : {\n                \"ts\" : Timestamp(1531223260, 1),\n                \"t\" : NumberLong(1)\n            },\n            \"optimeDate\" : ISODate(\"2018-07-10T11:47:40Z\"),\n            \"electionTime\" : Timestamp(1531223098, 1),\n            \"electionDate\" : ISODate(\"2018-07-10T11:44:58Z\"),\n            \"configVersion\" : 1,\n            \"self\" : true\n        },\n        {\n            \"_id\" : 1,\n            \"name\" : \"mongodb-rs0-1.mongodb-rs0.default.svc.cluster.local:27017\",\n            \"health\" : 1,\n            \"state\" : 2,\n            \"stateStr\" : \"SECONDARY\",\n            \"uptime\" : 181,\n            \"optime\" : {\n                \"ts\" : Timestamp(1531223260, 1),\n                \"t\" : NumberLong(1)\n            },\n            \"optimeDurable\" : {\n                \"ts\" : Timestamp(1531223260, 1),\n                \"t\" : NumberLong(1)\n            },\n            \"optimeDate\" : ISODate(\"2018-07-10T11:47:40Z\"),\n            \"optimeDurableDate\" : ISODate(\"2018-07-10T11:47:40Z\"),\n            \"lastHeartbeat\" : ISODate(\"2018-07-10T11:47:46.599Z\"),\n            \"lastHeartbeatRecv\" : ISODate(\"2018-07-10T11:47:47.332Z\"),\n            \"pingMs\" : NumberLong(0),\n            \"syncingTo\" : \"mongodb-rs0-0.mongodb-rs0.default.svc.cluster.local:27017\",\n            \"configVersion\" : 1\n        },\n        {\n            \"_id\" : 2,\n            \"name\" : \"mongodb-rs0-2.mongodb-rs0.default.svc.cluster.local:27017\",\n            \"health\" : 1,\n            \"state\" : 2,\n            \"stateStr\" : \"SECONDARY\",\n            \"uptime\" : 181,\n            \"optime\" : {\n                \"ts\" : Timestamp(1531223260, 1),\n                \"t\" : NumberLong(1)\n            },\n            \"optimeDurable\" : {\n                \"ts\" : Timestamp(1531223260, 1),\n                \"t\" : NumberLong(1)\n            },\n            \"optimeDate\" : ISODate(\"2018-07-10T11:47:40Z\"),\n            \"optimeDurableDate\" : ISODate(\"2018-07-10T11:47:40Z\"),\n            \"lastHeartbeat\" : ISODate(\"2018-07-10T11:47:46.599Z\"),\n            \"lastHeartbeatRecv\" : ISODate(\"2018-07-10T11:47:47.283Z\"),\n            \"pingMs\" : NumberLong(0),\n            \"syncingTo\" : \"mongodb-rs0-0.mongodb-rs0.default.svc.cluster.local:27017\",\n            \"configVersion\" : 1\n        }\n    ],\n    \"ok\" : 1,\n    \"operationTime\" : Timestamp(1531223260, 1),\n    \"$clusterTime\" : {\n        \"clusterTime\" : Timestamp(1531223260, 1),\n        \"signature\" : {\n            \"hash\" : BinData(0,\"AAAAAAAAAAAAAAAAAAAAAAAAAAA=\"),\n            \"keyId\" : NumberLong(0)\n        }\n    }\n}<\/code><\/pre>\n<h3>Three-Node Replica Set: Primary, Secondary, Arbiter<\/h3>\n<p>If your replica set has an even number of members, add an arbiter to obtain a majority of votes in an election for primary. Arbiters do not require dedicated hardware.<\/p>\n<p>ref:<br \/>\n<a href=\"https:\/\/docs.mongodb.com\/v3.6\/tutorial\/add-replica-set-arbiter\/\">https:\/\/docs.mongodb.com\/v3.6\/tutorial\/add-replica-set-arbiter\/<\/a><\/p>\n<h2>Issues<\/h2>\n<h3>Change Replica Set Name<\/h3>\n<ol>\n<li>Start <code>mongod<\/code> without <code>--replSet<\/code><\/li>\n<li>Run <code>db.system.replset.remove({_id: &#039;oldReplicaSetName&#039;})<\/code> in MongoDB Shell<\/li>\n<li>Start <code>mongod<\/code> with <code>--replSet &quot;newReplicaSetName&quot;<\/code><\/li>\n<\/ol>\n<p>ref:<br \/>\n<a href=\"https:\/\/stackoverflow.com\/questions\/33400607\/how-do-i-rename-a-mongodb-replica-set\">https:\/\/stackoverflow.com\/questions\/33400607\/how-do-i-rename-a-mongodb-replica-set<\/a><\/p>\n<h3>InvalidReplicaSetConfig: Our replica set configuration is invalid or does not include us<\/h3>\n<pre class=\"line-numbers\"><code class=\"language-console\">$ kubectl logs -f mongodb-rs0-0\nREPL_HB [replexec-10] Error in heartbeat (requestId: 20048) to mongodb-rs0-2.mongodb-rs0:27017, response status: InvalidReplicaSetConfig: Our replica set configuration is invalid or does not include us<\/code><\/pre>\n<pre class=\"line-numbers\"><code class=\"language-js\">$ mongo mongodb-rs0-2.mongodb-rs0.default.svc.cluster.local\nrs0:OTHER&gt; rs.status()\n{\n    \"state\" : 10,\n    \"stateStr\" : \"REMOVED\",\n    \"uptime\" : 631,\n    \"optime\" : {\n        \"ts\" : Timestamp(1531224140, 1),\n        \"t\" : NumberLong(1)\n    },\n    \"optimeDate\" : ISODate(\"2018-07-10T12:02:20Z\"),\n    \"ok\" : 0,\n    \"errmsg\" : \"Our replica set config is invalid or we are not a member of it\",\n    \"code\" : 93,\n    \"codeName\" : \"InvalidReplicaSetConfig\",\n    \"operationTime\" : Timestamp(1531224140, 1),\n    \"$clusterTime\" : {\n        \"clusterTime\" : Timestamp(1531224790, 1),\n        \"signature\" : {\n            \"hash\" : BinData(0,\"AAAAAAAAAAAAAAAAAAAAAAAAAAA=\"),\n            \"keyId\" : NumberLong(0)\n        }\n    }\n}\n\n$ mongo mongodb-rs0-0.mongodb-rs0.default.svc.cluster.local\nrs0:PRIMARY&gt; rs.conf() \n{\n    \"_id\" : \"rs0\",\n    \"version\" : 9,\n    \"protocolVersion\" : NumberLong(1),\n    \"members\" : [\n        {\n            \"_id\" : 0,\n            \"host\" : \"mongodb-rs0-0.mongodb-rs0.default.svc.cluster.local:27017\",\n            \"arbiterOnly\" : false,\n            \"buildIndexes\" : true,\n            \"hidden\" : false,\n            \"priority\" : 1,\n            \"tags\" : {\n\n            },\n            \"slaveDelay\" : NumberLong(0),\n            \"votes\" : 1\n        },\n        {\n            \"_id\" : 1,\n            \"host\" : \"mongodb-rs0-1.mongodb-rs0.default.svc.cluster.local:27017\",\n            \"arbiterOnly\" : false,\n            \"buildIndexes\" : true,\n            \"hidden\" : false,\n            \"priority\" : 1,\n            \"tags\" : {\n\n            },\n            \"slaveDelay\" : NumberLong(0),\n            \"votes\" : 1\n        },\n        {\n            \"_id\" : 2,\n            \"host\" : \"mongodb-rs0-2.mongodb-rs0.default.svc.cluster.local:27017\",\n            \"arbiterOnly\" : false,\n            \"buildIndexes\" : true,\n            \"hidden\" : false,\n            \"priority\" : 1,\n            \"tags\" : {\n\n            },\n            \"slaveDelay\" : NumberLong(0),\n            \"votes\" : 1\n        }\n    ],\n    \"settings\" : {\n        \"chainingAllowed\" : true,\n        \"heartbeatIntervalMillis\" : 2000,\n        \"heartbeatTimeoutSecs\" : 10,\n        \"electionTimeoutMillis\" : 10000,\n        \"catchUpTimeoutMillis\" : -1,\n        \"catchUpTakeoverDelayMillis\" : 30000,\n        \"getLastErrorModes\" : {\n\n        },\n        \"getLastErrorDefaults\" : {\n            \"w\" : 1,\n            \"wtimeout\" : 0\n        },\n        \"replicaSetId\" : ObjectId(\"5b449c2f9269bb1a807a8cdf\")\n    }\n}<\/code><\/pre>\n<p>The faulty member's state is <code>REMOVED<\/code> (it was once in a replica set but was subsequently removed) and shows <code>Our replica set config is invalid or we are not a member of it<\/code>. In fact, the real issue is that the removed node is still in the list of replica set members.<\/p>\n<p>You could just manually remove the broken node from the replica set on the primary, restart the node, and re-add the node.<\/p>\n<pre class=\"line-numbers\"><code class=\"language-js\">$ mongo mongodb-rs0-0.mongodb-rs0.default.svc.cluster.local\nrs0:PRIMARY&gt; rs.remove(\"mongodb-rs0-2.mongodb-rs0.default.svc.cluster.local:27017\")\n\n# restart the Pod\n$ kubectl delete mongodb-rs0-2\n\n$ mongo mongodb-rs0-0.mongodb-rs0.default.svc.cluster.local\nrs0:PRIMARY&gt; rs.add(\"mongodb-rs0-2.mongodb-rs0.default.svc.cluster.local:27017\")<\/code><\/pre>\n<p>ref:<br \/>\n<a href=\"https:\/\/stackoverflow.com\/questions\/47439781\/mongodb-replica-set-member-state-is-other\">https:\/\/stackoverflow.com\/questions\/47439781\/mongodb-replica-set-member-state-is-other<\/a><br \/>\n<a href=\"https:\/\/docs.mongodb.com\/v3.6\/tutorial\/remove-replica-set-member\/\">https:\/\/docs.mongodb.com\/v3.6\/tutorial\/remove-replica-set-member\/<\/a><br \/>\n<a href=\"https:\/\/docs.mongodb.com\/manual\/reference\/replica-states\/\">https:\/\/docs.mongodb.com\/manual\/reference\/replica-states\/<\/a><\/p>\n<h3>db.isMaster(): Does not have a valid replica set config<\/h3>\n<pre class=\"line-numbers\"><code class=\"language-js\">rs0:OTHER&gt; db.isMaster()\n{\n    \"hosts\" : [\n        \"mongodb-rs0-0.mongodb-rs0.default.svc.cluster.local:27017\",\n        \"mongodb-rs0-1.mongodb-rs0.default.svc.cluster.local:27017\",\n        \"mongodb-rs0-2.mongodb-rs0.default.svc.cluster.local27017\"\n    ],\n    \"setName\" : \"rs0\",\n    \"ismaster\" : false,\n    \"secondary\" : false,\n    \"info\" : \"Does not have a valid replica set config\",\n    \"isreplicaset\" : true,\n    \"maxBsonObjectSize\" : 16777216,\n    \"maxMessageSizeBytes\" : 48000000,\n    \"maxWriteBatchSize\" : 100000,\n    \"localTime\" : ISODate(\"2018-07-10T14:34:48.640Z\"),\n    \"logicalSessionTimeoutMinutes\" : 30,\n    \"minWireVersion\" : 0,\n    \"maxWireVersion\" : 6,\n    \"readOnly\" : false,\n    \"ok\" : 1,\n    \"operationTime\" : Timestamp(1531232610, 1),\n    \"$clusterTime\" : {\n        \"clusterTime\" : Timestamp(1531232610, 1),\n        \"signature\" : {\n            \"hash\" : BinData(0,\"AAAAAAAAAAAAAAAAAAAAAAAAAAA=\"),\n            \"keyId\" : NumberLong(0)\n        }\n    }\n}<\/code><\/pre>\n<p>You could just re-configure the replica set and only keep reachable members.<\/p>\n<pre class=\"line-numbers\"><code class=\"language-js\">rs0:OTHER&gt; oldConf = rs.conf()\nrs0:OTHER&gt; oldConf.members = [oldConf.members[0]]\nrs0:OTHER&gt; rs.reconfig(oldConf, {force: true})\nrs0:PRIMARY&gt; rs.add(\"mongodb-rs0-1.mongodb-rs0.default.svc.cluster.local:27017\")\nrs0:PRIMARY&gt; rs.add(\"mongodb-rs0-2.mongodb-rs0.default.svc.cluster.local:27017\")<\/code><\/pre>\n<p>ref:<br \/>\n<a href=\"https:\/\/docs.mongodb.com\/v3.6\/tutorial\/reconfigure-replica-set-with-unavailable-members\/\">https:\/\/docs.mongodb.com\/v3.6\/tutorial\/reconfigure-replica-set-with-unavailable-members\/<\/a><\/p>\n<h2>Change Replica Set Name<\/h2>\n<ol>\n<li>Stop <code>mongod<\/code><\/li>\n<li>Start <code>mongod --bind_ip_all --port 27017 --dbpath \/data\/db<\/code> without <code>--replSet<\/code><\/li>\n<li>Remove the old Replica Set name<\/li>\n<\/ol>\n<pre class=\"line-numbers\"><code class=\"language-js\">use admin\ndb.getCollection('system.version').remove({_id: 'shardIdentity'})\n\nuse local\ndb.getCollection('system.replset').remove({_id: 'rs0'})<\/code><\/pre>\n<ol start=\"4\">\n<li>Start <code>mongod --bind_ip_all --port 27017 --dbpath \/data\/db --shardsvr --replSet sh0<\/code><\/li>\n<\/ol>\n<p>ref:<br \/>\n<a href=\"https:\/\/stackoverflow.com\/questions\/33400607\/how-do-i-rename-a-mongodb-replica-set\">https:\/\/stackoverflow.com\/questions\/33400607\/how-do-i-rename-a-mongodb-replica-set<\/a><\/p>\n<h2>Connect To A Replica Set Cluster<\/h2>\n<p>ref:<br \/>\n<a href=\"https:\/\/api.mongodb.com\/python\/current\/examples\/high_availability.html\">https:\/\/api.mongodb.com\/python\/current\/examples\/high_availability.html<\/a><\/p>\n<h2>Use Connection Pools<\/h2>\n<p>ref:<br \/>\n<a href=\"https:\/\/api.mongodb.com\/python\/current\/faq.html#how-does-connection-pooling-work-in-pymongo\">https:\/\/api.mongodb.com\/python\/current\/faq.html#how-does-connection-pooling-work-in-pymongo<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A replica set is a group of servers that maintain the same data set, with one primary which takes client requests, and multiple secondaries that keep copies of the primary's data. If the primary crashes, secondaries can elect a new primary from amongst themselves.<\/p>\n","protected":false},"author":1,"featured_media":615,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,38],"tags":[119],"class_list":["post-614","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-about-database","category-about-devops","tag-mongodb"],"_links":{"self":[{"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/posts\/614","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/comments?post=614"}],"version-history":[{"count":0,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/posts\/614\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/media\/615"}],"wp:attachment":[{"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/media?parent=614"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/categories?post=614"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/tags?post=614"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}