Brian Yeh
Brian Yeh

Reputation: 3267

What's the proper way of running a mongos client for a sharded cluster?

I have a mongodb cluster up and running. I want to setup a client (mongos) to connect to the config servers from ubuntu. Most instructions just say to run this command:

mongos --configdb cfg0.example.net:27019,cfg1.example.net:27019,cfg2.example.net:27019

Is this command running as a service? Will the process still be running when I exit the shell? What happens if the process goes down? What is the proper way of running this client as a service?

Upvotes: 1

Views: 141

Answers (1)

Sammaye
Sammaye

Reputation: 43884

You would use --fork or an init script to make this run as a service post terminal session shut down.

If the process goes down then your application cannot connect to the sharded set. It will be unable to connect at all to your DB. This is (not the only reason) why you should have good redundancy in mongos instances.

I tend to have one mongos per app server personally, however, it is all down to preference. Another option is to have a load balanced set of mongos instances.

Upvotes: 2

Related Questions