{"id":1445,"date":"2018-08-09T11:49:39","date_gmt":"2018-08-09T11:49:39","guid":{"rendered":"http:\/\/dbtut.com\/?p=1445"},"modified":"2018-11-09T21:12:50","modified_gmt":"2018-11-09T21:12:50","slug":"restore-a-sharded-cluster-with-database-dumps-in-mongodb","status":"publish","type":"post","link":"https:\/\/dbtut.com\/index.php\/2018\/08\/09\/restore-a-sharded-cluster-with-database-dumps-in-mongodb\/","title":{"rendered":"Restore a Sharded Cluster with Database Dumps in MongoDB"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>Before restoring database dumps to new servers we need to install MongoDB on each system.<\/p>\n<h3>Step 1: Installation:<\/h3>\n<pre class=\"lang:default decode:true \">vi \/etc\/yum.repos.d\/mongodb-org-3.6.repo<\/pre>\n<p>&nbsp;<\/p>\n<p>inside it:<\/p>\n<pre class=\"lang:default decode:true\">[mongodb-org-3.6]\r\nname=MongoDB Repository\r\nbaseurl=https:\/\/repo.mongodb.org\/yum\/redhat\/$releasever\/mongodb-org\/3.6\/x86_64\/\r\ngpgcheck=1\r\nenabled=1\r\ngpgkey=https:\/\/www.mongodb.org\/static\/pgp\/server-3.6.asc<\/pre>\n<pre class=\"lang:default decode:true \">sudo yum install -y mongodb-org<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Configure SELinux<\/strong><\/p>\n<p>If you are using SELinux, you must configure SELinux to allow MongoDB to start on Red Hat Linux-based systems (Red Hat Enterprise Linux or CentOS Linux).<\/p>\n<p>To configure SELinux, administrators have three options:<\/p>\n<p>-If SELinux is in enforcing mode, enable access to the relevant ports that the MongoDB deployment will use (e.g. 27017). See Default MongoDB Port for more information on MongoDB\u2019s default ports.<\/p>\n<p>For default settings, this can be accomplished by running<\/p>\n<pre class=\"lang:default decode:true \">semanage port -a -t mongod_port_t -p tcp 27017<\/pre>\n<p>&nbsp;<\/p>\n<p>-Disable SELinux by setting the SELINUX setting to disabled in \/etc\/selinux\/config.<\/p>\n<pre class=\"lang:default decode:true \">SELINUX=disabled<\/pre>\n<p>You must reboot the system for the changes to take effect.<\/p>\n<p>&nbsp;<\/p>\n<p>-Set SELinux to permissive mode in \/etc\/selinux\/config by setting the SELINUX setting to permissive.<\/p>\n<pre class=\"lang:default decode:true \">SELINUX=permissive<\/pre>\n<p>You must reboot the system for the changes to take effect.<\/p>\n<p>You can instead use setenforce to change to permissive mode. setenforce does not require a reboot but is not persistent.<\/p>\n<p>Alternatively, you can choose not to install the SELinux packages when you are installing your Linux operating system, or choose to remove the relevant packages. This option is the most invasive and is not recommended.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Start MongoDB<\/strong><\/p>\n<pre class=\"lang:default decode:true \">sudo service mongod start<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Stop MongoDB<\/strong><\/p>\n<pre class=\"lang:default decode:true \">sudo service mongod stop<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Restart MongoDB<\/strong><\/p>\n<pre class=\"lang:default decode:true \">sudo service mongod restart<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Begin using MongoDB<\/strong><\/p>\n<pre class=\"lang:default decode:true \">mongo --host 127.0.0.1:27017<\/pre>\n<p>&nbsp;<\/p>\n<p>After installation is completed the second step is deploying the replica set:<\/p>\n<h3>Step 2: Deploy a new replica set for each shard.<\/h3>\n<p>Replica set deployment<\/p>\n<p>1- Create \/mongodb directory on each shard<\/p>\n<pre class=\"lang:default decode:true\">sudo mkdir \/mongodb<\/pre>\n<p>&nbsp;<\/p>\n<p>2- change owner of the directory to mongo user<\/p>\n<pre class=\"lang:default decode:true \">sudo chown mongo:mongo \/mongodb<\/pre>\n<p>&nbsp;<\/p>\n<p>3- create shard and config directories under the \/mongodb directory.<\/p>\n<p><strong>Note:<\/strong> In this test environment I use 3 servers for 3 shard. And in each server I put the relicas of other shards.<\/p>\n<p>In busy production environments all the replicas can be located in different servers.<\/p>\n<pre class=\"lang:default decode:true \">[mongo@mongotest01 mongodb]$ mkdir shard01a\r\n[mongo@mongotest01 mongodb]$ mkdir shard02a\r\n[mongo@mongotest01 mongodb]$ mkdir shard03a\r\n[mongo@mongotest01 mongodb]$ mkdir cfg01\r\n[mongo@mongotest01 mongodb]$ mkdir logs\r\n\r\n[mongo@mongotest02 mongodb]$ mkdir shard01b\r\n[mongo@mongotest02 mongodb]$ mkdir shard02b\r\n[mongo@mongotest02 mongodb]$ mkdir shard03b\r\n[mongo@mongotest02 mongodb]$ mkdir cfg02\r\n[mongo@mongotest02 mongodb]$ mkdir logs\r\n\r\n[mongo@mongotest03 mongodb]$ mkdir shard01c\r\n[mongo@mongotest03 mongodb]$ mkdir shard02c\r\n[mongo@mongotest03 mongodb]$ mkdir shard03c\r\n[mongo@mongotest03 mongodb]$ mkdir cfg03\r\n[mongo@mongotest03 mongodb]$ mkdir logs<\/pre>\n<p>&nbsp;<\/p>\n<p>4- Under \/mongodb directory start the config servers in each server:<\/p>\n<pre class=\"lang:default decode:true\">mongod --configsvr --dbpath cfg01 --port 26050 --fork --logpath logs\/log.cfg01 --logappend\r\nmongod --configsvr --dbpath cfg02 --port 26050 --fork --logpath logs\/log.cfg02 --logappend\r\nmongod --configsvr --dbpath cfg03 --port 26050 --fork --logpath logs\/log.cfg03 --logappend<\/pre>\n<p>&nbsp;<\/p>\n<p>5- Under \/mongodb server create the shard servers in each server:<\/p>\n<p><strong>Note:<\/strong> If you use one server for two or more shard, config or mongos, you need to give different ports for each process.<br \/>\nIn my test case in one server I create 3 different shards, one config and one mongos so I gave different ports for each of them.<\/p>\n<pre class=\"lang:default decode:true \">mongod --shardsvr --replSet shard01 --dbpath shard01a --logpath logs\/log.shard01a --port 27000 --fork --logappend\r\nmongod --shardsvr --replSet shard02 --dbpath shard02a --logpath logs\/log.shard02a --port 27100 --fork --logappend\r\nmongod --shardsvr --replSet shard03 --dbpath shard03a --logpath logs\/log.shard03a --port 27200 --fork --logappend\r\n\r\nmongod --shardsvr --replSet shard01 --dbpath shard01b --logpath logs\/log.shard01b --port 27000 --fork --logappend\r\nmongod --shardsvr --replSet shard02 --dbpath shard02b --logpath logs\/log.shard02b --port 27100 --fork --logappend\r\nmongod --shardsvr --replSet shard03 --dbpath shard03b --logpath logs\/log.shard03b --port 27200 --fork --logappend\r\n\r\nmongod --shardsvr --replSet shard01 --dbpath shard01c --logpath logs\/log.shard01c --port 27000 --fork --logappend\r\nmongod --shardsvr --replSet shard02 --dbpath shard02c --logpath logs\/log.shard02c --port 27100 --fork --logappend\r\nmongod --shardsvr --replSet shard03 --dbpath shard03c --logpath logs\/log.shard03c --port 27200 --fork --logappend<\/pre>\n<p>&nbsp;<\/p>\n<p>6- Initiate the replica sets<\/p>\n<p>Log on to each shard using appropriate port and run the rs.initiate command:<\/p>\n<pre class=\"lang:default decode:true \">mongo --port 27000\r\nrs.initiate({_id:\"shard01\", members: [{\"_id\":0, \"host\":\"172.18.239.201:27000\"},{\"_id\":1, \"host\":\"172.18.239.202:27000\"},{\"_id\":2, \"host\":\"172.18.239.203:27000\"}]})\r\n\r\nmongo --port 27100\r\nrs.initiate({_id:\"shard02\", members: [{\"_id\":0, \"host\":\"172.18.239.201:27100\"},{\"_id\":1, \"host\":\"172.18.239.202:27100\"},{\"_id\":2, \"host\":\"172.18.239.203:27100\"}]})\r\n\r\nmongo --port 27200\r\nrs.initiate({_id:\"shard03\", members: [{\"_id\":0, \"host\":\"172.18.239.201:27200\"},{\"_id\":1, \"host\":\"172.18.239.202:27200\"},{\"_id\":2, \"host\":\"172.18.239.203:27200\"}]})<\/pre>\n<p>&nbsp;<\/p>\n<p>7- Start the config servers in different servers:<\/p>\n<pre class=\"lang:default decode:true \">mongod --configsvr --replSet cfg --dbpath \/mongodb\/cfg01\/ --bind_ip localhost,172.18.239.201 --port 26050 --fork --logpath \/mongodb\/logs\/log.cfg01 --logappend\r\nmongod --configsvr --replSet cfg --dbpath \/mongodb\/cfg02\/ --bind_ip localhost,172.18.239.202 --port 26050 --fork --logpath \/mongodb\/logs\/log.cfg02 --logappend\r\nmongod --configsvr --replSet cfg --dbpath \/mongodb\/cfg01\/ --bind_ip localhost,172.18.239.201 --port 26050 --fork --logpath \/mongodb\/logs\/log.cfg03 --logappend\r\n\r\nmongo --port 26050\r\nrs.initiate({_id:\"cfg\", configsvr: true, members: [{\"_id\":0, \"host\":\"172.18.239.201:26050\"},{\"_id\":1, \"host\":\"172.18.239.202:26050\"},{\"_id\":2, \"host\":\"172.18.239.203:26050\"}]})<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Step 3: Start the mongoses in different servers:<\/strong><\/p>\n<pre class=\"lang:default decode:true \">mongos --configdb cfg\/172.18.239.201:26050,172.18.239.202:26050,172.18.239.203:26050 --bind_ip localhost,172.18.239.201 --fork --logappend --logpath \/db\/logs\/log.mongos\r\nmongos --configdb cfg\/172.18.239.201:26050,172.18.239.202:26050,172.18.239.203:26050 --bind_ip localhost,172.18.239.202 --fork --logappend --logpath \/db\/logs\/log.mongos\r\nmongos --configdb cfg\/172.18.239.201:26050,172.18.239.202:26050,172.18.239.203:26050 --bind_ip localhost,172.18.239.203 --fork --logappend --logpath \/db\/logs\/log.mongos<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Step 4: Adding shards:<\/strong><\/p>\n<p>connect to mongos:<\/p>\n<pre class=\"lang:default decode:true \">sh.addShard(\"shard01\/172.18.239.201:27000\")\r\n\r\nsh.addShard(\"shard02\/172.18.239.201:27100\")\r\n\r\nsh.addShard(\"shard03\/172.18.239.201:27200\")<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Step 5: Shut down the mongos instances.<\/strong><\/p>\n<pre class=\"lang:default decode:true \">mongos\r\nuse admin\r\ndb.shutdownServer()<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Step 6: Restore the shard data:<\/strong><\/p>\n<p>Restore each shard dump to the appropriate primary replica of each shard:<\/p>\n<pre class=\"lang:default decode:true \">mongorestore --drop --oplogReplay \/backup\/FULL\/05-10-18\/shard03 --port 27200\r\n\r\nmongorestore --drop --oplogReplay \/backup\/FULL\/05-10-18\/shard02 --port 27100\r\n\r\nmongorestore --drop --oplogReplay \/backup\/FULL\/05-10-18\/shard01 --port 27000<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Step 7: Restore the config server data.<\/strong><\/p>\n<pre class=\"lang:default decode:true \">mongorestore --drop --oplogReplay \/backup\/FULL\/05-10-18\/configReplset --port 26050<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Step 8: Start mongos instances in each server.<\/strong><\/p>\n<pre class=\"lang:default decode:true \">mongos --configdb cfg\/172.18.239.201:26050,172.18.239.202:26050,172.18.239.203:26050 --bind_ip localhost,172.18.239.201 --fork --logappend --logpath \/db\/logs\/log.mongos\r\nmongos --configdb cfg\/172.18.239.201:26050,172.18.239.202:26050,172.18.239.203:26050 --bind_ip localhost,172.18.239.202 --fork --logappend --logpath \/db\/logs\/log.mongos\r\nmongos --configdb cfg\/172.18.239.201:26050,172.18.239.202:26050,172.18.239.203:26050 --bind_ip localhost,172.18.239.203 --fork --logappend --logpath \/db\/logs\/log.mongos<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Step 9: If shard hostnames have changed, update the config database.<\/strong><\/p>\n<p>connect to the primary config:<\/p>\n<pre class=\"lang:default decode:true \">cfg:PRIMARY&gt; db.shards.find()\r\n{ \"_id\" : \"shard01\", \"host\" : \"shard01\/mshard01-ra.saglik.lokal:27017,mshard01-rb.saglik.lokal:27017,mshard01-rc.saglik.lokal:27017\" }\r\n{ \"_id\" : \"shard02\", \"host\" : \"shard02\/mshard02-ra.saglik.lokal:27017,mshard02-rb.saglik.lokal:27017,mshard02-rc.saglik.lokal:27017\" }\r\n{ \"_id\" : \"shard03\", \"host\" : \"shard03\/mshard03-ra.saglik.lokal:27017,mshard03-rb.saglik.lokal:27017,mshard03-rc.saglik.lokal:27017\" }\r\n\r\ndb.shards.update( { _id : \"shard01\" } , { $set : {\"host\" : \"shard01\/172.18.239.201:27000,172.18.239.202:27000,172.18.239.203:27000\"} } )\r\ndb.shards.update( { _id : \"shard02\" } , { $set : {\"host\" : \"shard02\/172.18.239.201:27100,172.18.239.202:27100,172.18.239.203:27100\"} } )\r\ndb.shards.update( { _id : \"shard03\" } , { $set : {\"host\" : \"shard03\/172.18.239.201:27200,172.18.239.202:27200,172.18.239.203:27200\"} } )<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Step 10 : Restart all the shard mongod instances.<\/strong><\/p>\n<p><strong>Step 11: Restart the other mongos instances.<\/strong><\/p>\n<p><strong>Step 12: Verify that the cluster is operational.<\/strong><\/p>\n<pre class=\"lang:default decode:true \">db.printShardingStatus()\r\nshow collections<\/pre>\n\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_1445\" class=\"pvc_stats all  \" data-element-id=\"1445\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/dbtut.com\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Before restoring database dumps to new servers we need to install MongoDB on each system. Step 1: Installation: vi \/etc\/yum.repos.d\/mongodb-org-3.6.repo &nbsp; inside it: [mongodb-org-3.6] name=MongoDB Repository baseurl=https:\/\/repo.mongodb.org\/yum\/redhat\/$releasever\/mongodb-org\/3.6\/x86_64\/ gpgcheck=1 enabled=1 gpgkey=https:\/\/www.mongodb.org\/static\/pgp\/server-3.6.asc sudo yum install -y mongodb-org &nbsp; Configure SELinux If you are using SELinux, you must configure SELinux to allow MongoDB to start on Red &hellip;<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_1445\" class=\"pvc_stats all  \" data-element-id=\"1445\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/dbtut.com\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":13,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[1306],"tags":[20,1371,1273,1374],"class_list":["post-1445","post","type-post","status-publish","format-standard","","category-mongodb","tag-backup","tag-mongodb","tag-restore","tag-sharded-clusters"],"aioseo_notices":[],"a3_pvc":{"activated":true,"total_views":335,"today_views":0},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Restore a Sharded Cluster with Database Dumps in MongoDB - Database Tutorials<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/dbtut.com\/index.php\/2018\/08\/09\/restore-a-sharded-cluster-with-database-dumps-in-mongodb\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Restore a Sharded Cluster with Database Dumps in MongoDB - Database Tutorials\" \/>\n<meta property=\"og:description\" content=\"&nbsp; Before restoring database dumps to new servers we need to install MongoDB on each system. Step 1: Installation: vi \/etc\/yum.repos.d\/mongodb-org-3.6.repo &nbsp; inside it: [mongodb-org-3.6] name=MongoDB Repository baseurl=https:\/\/repo.mongodb.org\/yum\/redhat\/$releasever\/mongodb-org\/3.6\/x86_64\/ gpgcheck=1 enabled=1 gpgkey=https:\/\/www.mongodb.org\/static\/pgp\/server-3.6.asc sudo yum install -y mongodb-org &nbsp; Configure SELinux If you are using SELinux, you must configure SELinux to allow MongoDB to start on Red &hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dbtut.com\/index.php\/2018\/08\/09\/restore-a-sharded-cluster-with-database-dumps-in-mongodb\/\" \/>\n<meta property=\"og:site_name\" content=\"Database Tutorials\" \/>\n<meta property=\"article:published_time\" content=\"2018-08-09T11:49:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-11-09T21:12:50+00:00\" \/>\n<meta name=\"author\" content=\"Selcen Sahin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Selcen Sahin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/08\/09\/restore-a-sharded-cluster-with-database-dumps-in-mongodb\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/08\/09\/restore-a-sharded-cluster-with-database-dumps-in-mongodb\/\"},\"author\":{\"name\":\"Selcen Sahin\",\"@id\":\"https:\/\/dbtut.com\/#\/schema\/person\/87438a648f4fcee5ebc050fa2d1b68ca\"},\"headline\":\"Restore a Sharded Cluster with Database Dumps in MongoDB\",\"datePublished\":\"2018-08-09T11:49:39+00:00\",\"dateModified\":\"2018-11-09T21:12:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/08\/09\/restore-a-sharded-cluster-with-database-dumps-in-mongodb\/\"},\"wordCount\":511,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/dbtut.com\/#organization\"},\"keywords\":[\"Backup\",\"MongoDB\",\"Restore\",\"sharded clusters\"],\"articleSection\":[\"MongoDB\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/dbtut.com\/index.php\/2018\/08\/09\/restore-a-sharded-cluster-with-database-dumps-in-mongodb\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/08\/09\/restore-a-sharded-cluster-with-database-dumps-in-mongodb\/\",\"url\":\"https:\/\/dbtut.com\/index.php\/2018\/08\/09\/restore-a-sharded-cluster-with-database-dumps-in-mongodb\/\",\"name\":\"Restore a Sharded Cluster with Database Dumps in MongoDB - Database Tutorials\",\"isPartOf\":{\"@id\":\"https:\/\/dbtut.com\/#website\"},\"datePublished\":\"2018-08-09T11:49:39+00:00\",\"dateModified\":\"2018-11-09T21:12:50+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/08\/09\/restore-a-sharded-cluster-with-database-dumps-in-mongodb\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dbtut.com\/index.php\/2018\/08\/09\/restore-a-sharded-cluster-with-database-dumps-in-mongodb\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/08\/09\/restore-a-sharded-cluster-with-database-dumps-in-mongodb\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/dbtut.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Restore a Sharded Cluster with Database Dumps in MongoDB\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/dbtut.com\/#website\",\"url\":\"https:\/\/dbtut.com\/\",\"name\":\"Database Tutorials\",\"description\":\"MSSQL, Oracle, PostgreSQL, MySQL, MariaDB, DB2, Sybase, Teradata, Big Data, NOSQL, MongoDB, Couchbase, Cassandra, Windows, Linux\",\"publisher\":{\"@id\":\"https:\/\/dbtut.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/dbtut.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/dbtut.com\/#organization\",\"name\":\"dbtut\",\"url\":\"https:\/\/dbtut.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/dbtut.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/dbtut.com\/wp-content\/uploads\/2021\/02\/dbtutlogo.jpg\",\"contentUrl\":\"https:\/\/dbtut.com\/wp-content\/uploads\/2021\/02\/dbtutlogo.jpg\",\"width\":223,\"height\":36,\"caption\":\"dbtut\"},\"image\":{\"@id\":\"https:\/\/dbtut.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/dbtut.com\/#\/schema\/person\/87438a648f4fcee5ebc050fa2d1b68ca\",\"name\":\"Selcen Sahin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/dbtut.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/403f3e1ed22269aba4b27e275764c81032219d846808ea020c5512c9ffe300f6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/403f3e1ed22269aba4b27e275764c81032219d846808ea020c5512c9ffe300f6?s=96&d=mm&r=g\",\"caption\":\"Selcen Sahin\"},\"url\":\"https:\/\/dbtut.com\/index.php\/author\/selcensahin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Restore a Sharded Cluster with Database Dumps in MongoDB - Database Tutorials","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/dbtut.com\/index.php\/2018\/08\/09\/restore-a-sharded-cluster-with-database-dumps-in-mongodb\/","og_locale":"en_US","og_type":"article","og_title":"Restore a Sharded Cluster with Database Dumps in MongoDB - Database Tutorials","og_description":"&nbsp; Before restoring database dumps to new servers we need to install MongoDB on each system. Step 1: Installation: vi \/etc\/yum.repos.d\/mongodb-org-3.6.repo &nbsp; inside it: [mongodb-org-3.6] name=MongoDB Repository baseurl=https:\/\/repo.mongodb.org\/yum\/redhat\/$releasever\/mongodb-org\/3.6\/x86_64\/ gpgcheck=1 enabled=1 gpgkey=https:\/\/www.mongodb.org\/static\/pgp\/server-3.6.asc sudo yum install -y mongodb-org &nbsp; Configure SELinux If you are using SELinux, you must configure SELinux to allow MongoDB to start on Red &hellip;","og_url":"https:\/\/dbtut.com\/index.php\/2018\/08\/09\/restore-a-sharded-cluster-with-database-dumps-in-mongodb\/","og_site_name":"Database Tutorials","article_published_time":"2018-08-09T11:49:39+00:00","article_modified_time":"2018-11-09T21:12:50+00:00","author":"Selcen Sahin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Selcen Sahin","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/dbtut.com\/index.php\/2018\/08\/09\/restore-a-sharded-cluster-with-database-dumps-in-mongodb\/#article","isPartOf":{"@id":"https:\/\/dbtut.com\/index.php\/2018\/08\/09\/restore-a-sharded-cluster-with-database-dumps-in-mongodb\/"},"author":{"name":"Selcen Sahin","@id":"https:\/\/dbtut.com\/#\/schema\/person\/87438a648f4fcee5ebc050fa2d1b68ca"},"headline":"Restore a Sharded Cluster with Database Dumps in MongoDB","datePublished":"2018-08-09T11:49:39+00:00","dateModified":"2018-11-09T21:12:50+00:00","mainEntityOfPage":{"@id":"https:\/\/dbtut.com\/index.php\/2018\/08\/09\/restore-a-sharded-cluster-with-database-dumps-in-mongodb\/"},"wordCount":511,"commentCount":0,"publisher":{"@id":"https:\/\/dbtut.com\/#organization"},"keywords":["Backup","MongoDB","Restore","sharded clusters"],"articleSection":["MongoDB"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/dbtut.com\/index.php\/2018\/08\/09\/restore-a-sharded-cluster-with-database-dumps-in-mongodb\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/dbtut.com\/index.php\/2018\/08\/09\/restore-a-sharded-cluster-with-database-dumps-in-mongodb\/","url":"https:\/\/dbtut.com\/index.php\/2018\/08\/09\/restore-a-sharded-cluster-with-database-dumps-in-mongodb\/","name":"Restore a Sharded Cluster with Database Dumps in MongoDB - Database Tutorials","isPartOf":{"@id":"https:\/\/dbtut.com\/#website"},"datePublished":"2018-08-09T11:49:39+00:00","dateModified":"2018-11-09T21:12:50+00:00","breadcrumb":{"@id":"https:\/\/dbtut.com\/index.php\/2018\/08\/09\/restore-a-sharded-cluster-with-database-dumps-in-mongodb\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dbtut.com\/index.php\/2018\/08\/09\/restore-a-sharded-cluster-with-database-dumps-in-mongodb\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/dbtut.com\/index.php\/2018\/08\/09\/restore-a-sharded-cluster-with-database-dumps-in-mongodb\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/dbtut.com\/"},{"@type":"ListItem","position":2,"name":"Restore a Sharded Cluster with Database Dumps in MongoDB"}]},{"@type":"WebSite","@id":"https:\/\/dbtut.com\/#website","url":"https:\/\/dbtut.com\/","name":"Database Tutorials","description":"MSSQL, Oracle, PostgreSQL, MySQL, MariaDB, DB2, Sybase, Teradata, Big Data, NOSQL, MongoDB, Couchbase, Cassandra, Windows, Linux","publisher":{"@id":"https:\/\/dbtut.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/dbtut.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/dbtut.com\/#organization","name":"dbtut","url":"https:\/\/dbtut.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/dbtut.com\/#\/schema\/logo\/image\/","url":"https:\/\/dbtut.com\/wp-content\/uploads\/2021\/02\/dbtutlogo.jpg","contentUrl":"https:\/\/dbtut.com\/wp-content\/uploads\/2021\/02\/dbtutlogo.jpg","width":223,"height":36,"caption":"dbtut"},"image":{"@id":"https:\/\/dbtut.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/dbtut.com\/#\/schema\/person\/87438a648f4fcee5ebc050fa2d1b68ca","name":"Selcen Sahin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/dbtut.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/403f3e1ed22269aba4b27e275764c81032219d846808ea020c5512c9ffe300f6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/403f3e1ed22269aba4b27e275764c81032219d846808ea020c5512c9ffe300f6?s=96&d=mm&r=g","caption":"Selcen Sahin"},"url":"https:\/\/dbtut.com\/index.php\/author\/selcensahin\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/posts\/1445","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/comments?post=1445"}],"version-history":[{"count":0,"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/posts\/1445\/revisions"}],"wp:attachment":[{"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/media?parent=1445"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/categories?post=1445"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/tags?post=1445"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}