Optimizing MongoDB Read Preference

    To optimize performance of a multi-node MongoDB environment, NetBrain suggests configuring the MongoDB readPreference setting to secondaryPreferred.

     

    This setting will ensure that the NetBrain services use the primary/master node for write operations and use the secondary/slave node for read operations.

     

    Solution

    1. Configure secondaryPreferred on NetBrain Web Server by modifying the NBConfig.json file.

    "mongodb_servers":{
          "servers_URL":["192.168.31.248:27017","192.168.31.171:27017","192.168.32.201:27017"],
          "user":"encrypted:Xa0wvkHsHoz9b4DgMM83F9wdEFw5zcSnWRgJ6QMvv7k=",
          "password":"encrypted:mai7idnq6tlTWnfZWqlyWXWyk/mSFRHPqMB4oDQ5xEc=",
          "replicaSet":"rs",
          "extraOptions":"authMechanism=SCRAM-SHA-256&readPreference=secondaryPreferred&w=majority&wtimeoutMS=30000",
          "ssl":false,
          "cert_verification":"none"
       },

     

     

    Integrated Edition 8.0Integrated Edition 8.01Integrated Edition 8.02Integrated Edition 8.03

    « Previous ArticleNext Article »


    0.0 (0)


    Comments

    No records to display

    About the Author
    Subscription
    Follow Knowledge Base posts
    Please enter your email address to subscribe:

    Email:
    Subscribe
    Knowledge Base Categories:
    Tags