FAQ
Howdy,

* When setting a key on redis master with setex and a short ttl, the key
with ttl is replicated to the slave.
* When the TTL reaches 0, the Key is not removed from the slave, and still
readable.
* As soon as we try to read the key on the master, the key is purged on the
slave.

We first thought it is due to the master running an older version than the
slave, but updating the master did not help. This seems like an odd bug in
redis replication. How can we work around it? Can you provide a fix?

I am keen to provide more information.

Example Timeline of commands:

---

Master > setex foo 10 asdf
OK

Slave > ttl foo
(integer) 8

[wait 7s]

Slave > ttl foo
(integer) 1
Slave > ttl foo
(integer) 0

[wait 1s, the key should be gone and null returned, but instead we get the
value]

Slave > get foo
"asdf"

[wait 1s, still getting the value after expiration]

Slave > get foo
"asdf"

[checking the ttl on master (the key is gone there)]

Master > ttl foo
(integer) -2

[after checking on the master, the key is also gone on the slave]

Slave > get foo
(nil)

---

redis-cli info output on the master:

127.0.0.1:6379> info
# Server
redis_version:3.0.4
redis_git_sha1:360763b0
redis_git_dirty:1
redis_build_id:caf22997492999da
redis_mode:standalone
os:Linux 3.13.0-45-generic x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:4.8.4
process_id:4393
run_id:2dacc9424228368619cdbadce5f63aa21fe3346e
tcp_port:6379
uptime_in_seconds:710
uptime_in_days:0
hz:10
lru_clock:14692310
config_file:/etc/redis/redis-6379-server.conf

# Clients
connected_clients:14399
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0

# Memory
used_memory:6201569072
used_memory_human:5.78G
used_memory_rss:5645275136
used_memory_peak:7666156560
used_memory_peak_human:7.14G
used_memory_lua:36864
mem_fragmentation_ratio:0.91
mem_allocator:jemalloc-3.6.0

# Persistence
loading:0
rdb_changes_since_last_save:3934448
rdb_bgsave_in_progress:0
rdb_last_save_time:1457532253
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:34
rdb_current_bgsave_time_sec:-1
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:-1
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok
aof_last_write_status:ok

# Stats
total_connections_received:236949
total_commands_processed:7580795
instantaneous_ops_per_sec:11181
total_net_input_bytes:678761769
total_net_output_bytes:21459787440
instantaneous_input_kbps:940.59
instantaneous_output_kbps:6495.21
rejected_connections:0
sync_full:7
sync_partial_ok:0
sync_partial_err:7
expired_keys:88486
evicted_keys:0
keyspace_hits:3038101
keyspace_misses:470453
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:66989
migrate_cached_sockets:0

# Replication
role:master
connected_slaves:7
slave0:ip=[...],port=6369,state=online,offset=500894827,lag=1
slave1:ip=[...],port=6369,state=online,offset=500541084,lag=1
slave2:ip=[...],port=6369,state=online,offset=500594305,lag=1
slave3:ip=[...],,port=6369,state=online,offset=500574098,lag=1
slave4:ip=[...],port=6369,state=online,offset=500699560,lag=1
slave5:ip=[...],port=6369,state=online,offset=501006937,lag=0
slave6:ip=[...],port=6369,state=online,offset=500485800,lag=1
master_repl_offset:501055463
repl_backlog_active:1
repl_backlog_size:1073741824
repl_backlog_first_byte_offset:2
repl_backlog_histlen:501055462

# CPU
used_cpu_sys:102.69
used_cpu_user:140.10
used_cpu_sys_children:2.29
used_cpu_user_children:21.06

# Cluster
cluster_enabled:0

# Keyspace
db0:keys=20361699,expires=19926036,avg_ttl=441922991

Best regards,
david

--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+unsubscribe@googlegroups.com.
To post to this group, send email to redis-db@googlegroups.com.
Visit this group at https://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
groupredis-db @
categoriesredis
postedMar 15, '16 at 9:59a
activeMar 15, '16 at 9:59a
posts1
users1
websiteredis.io
irc#redis

1 user in discussion

David Edler: 1 post

People

Translate

site design / logo © 2022 Grokbase