In Mongo, it’s possible to have a database residing in only one server (but without sharding)?
-
I’d like to use Mongo to store our application logs, but I’d like to have them on a different machine than the rest of the data.
-
In this way if we start to send too many log messages, only the machine with the logging database will be slowed down.
-
Ideally it should be transparent to the application, and which-machine-has-which-database should be managed by the MongoS process.
Nb: We don’t want to shard our entire database yet, since we are ok with the performances at this point, we’d like only to isolate the db with the logging collections.
Yes, you can use 2 mongoD with 2 different servers, one with your actual database and one with the logging database.
The trick is to shard each of the db, but none of the collections.
Then with the movePrimary command you can choose where those unsharded collections will be actually stored.
(see: http://www.mongodb.org/display/DOCS/movePrimary+Command)
In your case, you’ll do:
However notice that when you’ll decide to shard your applicationdb, mongo will automatically start to propagate your data also to the loggingdb_shard