{"id":7776,"date":"2024-03-09T00:39:56","date_gmt":"2024-03-08T19:09:56","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=7776"},"modified":"2024-03-09T00:41:05","modified_gmt":"2024-03-08T19:11:05","slug":"how-to-generate-a-connection-string-for-a-mongodb-replica-set-using-mongodb-compass","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/how-to-generate-a-connection-string-for-a-mongodb-replica-set-using-mongodb-compass\/","title":{"rendered":"How to Generate a Connection String for a MongoDB Replica Set Using MongoDB Compass"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>Introduction:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A replica set in MongoDB is a group of MongoDB processes that maintain the same data set with a designated primary node and one or more secondary nodes. Replica sets provide redundancy and high availability, forming the foundation for robust production deployments<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Prerequisites:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>SSH Login details<\/li>\n\n\n\n<li>Database user credentials<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Implementation<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 1: Open the MongoDB Compass<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/pheonixsolutions.com\/knowledge-base\/wp-content\/uploads\/2023\/04\/image-9-1024x557.png\" alt=\"\" class=\"wp-image-1990\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Step 2: Click on Advanced Connection Options &gt; General &gt;  Host. <br>Provide the IP of the replication set servers and the port number of the MongoDB service in the format <br>IP: port<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.23.11-AM.png\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"768\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.23.11-AM-1024x768.png\" alt=\"\" class=\"wp-image-7777\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.23.11-AM-1024x768.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.23.11-AM-300x225.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.23.11-AM-768x576.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.23.11-AM-400x300.png 400w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.23.11-AM.png 1456w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Step 3: Select the Authentication option and choose the Username\/Password method. <br>Provide the Database access credentials in the respective field<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.27.48-AM.png\"><img decoding=\"async\" width=\"1024\" height=\"826\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.27.48-AM-1024x826.png\" alt=\"\" class=\"wp-image-7779\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.27.48-AM-1024x826.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.27.48-AM-300x242.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.27.48-AM-768x620.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.27.48-AM-372x300.png 372w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.27.48-AM.png 1366w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Step 4: Click on Advanced Connection Options and select the Proxy\/SSH option<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/pheonixsolutions.com\/knowledge-base\/wp-content\/uploads\/2023\/04\/image-10.png\" alt=\"\" class=\"wp-image-1991\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Step 5: Choose the &#8220;SSH with Password&#8221; method if the server is accessible with a password, else select &#8220;SSH with identity file&#8221; if the server is accessible with a key-pair and provide the server access details in the respective fields<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.26.07-AM.png\"><img decoding=\"async\" width=\"1024\" height=\"290\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.26.07-AM-1024x290.png\" alt=\"\" class=\"wp-image-7778\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.26.07-AM-1024x290.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.26.07-AM-300x85.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.26.07-AM-768x217.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.26.07-AM-850x240.png 850w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.26.07-AM.png 1372w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Step 6: [Optional] Navigate to Advanced Connection Options &gt; Advanced, provide the replica set name, Default Authentication Database  name <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.31.13-AM.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"597\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.31.13-AM-1024x597.png\" alt=\"\" class=\"wp-image-7780\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.31.13-AM-1024x597.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.31.13-AM-300x175.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.31.13-AM-768x448.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.31.13-AM-515x300.png 515w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.31.13-AM.png 1434w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Step 7: Finally click on connect to establish the connection and note down the connection string from the Mongo compass URI as shown in the snapshot <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.33.33-AM.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"318\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.33.33-AM-1024x318.png\" alt=\"\" class=\"wp-image-7781\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.33.33-AM-1024x318.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.33.33-AM-300x93.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.33.33-AM-768x239.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.33.33-AM-850x264.png 850w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2024\/03\/Screen-Shot-2024-03-09-at-12.33.33-AM.png 1410w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"> <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: A replica set in MongoDB is a group of MongoDB processes that maintain the same data set with a [&hellip;]<\/p>\n","protected":false},"author":495,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1022],"tags":[743],"class_list":["post-7776","post","type-post","status-publish","format-standard","hentry","category-web-architecture","tag-mongo","psol-cat-web-architecture"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-21q","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7776","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/495"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=7776"}],"version-history":[{"count":0,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7776\/revisions"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=7776"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=7776"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=7776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}