Created
July 16, 2015 13:02
-
-
Save ivaravko/351405f96974422e6c7e to your computer and use it in GitHub Desktop.
mongo replica set connection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
connection = Mongo::MongoReplicaSetClient.new( | |
["replica.host.ru:27022", "master.host.ru:27022"], read: :secondary_preferred, logger: Rails.logger | |
) | |
db = connection.db('admin') | |
db.authenticate('reader', 'somepassword') | |
$MONGO = connection.db('test') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment