Search code examples
c#mongodbmongodb-.net-driver

MongoDB setup feedback on Windows server


I am currently working on setting up a MongoDB replica set. I have a primary, secondary and arbiter in place. All fine. From here I have 3 tasks to complete.

  1. Set up backups.
  2. Test when a server becomes unavailable the server remains up.
  3. At present I am connecting to it from a .net application, in the connection string I have "safe=true" wondering if I need to change this to be authenticated.

My assessment of the tasks.

  1. I am looking to use mongodump to backup. Is it just the primary should be backed up? And if so, what happens if the primary changes?
  2. Is this as simple as stopping the mongodb windows service on one of the servers and ensure replica set remains up?
  3. What is best practise here for authentication?

Solution

  • 1) Backup can be taken from either primary or secondary, and it is recommended to be taken from some secondary ( or may be a backup secondary server )

    2) Yes. But if you shutdown primary, your application should handle those exceptions ( for write operations because they will fail, till the time new primary is selected )

    3) A general ( username, password ) based authentication you can do. mongo2.4 has new roles for authentication. You can choose to have ssl based authentication. Between the mongodb server communication a keyFile based authentication is there