Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6738301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:21:04+00:00 2026-05-26T11:21:04+00:00

Here is the environment: [ Data Center 1 ] [ load balancer, ip: 45.45.45.45]

  • 0

Here is the environment:

[ Data Center 1 ]
   [ load balancer, ip: 45.45.45.45] 
     [ Server 1-A, internal ip: 10.0.0.1, external ip: 200.0.0.1 ]
     [ Server 1-B, internal ip: 10.0.0.2, external ip: 200.0.0.2 ]
     [ Server 1-C, internal ip: 10.0.0.3, external ip: 200.0.0.3 ]

[ Data Center 2 ]
   [ load balancer, ip: 90.90.90.90] 
     [ Server 2-A, internal ip: 10.0.0.1, external ip: 201.0.0.1 ]
     [ Server 2-B, internal ip: 10.0.0.2, external ip: 201.0.0.2 ]
     [ Server 2-C, internal ip: 10.0.0.3, external ip: 201.0.0.3 ]

[ Data Center 3 ]
   [ load balancer, ip: 88.88.88.88] 
     [ Server 3-A, internal ip: 10.0.0.1, external ip: 221.0.0.1 ]
     [ Server 3-B, internal ip: 10.0.0.2, external ip: 221.0.0.2 ]
     [ Server 3-C, internal ip: 10.0.0.3, external ip: 221.0.0.3 ]

What I would like to achieve is that each server install one mongo server, and only Data Center 1 servers (1-A, 1-B, and 1-C) are allowed to be primary. MongoDB servers in Data Center 2 and Data Center 3 are only secondary. Applications can specifically read data from Data Center 2, because those applications may be in the same network as Data Center 2 which has a faster access than connecting to Data Cetner 1. Server is using replicate Sets. There is no sharding.

Here are my questions:

  1. When setting up the replicate set, do I need to use external real IP address to specify the host from Data Center 2 and 3? e.g.

    config = {  _id: 'foo', members: [
                          // data center 1
                          {_id: 0, host: '10.0.0.1:27017'},
                          {_id: 1, host: '10.0.0.2:27017'},
                          {_id: 2, host: '10.0.0.3:27017'},
                          // data center 2
                          {_id: 3, host: '201.0.0.1:27017'},
                          {_id: 4, host: '201.0.0.2:27017'},
                          {_id: 5, host: '201.0.0.3:27017'},
                          // data center 3
                          {_id: 6, host: '221.0.0.1:27017'},
                          {_id: 7, host: '221.0.0.2:27017'},
                          {_id: 8, host: '221.0.0.3:27017'}
                         ]
           }
    
  2. Because the servers in Data Center 2 will behind load balancer and firewall, the IP address may not be able to explode to outside world. Is it possible to use the load balancer IP address? if so, how to do it?

  3. I should use priorty=0 to make servers in Data Center 2 & Data Center 3 never be primary, right?

  4. How other application connect to the MongoDB in Data Center 2 and 3 (for read data only)? Let say, the application (a server side app) is also in Data Center 2 network. What IP address should the application use to connect to the MongoDB in DC2? Should I use the internal IP or external IP? If an application is outside of the DB internal network and would like to connect to MongoDB in DC2 to read data only, should I use the load balancer IP or external IP?

  5. Because I want Servers in DC2 and DC3 able to allow read data, how to set slaveOk? Should I set it in the primary “slaveOK”, or should I set it in each server in DC2 and DC3?

  6. One step further, let say DC1, DC2 and DC3 are all individual replicate set. e.g. DC 1 has its only primary and secondary. DC2 has its own primary and secondary, so far DC3. Is there an easy and real-time way to update DC2 and DC3 when there is change (new record or update) in DC1?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:21:04+00:00Added an answer on May 26, 2026 at 11:21 am
    1. Depends. They need to be hostnames/IPs that your application servers can
      access. If your app servers run on the same DC your mongod process are running they can and should be internal. Any other setup has major security issues.
    2. Technically, yes. Assign each mongod process to a different port. However, I don’t understand why you’d ever want a load balancer to distribute mongo queries. That’s what the driver would do for you and there might even be side effects to letting something other than the driver decide which RS member the query goes to.
    3. Correct.
    4. Internal IPs are the way to go. App servers should initialize their driver with all internal IPs of the local members (read: the members on the same DC)
    5. You don’t set servers to slaveOk. SlaveOk functionality is on the driver end of things. Typically set per connection but most drivers have a global and per query flag for it as well. Obviously your setup will not work without this flag enabled.
    6. No. There is no master-master replication in MongoDB atm.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my environment here I use Java to serialize the result set to XML.
Here is the error: System.TypeInitializationException: The type initializer for 'NHibernate.Cfg.Environment' threw an exception. --->
I am having difficulty deploying RIA services/Silverlight 3 to a staging environment. Here is
Environment: SQL Server 2005 I have a stored proc which receives comma separated value
Background: Here at the office my group uses a common linux environment where we
A little background here: I know what a data warehouse is , more or
Im have a lab-environment in VMware with a WS2008R2-server and a W7-client. Im trying
I have the following Haskell code import Data.Int import System.Environment type Coord = (Int16,
Hey I am quite new to servlet environment. Here I am trying to post
I'm reading data.txt: ////////////////////////////////////////////////// data.txt: ////////////////////////////////////////////////// MissionImpossible3 3 TomCruise MaggieQ JeffChase Here's code: #include

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.