Starting and stopping mongod remotely

1,618 views
Skip to first unread message

Om

unread,
Mar 2, 2012, 8:12:01 PM3/2/12
to mongodb-user
Can I stop and start mongod server remotely?

I logged in remotely and tried executing

> use admin
> db.shutdownServer()

But is says

shutdownServer failed: unauthorized: this command must run from
localhost when running db without auth

How can I setup the auth so as to shutdown and restart the server
remotely?

Scott Hernandez

unread,
Mar 2, 2012, 8:31:55 PM3/2/12
to mongod...@googlegroups.com
You cannot restart it this way; you should use the host operating
system commands to start/stop the daemon/service.

> --
> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
>

Om

unread,
Mar 2, 2012, 8:37:13 PM3/2/12
to mongod...@googlegroups.com
But I need to stop and start it remotely. Is that possible? I want to replace a dead config servers. According to instructions on http://www.mongodb.org/display/DOCS/Changing+Config+Servers, I need to stop just one out of the remaining 2 config servers. Why is that? Why doesn't it say that we need to stop both so that config data doesn't change while we bring up a new config server. Does config data become read-only if one of the config servers goes down?

And for this purpose, I also want to know how to stop and start a config server remotely.


On Friday, 2 March 2012 17:31:55 UTC-8, Scott Hernandez wrote:
You cannot restart it this way; you should use the host operating
system commands to start/stop the daemon/service.

On Fri, Mar 2, 2012 at 8:12 PM, Om <omkar...@gmail.com> wrote:
> Can I stop and start mongod server remotely?
>
> I logged in remotely and tried executing
>
>> use admin
>> db.shutdownServer()
>
> But is says
>
> shutdownServer failed: unauthorized: this command must run from
> localhost when running db without auth
>
> How can I setup the auth so as to shutdown and restart the server
> remotely?
>
> --
> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.

> To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.

Scott Hernandez

unread,
Mar 2, 2012, 8:58:37 PM3/2/12
to mongod...@googlegroups.com
If you stop it what are you going to call to start it? You need to use
the operating system services to start the process via ssh or some
other remote service.

On Fri, Mar 2, 2012 at 8:37 PM, Om <omkar...@gmail.com> wrote:
> But I need to stop and start it remotely. Is that possible? I want to
> replace a dead config servers. According to instructions
> on http://www.mongodb.org/display/DOCS/Changing+Config+Servers, I need to
> stop just one out of the remaining 2 config servers. Why is that? Why
> doesn't it say that we need to stop both so that config data doesn't change
> while we bring up a new config server. Does config data become read-only if
> one of the config servers goes down?

Yes, unless all config servers are up the config metadata is read-only.

>
> And for this purpose, I also want to know how to stop and start a config
> server remotely.
>
>
> On Friday, 2 March 2012 17:31:55 UTC-8, Scott Hernandez wrote:
>>
>> You cannot restart it this way; you should use the host operating
>> system commands to start/stop the daemon/service.
>>
>> On Fri, Mar 2, 2012 at 8:12 PM, Om <omkar...@gmail.com> wrote:
>> > Can I stop and start mongod server remotely?
>> >
>> > I logged in remotely and tried executing
>> >
>> >> use admin
>> >> db.shutdownServer()
>> >
>> > But is says
>> >
>> > shutdownServer failed: unauthorized: this command must run from
>> > localhost when running db without auth
>> >
>> > How can I setup the auth so as to shutdown and restart the server
>> > remotely?
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "mongodb-user" group.
>> > To post to this group, send email to mongod...@googlegroups.com.
>> > To unsubscribe from this group, send email to

>> > mongodb-user...@googlegroups.com.


>> > For more options, visit this group at
>> > http://groups.google.com/group/mongodb-user?hl=en.
>> >
>

> --
> You received this message because you are subscribed to the Google Groups
> "mongodb-user" group.

> To view this discussion on the web visit
> https://groups.google.com/d/msg/mongodb-user/-/5j7b2xfPdSkJ.


>
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to

> mongodb-user...@googlegroups.com.

Om

unread,
Mar 2, 2012, 9:02:19 PM3/2/12
to mongod...@googlegroups.com
Why do I need to stop just one config server (as it says on the page)? Why doesn't it mandate stopping both? Cause if only one is stopped, it is still possible that config database might get updated by the one config server that is running. Am I missing something? On the other hand, can I use mongodump which can go a same dump on a running mongo server?

>> > mongodb-user+unsubscribe@googlegroups.com.


>> > For more options, visit this group at
>> > http://groups.google.com/group/mongodb-user?hl=en.
>> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "mongodb-user" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/mongodb-user/-/5j7b2xfPdSkJ.
>
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to

> mongodb-user+unsubscribe@googlegroups.com.

Eliot Horowitz

unread,
Mar 3, 2012, 8:37:07 AM3/3/12
to mongod...@googlegroups.com
If any config server is down the meta data goes read only.
So the others can't be updated if one is down.

>> >> > mongodb-user...@googlegroups.com.


>> >> > For more options, visit this group at
>> >> > http://groups.google.com/group/mongodb-user?hl=en.
>> >> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "mongodb-user" group.
>> > To view this discussion on the web visit
>> > https://groups.google.com/d/msg/mongodb-user/-/5j7b2xfPdSkJ.
>> >
>> > To post to this group, send email to mongod...@googlegroups.com.
>> > To unsubscribe from this group, send email to

>> > mongodb-user...@googlegroups.com.


>> > For more options, visit this group at
>> > http://groups.google.com/group/mongodb-user?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "mongodb-user" group.
> To view this discussion on the web visit

> https://groups.google.com/d/msg/mongodb-user/-/zu2AW9HWXnQJ.


>
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to

> mongodb-user...@googlegroups.com.

Om

unread,
Mar 3, 2012, 1:41:15 PM3/3/12
to mongod...@googlegroups.com
Elliot,

 does it mean that there is no need to stop them while I do a dump of config data using mongodump?


>> >> > For more options, visit this group at
>> >> > http://groups.google.com/group/mongodb-user?hl=en.
>> >> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "mongodb-user" group.
>> > To view this discussion on the web visit
>> > https://groups.google.com/d/msg/mongodb-user/-/5j7b2xfPdSkJ.
>> >
>> > To post to this group, send email to mongod...@googlegroups.com.
>> > To unsubscribe from this group, send email to


>> > For more options, visit this group at
>> > http://groups.google.com/group/mongodb-user?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "mongodb-user" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/mongodb-user/-/zu2AW9HWXnQJ.
>
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to

Eliot Horowitz

unread,
Mar 4, 2012, 8:28:58 PM3/4/12
to mongod...@googlegroups.com
A mongodump isn't safe in this case unless you are running with an
--master and use mongodump --oplog

>> >> >> > mongodb-user...@googlegroups.com.


>> >> >> > For more options, visit this group at
>> >> >> > http://groups.google.com/group/mongodb-user?hl=en.
>> >> >> >
>> >> >
>> >> > --
>> >> > You received this message because you are subscribed to the Google
>> >> > Groups
>> >> > "mongodb-user" group.
>> >> > To view this discussion on the web visit
>> >> > https://groups.google.com/d/msg/mongodb-user/-/5j7b2xfPdSkJ.
>> >> >
>> >> > To post to this group, send email to mongod...@googlegroups.com.
>> >> > To unsubscribe from this group, send email to

>> >> > mongodb-user...@googlegroups.com.


>> >> > For more options, visit this group at
>> >> > http://groups.google.com/group/mongodb-user?hl=en.
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "mongodb-user" group.
>> > To view this discussion on the web visit
>> > https://groups.google.com/d/msg/mongodb-user/-/zu2AW9HWXnQJ.
>> >
>> > To post to this group, send email to mongod...@googlegroups.com.
>> > To unsubscribe from this group, send email to

>> > mongodb-user...@googlegroups.com.


>> > For more options, visit this group at
>> > http://groups.google.com/group/mongodb-user?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "mongodb-user" group.
> To view this discussion on the web visit

> https://groups.google.com/d/msg/mongodb-user/-/4CnYArCOWBwJ.


>
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to

> mongodb-user...@googlegroups.com.

Om

unread,
Mar 4, 2012, 10:42:50 PM3/4/12
to mongod...@googlegroups.com
Elliot,
 
  I was hoping that I don't have to start-stop the config server since I need to execute this process remotely and in a script. So I was hoping that I can do a mongodump and then restore that data to start a new config server. If the meta-data becomes read-only when a config server is down, why do I need to stop that server? That server won't be able to write to the config data anyway ... right?


>> >> >> > For more options, visit this group at
>> >> >> > http://groups.google.com/group/mongodb-user?hl=en.
>> >> >> >
>> >> >
>> >> > --
>> >> > You received this message because you are subscribed to the Google
>> >> > Groups
>> >> > "mongodb-user" group.
>> >> > To view this discussion on the web visit
>> >> > https://groups.google.com/d/msg/mongodb-user/-/5j7b2xfPdSkJ.
>> >> >
>> >> > To post to this group, send email to mongod...@googlegroups.com.
>> >> > To unsubscribe from this group, send email to


>> >> > For more options, visit this group at
>> >> > http://groups.google.com/group/mongodb-user?hl=en.
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "mongodb-user" group.
>> > To view this discussion on the web visit
>> > https://groups.google.com/d/msg/mongodb-user/-/zu2AW9HWXnQJ.
>> >
>> > To post to this group, send email to mongod...@googlegroups.com.
>> > To unsubscribe from this group, send email to


>> > For more options, visit this group at
>> > http://groups.google.com/group/mongodb-user?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "mongodb-user" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/mongodb-user/-/4CnYArCOWBwJ.
>
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to

Eliot Horowitz

unread,
Mar 6, 2012, 11:20:43 PM3/6/12
to mongod...@googlegroups.com
If another config server is down - then a mongodump is safe.

>> >> >> >> > mongodb-user...@googlegroups.com.


>> >> >> >> > For more options, visit this group at
>> >> >> >> > http://groups.google.com/group/mongodb-user?hl=en.
>> >> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > You received this message because you are subscribed to the Google
>> >> >> > Groups
>> >> >> > "mongodb-user" group.
>> >> >> > To view this discussion on the web visit
>> >> >> > https://groups.google.com/d/msg/mongodb-user/-/5j7b2xfPdSkJ.
>> >> >> >
>> >> >> > To post to this group, send email to
>> >> >> > mongod...@googlegroups.com.
>> >> >> > To unsubscribe from this group, send email to

>> >> >> > mongodb-user...@googlegroups.com.


>> >> >> > For more options, visit this group at
>> >> >> > http://groups.google.com/group/mongodb-user?hl=en.
>> >> >
>> >> > --
>> >> > You received this message because you are subscribed to the Google
>> >> > Groups
>> >> > "mongodb-user" group.
>> >> > To view this discussion on the web visit
>> >> > https://groups.google.com/d/msg/mongodb-user/-/zu2AW9HWXnQJ.
>> >> >
>> >> > To post to this group, send email to mongod...@googlegroups.com.
>> >> > To unsubscribe from this group, send email to

>> >> > mongodb-user...@googlegroups.com.


>> >> > For more options, visit this group at
>> >> > http://groups.google.com/group/mongodb-user?hl=en.
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "mongodb-user" group.
>> > To view this discussion on the web visit
>> > https://groups.google.com/d/msg/mongodb-user/-/4CnYArCOWBwJ.
>> >
>> > To post to this group, send email to mongod...@googlegroups.com.
>> > To unsubscribe from this group, send email to

>> > mongodb-user...@googlegroups.com.


>> > For more options, visit this group at
>> > http://groups.google.com/group/mongodb-user?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "mongodb-user" group.
> To view this discussion on the web visit

> https://groups.google.com/d/msg/mongodb-user/-/60MPp_jYxbkJ.


>
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to

> mongodb-user...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages