Ubuntu 10.04.2, Redis 2.0.3 (more details at the end of the question).
My AOF file for Redis is getting too large, to the point where it soon would threaten to take whole free disk space on my small-HDD VPS box:
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda 32G 24G 6.7G 78% /
$ ls -la
total 3866688
drwxr-xr-x 2 redis redis 4096 2011-03-02 00:11 .
drwxr-xr-x 29 root root 4096 2011-01-24 15:58 ..
-rw-r----- 1 redis redis 3923246988 2011-03-02 00:14 appendonly.aof
-rw-rw---- 1 redis redis 32356467 2011-03-02 00:11 dump.rdb
When I run BGREWRITEAOF, the AOF file shrinks, but disk space is not freed:
$ ls -la
total 95440
drwxr-xr-x 2 redis redis 4096 2011-03-02 00:17 .
drwxr-xr-x 29 root root 4096 2011-01-24 15:58 ..
-rw-rw---- 1 redis redis 65137639 2011-03-02 00:17 appendonly.aof
-rw-rw---- 1 redis redis 32476167 2011-03-02 00:17 dump.rdb
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda 32G 24G 6.7G 78% /
Sure enough, Redis is still holding the deleted file:
$ sudo lsof -p6916
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
...
redis-ser 6916 redis 7r REG 202,0 3923957317 918129 /var/lib/redis/appendonly.aof (deleted)
...
redis-ser 6916 redis 10w REG 202,0 66952615 917507 /var/lib/redis/appendonly.aof
...
How can I workaround this issue? I can restart Redis this time, but I would really like to avoid doing this on a regular basis.
Note that I can not upgrade to 2.2 (upgrade to 2.0.4 is feasible though).
More information on my system:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 10.04.2 LTS
Release: 10.04
Codename: lucid
$ uname -a
Linux my.box 2.6.32.16-linode28 #1 SMP Sun Jul 25 21:32:42 UTC 2010 i686 GNU/Linux
$ redis-cli info
redis_version:2.0.3
redis_git_sha1:00000000
redis_git_dirty:0
arch_bits:32
multiplexing_api:epoll
process_id:6916
uptime_in_seconds:632728
uptime_in_days:7
connected_clients:2
connected_slaves:0
blocked_clients:0
used_memory:65714632
used_memory_human:62.67M
changes_since_last_save:8398
bgsave_in_progress:0
last_save_time:1299014574
bgrewriteaof_in_progress:0
total_connections_received:17
total_commands_processed:55748609
expired_keys:0
hash_max_zipmap_entries:64
hash_max_zipmap_value:512
pubsub_channels:0
pubsub_patterns:0
vm_enabled:0
role:master
db0:keys=1,expires=0
db1:keys=18,expires=0