mongoid5 configuration options

42 views
Skip to first unread message

Kirk Dawson

unread,
Aug 17, 2016, 12:42:57 PM8/17/16
to mongodb-user
I am migrating a cluster from mongoid3 / mongodb 2.6 to mongoid5/ mongodb 3.2

Under mongoid3 there were a very few configuration option eg strong and eventual

Under mongoid5 there are many many new ones. Where can I find documentation on the best options or even what they do. The config notes are too minimal for effective use

specifically the write/read options and the others noted below


 read:
          mode: :primary
          # tag_sets:
          #   - use: web

       
        # Change the default authentication mechanism. Valid options are: :scram,
        # :mongodb_cr, :mongodb_x509, and :plain. (default on 3.0 is :scram, default
        # on 2.4 and 2.6 is :plain)
        auth_mech: :plain

        
        # Force a the driver cluster to behave in a certain manner instead of auto-
        # discovering. Can be one of: :direct, :replica_set, :sharded. Set to :direct
        # when connecting to hidden members of a replica set.
        connect: :replica_set

      
        # The name of the replica set to connect to. Servers provided as seeds that do
        # not belong to this replica set will be ignored.
        replica_set: freereg2

Nishant Bhardwaj

unread,
Aug 23, 2016, 9:16:35 AM8/23/16
to mongodb-user

Hi Kirk,

The reason you are seeing so many new options is that in Mongoid 5, the underlying driver has changed from Moped to the core MongoDB Ruby driver. You can read more about it here: Announcing Ruby Driver 2.0, a Rewrite in the MongoDB blog post.

I will give a brief of the options that you are looking for and documentation links.

  • Read preference - It controls from where your application reads are happening from in a replica set. Clients by default read from primary of a replica set for strong consistency. It is possible to read from secondaries, but your application will have to tolerate eventual consistency. Secondary reads are generally not recommended for sharded collections. For more information, see Read Preferences in the MongoDB manual. I would also recommend reviewing blog post: Can I use more replica nodes to scale?

  • Authentication controls how a client is authenticated to mongodb instance. For more information see Authentication in the MongoDB manual.

  • When connecting to a replica set your application specifies replica set name and seed list of one or more of its members. This provides for automatic failover as long as one of the servers in the seed list can be contacted. For more information see: Replication in the MongoDB manual and MongoDB Ruby Driver API docs.

Lastly can you describe the cluster you are migrating from MongoDB 2.6. Is that a replica set or sharded cluster?

Regards,

Nishant

Reply all
Reply to author
Forward
0 new messages