Temporarily stop slave replication to perform a clean dump

146 views
Skip to first unread message

nicolas_

unread,
Jul 15, 2009, 6:19:51 PM7/15/09
to mongodb-user
Hi,

is there an admin command to ask a slave to stop replication from the
master and write all changes to disk ? This way, "mongodump" could be
used to make a proper dump and would be still online for reads.

If it's not possible and I have to stop the slave, is it the goal of
the driver to automatically reconnect to the master is the slave
disappears ?

Thanks,

Nicolas

nicolas_

unread,
Jul 15, 2009, 6:32:01 PM7/15/09
to mongodb-user
I suppose that writing all changes to disk would not be necessary if
"mongodump" connects to "mongodb" via TCP instead of specifying the
dbpath, right?

Eliot Horowitz

unread,
Jul 15, 2009, 9:30:04 PM7/15/09
to mongod...@googlegroups.com
Correct - mongodump just is a regular db client. So there is no need
to pause replication.
The only downside is you don't get a perfect in time snapshot, but you
have all of the data.

nicolas_

unread,
Jul 20, 2009, 8:56:59 AM7/20/09
to mongodb-user
Thanks for the answer.

I still have a question though.
Amazon provides a differential snapshot feature with EBS. I wonder if
using TCP to make a backup (with mongodump) is a good idea if you can
make snapshots at a lower level. Using the network stack to backup
Gigabytes (Tera) of data would not be "too much" ?
To be able to do this, I suppose I would need to stop writing to the
disk during this process. So I re-ask my first question, is there an
admin command to prevent a slave from writing to the disk. Or is it
planned ?

Nicolas

On 16 juil, 03:30, Eliot Horowitz <eliothorow...@gmail.com> wrote:
> Correct - mongodump just is a regular db client.  So there is no need
> to pause replication.
> The only downside is you don't get a perfect in time snapshot, but you
> have all of the data.
>
>
>
> On Wed, Jul 15, 2009 at 6:32 PM, nicolas_<nicolas.fou...@gmail.com> wrote:
>
> > I suppose that writing all changes to disk would not be necessary if
> > "mongodump" connects to "mongodb" via TCP instead of specifying the
> > dbpath, right?
>
> > On 16 juil, 00:19, nicolas_ <nicolas.fou...@gmail.com> wrote:
> >> Hi,
>
> >> is there an admin command to ask aslaveto stop replication from the
> >> master and write all changes to disk ? This way, "mongodump" could be
> >> used to make a proper dump and would be still online for reads.
>
> >> If it's not possible and I have to stop theslave, is it the goal of

Erwan A.

unread,
Jul 20, 2009, 9:57:18 AM7/20/09
to mongodb-user
Hello, i'd like to add to Nicolas' question:

is it possible to stop the slave and have all data flushed to disk
properly ? like:

- stop reading events from master
- flush all buffers to disk
- dump/backup/snapshot the data
- restart reading

This is very close to the process one would use with MySQL:
- FLUSH TABLE WITH READ LOCK
- snapshot the data
- UNLOCK TABLE

Then make a backup of the snapshot taken in step 2.

In case of a crash, we want to be sure that we can start a new mongodb
server using the backed-up data, minimizing data loss and issues with
the integrity of the data ...

Thanks in advance,

Erwan

Dwight Merriman

unread,
Jul 20, 2009, 10:56:57 AM7/20/09
to mongod...@googlegroups.com
The best way to do that today is to stop the slave db process, copy the datafiles, and then restart it.

Somethin like the mysql way listed below would be pretty easy to add though if you want to put it in Jira as a feature request.
Reply all
Reply to author
Forward
0 new messages