LASTSAVE equivalent to BGREWRITEAOF

75 views
Skip to first unread message

Daniel Mezzatto

unread,
Apr 2, 2012, 11:48:59 AM4/2/12
to redi...@googlegroups.com
Is there a LASTSAVE equivalent to BGREWRITEAOF?

I'm migrating from RDB to AOF and I have the need to know when the LASTSAVE was done. I want to issue the BGREWRITEAOF manually (as I currently do with BGSAVE) because I have several instances os Redis running on the same machine and I want to control the saves to disk individually, so that no more than 1 instance is writing to disk at a given time.

Can I do it with BGREWRITEAOF the same way I currently do with BGSAVE?

Premysl Hruby

unread,
Apr 2, 2012, 1:01:58 PM4/2/12
to redi...@googlegroups.com
Hi,

You missed the difference between the RDB and AOF, RDB is state of db at
the given time, AOF is path how to get to that state :-). In aof goes
every write command you issue to redis, so the "last saved state" is
that of last write command issued (give or take fsync, in case of
catastrophic failure). What BGREWRITEAOF is that it only compact AOF, so
it doesn't contain redundant and unnecessary commands (to put it simply).

-Ph

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

Daniel Mezzatto

unread,
Apr 2, 2012, 3:42:23 PM4/2/12
to redi...@googlegroups.com
I know that my app does very little write commands. But sometimes we need to performe a massive data update and the update process issues 1M+ write commands per second (we have 64 instances spread over 12 machines so that we can perform 1M+ write/sec).

I want to disable AOF for a few minutes (while the update process is running) and after that reenable it. But I can't reenable it on all instances at the same time or the machine will suffer with a very high rate of disk writes. The job will be get done faster if I let Redis rewrite the AOF file a instance at a time. But the problem is that I don't know when to enable AOF on the next instance since I don't have a LASTSAVE equivalent for AOF rewriting.

Any thoughts?

Josiah Carlson

unread,
Apr 2, 2012, 5:37:10 PM4/2/12
to redi...@googlegroups.com
It seems to me not that you want to disable AOF, you just want to
disable syncing and rewriting.

The two configuration options you are looking for are: appendfsync and
auto-aof-rewrite-percentage.

When you want them to hold off from writing, you would set:
appendfsync no
auto-aof-rewrite-percentage 10000

Then after you've done your writing, you could change it to...
appendfsync everysec

And on a rotating basis, you would say:
auto-aof-rewrite-percentage XXX

For each Redis instance, you can determine whether there is a rewrite
in progress by checking the bgrewriteaof_in_progress output from INFO.

Regards,
- Josiah

>> > redis-db+u...@googlegroups.com.


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

> --
> You received this message because you are subscribed to the Google Groups
> "Redis DB" group.
> To view this discussion on the web visit

> https://groups.google.com/d/msg/redis-db/-/YY17plZ0cgEJ.


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

> redis-db+u...@googlegroups.com.

Daniel Mezzatto

unread,
Apr 2, 2012, 6:14:56 PM4/2/12
to redi...@googlegroups.com
The bgrewriteaof_in_progress from INFO is the one I'm looking for.

Thanks Josiah!

>> > redis-db+unsubscribe@googlegroups.com.


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

> redis-db+unsubscribe@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages