Discussion:
[mongodb-user] Prevent writings before dropping a collection
t***@sanoia.com
2018-11-26 22:36:12 UTC
Permalink
Hello!

I have a huge logs collection on my database, and what I need to do is :

1) Dump it to a backup file
2) Drop it
3) Everyday, dump the new entries to backup files

So it's basically incremental backup, but I've got the basic installation,
so no ReplicaSet, no nothing

To prevent writings between 1) and 2), I put a fsyncLock on the database,

But I realized that it prevents the dropping of the database.

*Is there a way to block writings to the DB so that there's nothing written
between the dump and the drop (I would lose them otherwise).*

I've looked everywhere, but as usual no fitting answer...

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

For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/2966762b-d5f0-410a-bc9e-4830669ee6c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Oleg Toropov
2018-11-27 14:43:59 UTC
Permalink
How about to temporally revoke users rights to write?
Post by t***@sanoia.com
Hello!
1) Dump it to a backup file
2) Drop it
3) Everyday, dump the new entries to backup files
So it's basically incremental backup, but I've got the basic installation,
so no ReplicaSet, no nothing
To prevent writings between 1) and 2), I put a fsyncLock on the database,
But I realized that it prevents the dropping of the database.
*Is there a way to block writings to the DB so that there's nothing
written between the dump and the drop (I would lose them otherwise).*
I've looked everywhere, but as usual no fitting answer...
Thank you in advance
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups
"mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit
https://groups.google.com/d/msgid/mongodb-user/2966762b-d5f0-410a-bc9e-4830669ee6c3%40googlegroups.com
<https://groups.google.com/d/msgid/mongodb-user/2966762b-d5f0-410a-bc9e-4830669ee6c3%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
//
// Oleg V.Toropov, MCP | ***@gmail.com
// -----------------------------------------------------------------
// I have discovered that if I read enough stuff that's over my head,
// I actually begin to understand some of it.
//
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.

For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/CABdQPYoO4rNKLTmM%3DZk%3DfepEVM2Yo4otBuFr1AwqjnKm%3Deoiow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
t***@sanoia.com
2018-11-27 16:22:18 UTC
Permalink
That would be a nice idea, but the problem is that everything is done with
the admin user, so I can't revoke my own right, can I?

I'm thinking about blocking access with the firewall, I don't know if it's
a good idea, and I'm not even sure it's doable (inter-container
connectivity...)
Post by Oleg Toropov
How about to temporally revoke users rights to write?
Post by t***@sanoia.com
Hello!
1) Dump it to a backup file
2) Drop it
3) Everyday, dump the new entries to backup files
So it's basically incremental backup, but I've got the basic
installation, so no ReplicaSet, no nothing
To prevent writings between 1) and 2), I put a fsyncLock on the database,
But I realized that it prevents the dropping of the database.
*Is there a way to block writings to the DB so that there's nothing
written between the dump and the drop (I would lose them otherwise).*
I've looked everywhere, but as usual no fitting answer...
Thank you in advance
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups
"mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an
<javascript:>.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit
https://groups.google.com/d/msgid/mongodb-user/2966762b-d5f0-410a-bc9e-4830669ee6c3%40googlegroups.com
<https://groups.google.com/d/msgid/mongodb-user/2966762b-d5f0-410a-bc9e-4830669ee6c3%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
//
// -----------------------------------------------------------------
// I have discovered that if I read enough stuff that's over my head,
// I actually begin to understand some of it.
//
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.

For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/dbfeff58-813b-46df-a6b4-4eccb4d2fecc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Oleg Toropov
2018-11-28 03:00:49 UTC
Permalink
OK, create user "superadmin" with root privileges. Logon as "superadmin",
revoke writing privileges from "admin",
then do 1) and 2) as "superadmin"user.
Post by t***@sanoia.com
That would be a nice idea, but the problem is that everything is done with
the admin user, so I can't revoke my own right, can I?
I'm thinking about blocking access with the firewall, I don't know if it's
a good idea, and I'm not even sure it's doable (inter-container
connectivity...)
Post by Oleg Toropov
How about to temporally revoke users rights to write?
Post by t***@sanoia.com
Hello!
1) Dump it to a backup file
2) Drop it
3) Everyday, dump the new entries to backup files
So it's basically incremental backup, but I've got the basic
installation, so no ReplicaSet, no nothing
To prevent writings between 1) and 2), I put a fsyncLock on the database,
But I realized that it prevents the dropping of the database.
*Is there a way to block writings to the DB so that there's nothing
written between the dump and the drop (I would lose them otherwise).*
I've looked everywhere, but as usual no fitting answer...
Thank you in advance
--
You received this message because you are subscribed to the Google
Groups "mongodb-user"
group.
https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit
https://groups.google.com/d/msgid/mongodb-user/2966762b-d5f0-410a-bc9e-4830669ee6c3%40googlegroups.com
<https://groups.google.com/d/msgid/mongodb-user/2966762b-d5f0-410a-bc9e-4830669ee6c3%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
//
// -----------------------------------------------------------------
// I have discovered that if I read enough stuff that's over my head,
// I actually begin to understand some of it.
//
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups
"mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit
https://groups.google.com/d/msgid/mongodb-user/dbfeff58-813b-46df-a6b4-4eccb4d2fecc%40googlegroups.com
<https://groups.google.com/d/msgid/mongodb-user/dbfeff58-813b-46df-a6b4-4eccb4d2fecc%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
//
// Oleg V.Toropov, MCP | ***@gmail.com
// -----------------------------------------------------------------
// I have discovered that if I read enough stuff that's over my head,
// I actually begin to understand some of it.
//
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.

For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/CABdQPYpNjBw30PhoLxQZz0zsoP4qzcLprUnZpRf46K41vSkBVw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
'Kevin Adistambha' via mongodb-user
2018-11-28 05:32:06 UTC
Permalink
Hi,

Is there a way to block writings to the DB so that there’s nothing written
between the dump and the drop (I would lose them otherwise).

It seems to me that what you’re trying to solve is a race condition between
taking a backup and dropping the collection, while a writer is constantly
writing to the database. Is this accurate?

Can I propose an alternative solution instead? How about writing to a
timestamped collection? Instead of writing to the same collection name
every day, append today’s date to the collection name. For example:

dt = '2018-11-28'
db['collection-' + dt].insert(...)

With this scheme, you can backup and drop yesterday’s collection at your
leisure, while today’s collection can be written to at the same time
without the need to fsynclock the server. As a bonus, you have the day’s
log separated and discernible by their collection name. Will this scheme
serve your need?

Best regards,
Kevin
​
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.

For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/ceb1f7b6-cf0e-404f-aaf7-787eeece2419%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...