{"id":376,"date":"2020-11-23T11:53:56","date_gmt":"2020-11-23T11:53:56","guid":{"rendered":"http:\/\/velaninfo.com\/resources\/?post_type=techtips&#038;p=376"},"modified":"2026-04-24T06:34:34","modified_gmt":"2026-04-24T06:34:34","slug":"how-to-copy-mongodb-database-files-to-another-server","status":"publish","type":"techtips","link":"https:\/\/www.velaninfo.com\/rs\/techtips\/how-to-copy-mongodb-database-files-to-another-server\/","title":{"rendered":"How To Copy MongoDB Database Files To Another Server?"},"content":{"rendered":"<p>Copy MongoDB Database Files support the volume of data and it comes in handy in apps that need to scale up as per usage. Web Application developers frequently request to copy the Mongo DB from one server to another. We at Velan, help the developers as part of <a href=\"https:\/\/velanremoteitsupport.com\/managed-server-administration-support-service\">our Server Management Services<\/a>.<\/p>\n<p>This article describes the steps involved in copying Mongo DB files to production servers<\/p>\n<p>Below are the <a href=\"https:\/\/www.velaninfo.com\/rs\/tech-tips\/mongodb\/\"><strong>steps to copy MongoDB database files<\/strong> <\/a>from development to live server. The steps include the creation of backup, copying of the database to the destination server, restoring the database in the destination folder.<\/p>\n<ol>\n<li><strong> Stop MongoDB on the source server<\/strong><\/li>\n<\/ol>\n<p>It is always good to shutdown the database servers to remove any connections before backing up the server. This helps in avoiding data loss.<\/p>\n<p>To stop the MongoDB on the server, we would use the following command \u2013<\/p>\n<p><code># servicemongod stop<\/code><\/p>\n<ol start=\"2\">\n<li><strong> Creation of MongoDB database backup<\/strong><\/li>\n<\/ol>\n<p>To create a database backup, we use the mongodump command<br \/>\n<code># mongodump \u2013host&lt;source host:port&gt; --ssl \u2013username &lt;username&gt; --password &lt;password&gt; --authenticationDatabase admin \u2013db&lt;sourceDBName&gt;<\/code><\/p>\n<p>For eg: To take the dump of the database with name\u00a0<code>exampledb<\/code>, the command will be<br \/>\n<code>mongodump -h myservername:27017 --ssl -u user1 -p 123123 --authenticationDatabase admin -d exampledb<\/code><\/p>\n<ol start=\"3\">\n<li><strong> Copy MongoDB database files to the destination server<\/strong><\/li>\n<\/ol>\n<p>The next step is to copy the backed-up files to the destination server. We can use the scp or rsync commands to copy the files. WE used scp to transfer files as development and production servers were in AWS.<\/p>\n<p>To make scp work, we need to adjust the security group settings from the AWS console. In normal servers, this requires firewall changes to that the connection between the servers can work.<\/p>\n<ol start=\"4\">\n<li><strong>Restore MongoDB database in the destination server<\/strong><\/li>\n<\/ol>\n<p>Once the backup file has been copied to the destination server, mongorestore command is used to restore the database.<br \/>\n<code># mongorestore --host &lt;target host:port&gt; --ssl --username &lt;username&gt; --password &lt;password&gt; --authenticationDatabase admin --db&lt;targetDbName&gt; --collection &lt;collection-name&gt;&lt;dump folder\/file&gt;<\/code><\/p>\n<p>For eg: To restore the\u00a0<code>exampledb<\/code>\u00a0database, we used<br \/>\n<code>mongorestore --host=mynewserver --port=27017 --username=user --authenticationDatabase=admin --dbexampledb \/opt\/backup\/mongodump-exampledb<\/code><\/p>\n<ol start=\"5\">\n<li><strong>Access to users on the Production server<\/strong><\/li>\n<\/ol>\n<p>In certain cases, we may have to give access to users on the new servers.<\/p>\n<p>To open access from your own host IP, you need to open port number 27017 (MongoDB server Port) to all connections or to a specific IP in the firewall.<\/p>\n<p>At <a href=\"https:\/\/www.velaninfo.com\">Velan<\/a>, our <a href=\"https:\/\/velanremoteitsupport.com\/remote-database-managed-services-usa\">database support engineers<\/a> can help you with your database-related issues. For details, please visit <a href=\"https:\/\/velanremoteitsupport.com\/outsourced-managed-it-support-services\"><strong>Outsourced Managed IT Services<\/strong><\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mongo databases support volume of data and it comes handy in apps that need to scale up as per usage. Web Application developers frequently requests to copy the Mongo DB from one server to another. We at Velan, help the developers as part of our Server Management Services.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"tags":[505],"class_list":["post-376","techtips","type-techtips","status-publish","hentry","tag-database","Categories_tech_tip-linux","Categories_tech_tip-mongodb","Categories_tech_tip-server"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v19.5 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to Transfer Database Files Between MongoDB Servers?<\/title>\n<meta name=\"description\" content=\"We at Velan, help the developers as part of our Server Management Services. Copy MongoDB database files from one server to another\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.velaninfo.com\/rs\/techtips\/how-to-copy-mongodb-database-files-to-another-server\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Copy MongoDB Database Files To Another Server?\" \/>\n<meta property=\"og:description\" content=\"We at Velan, help the developers as part of our Server Management Services. Copy MongoDB database files from one server to another\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.velaninfo.com\/rs\/techtips\/how-to-copy-mongodb-database-files-to-another-server\/\" \/>\n<meta property=\"og:site_name\" content=\"Velan\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-24T06:34:34+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.velaninfo.com\\\/rs\\\/techtips\\\/how-to-copy-mongodb-database-files-to-another-server\\\/\",\"url\":\"https:\\\/\\\/www.velaninfo.com\\\/rs\\\/techtips\\\/how-to-copy-mongodb-database-files-to-another-server\\\/\",\"name\":\"How to Transfer Database Files Between MongoDB Servers?\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.velaninfo.com\\\/rs\\\/#website\"},\"datePublished\":\"2020-11-23T11:53:56+00:00\",\"dateModified\":\"2026-04-24T06:34:34+00:00\",\"description\":\"We at Velan, help the developers as part of our Server Management Services. Copy MongoDB database files from one server to another\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.velaninfo.com\\\/rs\\\/techtips\\\/how-to-copy-mongodb-database-files-to-another-server\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.velaninfo.com\\\/rs\\\/techtips\\\/how-to-copy-mongodb-database-files-to-another-server\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.velaninfo.com\\\/rs\\\/techtips\\\/how-to-copy-mongodb-database-files-to-another-server\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.velaninfo.com\\\/rs\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tech Tips\",\"item\":\"https:\\\/\\\/www.velaninfo.com\\\/rs\\\/techtips\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How To Copy MongoDB Database Files To Another Server?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.velaninfo.com\\\/rs\\\/#website\",\"url\":\"https:\\\/\\\/www.velaninfo.com\\\/rs\\\/\",\"name\":\"Velan\",\"description\":\"Velaninfo Services India Pvt Ltd\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.velaninfo.com\\\/rs\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Transfer Database Files Between MongoDB Servers?","description":"We at Velan, help the developers as part of our Server Management Services. Copy MongoDB database files from one server to another","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:\/\/www.velaninfo.com\/rs\/techtips\/how-to-copy-mongodb-database-files-to-another-server\/","og_locale":"en_US","og_type":"article","og_title":"How To Copy MongoDB Database Files To Another Server?","og_description":"We at Velan, help the developers as part of our Server Management Services. Copy MongoDB database files from one server to another","og_url":"https:\/\/www.velaninfo.com\/rs\/techtips\/how-to-copy-mongodb-database-files-to-another-server\/","og_site_name":"Velan","article_modified_time":"2026-04-24T06:34:34+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.velaninfo.com\/rs\/techtips\/how-to-copy-mongodb-database-files-to-another-server\/","url":"https:\/\/www.velaninfo.com\/rs\/techtips\/how-to-copy-mongodb-database-files-to-another-server\/","name":"How to Transfer Database Files Between MongoDB Servers?","isPartOf":{"@id":"https:\/\/www.velaninfo.com\/rs\/#website"},"datePublished":"2020-11-23T11:53:56+00:00","dateModified":"2026-04-24T06:34:34+00:00","description":"We at Velan, help the developers as part of our Server Management Services. Copy MongoDB database files from one server to another","breadcrumb":{"@id":"https:\/\/www.velaninfo.com\/rs\/techtips\/how-to-copy-mongodb-database-files-to-another-server\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.velaninfo.com\/rs\/techtips\/how-to-copy-mongodb-database-files-to-another-server\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.velaninfo.com\/rs\/techtips\/how-to-copy-mongodb-database-files-to-another-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.velaninfo.com\/rs\/"},{"@type":"ListItem","position":2,"name":"Tech Tips","item":"https:\/\/www.velaninfo.com\/rs\/techtips\/"},{"@type":"ListItem","position":3,"name":"How To Copy MongoDB Database Files To Another Server?"}]},{"@type":"WebSite","@id":"https:\/\/www.velaninfo.com\/rs\/#website","url":"https:\/\/www.velaninfo.com\/rs\/","name":"Velan","description":"Velaninfo Services India Pvt Ltd","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.velaninfo.com\/rs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.velaninfo.com\/rs\/wp-json\/wp\/v2\/techtips\/376","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.velaninfo.com\/rs\/wp-json\/wp\/v2\/techtips"}],"about":[{"href":"https:\/\/www.velaninfo.com\/rs\/wp-json\/wp\/v2\/types\/techtips"}],"author":[{"embeddable":true,"href":"https:\/\/www.velaninfo.com\/rs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.velaninfo.com\/rs\/wp-json\/wp\/v2\/comments?post=376"}],"version-history":[{"count":5,"href":"https:\/\/www.velaninfo.com\/rs\/wp-json\/wp\/v2\/techtips\/376\/revisions"}],"predecessor-version":[{"id":3090,"href":"https:\/\/www.velaninfo.com\/rs\/wp-json\/wp\/v2\/techtips\/376\/revisions\/3090"}],"wp:attachment":[{"href":"https:\/\/www.velaninfo.com\/rs\/wp-json\/wp\/v2\/media?parent=376"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.velaninfo.com\/rs\/wp-json\/wp\/v2\/tags?post=376"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}