Skip to content

Instantly share code, notes, and snippets.

@pjkelly
Created April 17, 2014 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pjkelly/10997018 to your computer and use it in GitHub Desktop.
Save pjkelly/10997018 to your computer and use it in GitHub Desktop.
# mongoid 3.x
#
# As discussed in: http://blog.mongolab.com/2014/02/mongodb-driver-tips-tricks-mongoid-3
#
production:
sessions:
default:
# The standard MongoDB connection URI allows for easy replica set
# connection setup.
# Use environment variables or a config file to keep your
# credentials safe.
uri: 'mongodb://username:password@host1:port1,host2:port2/database'
options:
# The default consistency is :eventual, which reads from
# secondaries when possible.
# Strong forces reads to primary.
# We recommend using strong consistency.
consistency: :strong
# max_retries specifies the number of times to attempt an
# operation before giving up.
max_retries: 30
# retry_interval specifies the number of seconds to wait before
# retrying a single operation.
retry_interval: 1
# The default timeout is 5, which is the time in seconds for an
# operation to time out.
# We recommend 15 because it allows for plenty of time in most
# operating environments.
# Mongoid doubles the configured value (known issue) so 15
# results in a timeout of 30s.
# Note that if you have a long-running query (over 30 seconds),
# it will time out.
# See our example for long-running queries in the blog post
# referenced above.
timeout: 15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment