sai ganesh
sai ganesh

Reputation: 41

Redis server is Restarted For Every two minutes and loses keys for every few minutes

I am using a 3.2.11 Redis version in ubuntu 16.04. we are writing and reading keys from Redis. After every two minutes, it's getting shut down for the below reason.

signal-handler (1568095246) Received SIGTERM scheduling shutdown...

In windows, the same version and same configuration are working perfectly.

Below are my configurations of Redis-server

"# Server redis_version:3.2.11 redis_git_sha1:00000000 redis_git_dirty:0 redis_build_id:c9f2a36594be9567 redis_mode:standalone os:Linux 4.15.0-1052-azure x86_64 arch_bits:64 multiplexing_api:epoll gcc_version:4.9.2 process_id:26959 run_id:f720ccac1536542b7c6ee84172d4c49fca6b80ee tcp_port:6379 uptime_in_seconds:78 uptime_in_days:0 hz:10 lru_clock:7813869 executable:/usr/bin/redis-server config_file:/etc/redis/redis.conf

Clients

connected_clients:4 client_longest_output_list:0 client_biggest_input_buf:0 blocked_clients:0

Memory

used_memory:890304 used_memory_human:869.44K used_memory_rss:4530176 used_memory_rss_human:4.32M used_memory_peak:930344 used_memory_peak_human:908.54K total_system_memory:16796553216 total_system_memory_human:15.64G used_memory_lua:37888 used_memory_lua_human:37.00K maxmemory:268435456 maxmemory_human:256.00M maxmemory_policy:noeviction mem_fragmentation_ratio:5.09 mem_allocator:jemalloc-4.0.3

Persistence

loading:0 rdb_changes_since_last_save:0 rdb_bgsave_in_progress:0 rdb_last_save_time:1568094879 rdb_last_bgsave_status:ok rdb_last_bgsave_time_sec:-1 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:11 total_commands_processed:45 instantaneous_ops_per_sec:0 total_net_input_bytes:1645 total_net_output_bytes:3040 instantaneous_input_kbps:0.00 instantaneous_output_kbps:0.00 rejected_connections:0 sync_full:0 sync_partial_ok:0 sync_partial_err:0 expired_keys:0 evicted_keys:0 keyspace_hits:24 keyspace_misses:1 pubsub_channels:0 pubsub_patterns:0 latest_fork_usec:0 migrate_cached_sockets:0

Replication

role:master connected_slaves:0 master_repl_offset:0 repl_backlog_active:0 repl_backlog_size:1048576 repl_backlog_first_byte_offset:0 repl_backlog_histlen:0

CPU

used_cpu_sys:0.07 used_cpu_user:0.03 used_cpu_sys_children:0.00 used_cpu_user_children:0.00

Cluster

cluster_enabled:0

Keyspace

db0:keys=31,expires=0,avg_ttl=0

Below are my Redis server logs

37507:signal-handler (1568096332) Received SIGTERM scheduling shutdown...
37507:M 10 Sep 06:18:52.379 # User requested shutdown...
37507:M 10 Sep 06:18:52.379 * Saving the final RDB snapshot before exiting.
37507:M 10 Sep 06:18:52.403 * DB saved on disk
37507:M 10 Sep 06:18:52.404 * Removing the pid file.
37507:M 10 Sep 06:18:52.404 # Redis is now ready to exit, bye bye...
38199:M 10 Sep 06:18:52.804 * Redis 3.2.11 (00000000/0) 64 bit, standalone mode, port 6379, pid 38199 ready to start.
38199:M 10 Sep 06:18:52.804 # Server started, Redis version 3.2.11
38199:M 10 Sep 06:18:52.804 * DB loaded from disk: 0.000 seconds
38199:M 10 Sep 06:18:52.805 * The server is now ready to accept connections on port 6379
38199:signal-handler (1568096422) Received SIGTERM scheduling shutdown...
38199:M 10 Sep 06:20:22.815 # User requested shutdown...
38199:M 10 Sep 06:20:22.815 * Saving the final RDB snapshot before exiting.
38199:M 10 Sep 06:20:22.836 * DB saved on disk
38199:M 10 Sep 06:20:22.836 * Removing the pid file.
38199:M 10 Sep 06:20:22.836 # Redis is now ready to exit, bye bye...
38950:M 10 Sep 06:20:23.333 * Redis 3.2.11 (00000000/0) 64 bit, standalone mode, port 6379, pid 38950 ready to start.
38950:M 10 Sep 06:20:23.335 # Server started, Redis version 3.2.11
38950:M 10 Sep 06:20:23.336 * DB loaded from disk: 0.000 seconds
38950:M 10 Sep 06:20:23.336 * The server is now ready to accept connections on port 6379
38950:signal-handler (1568096513) Received SIGTERM scheduling shutdown...
38950:M 10 Sep 06:21:53.409 # User requested shutdown...
38950:M 10 Sep 06:21:53.410 * Saving the final RDB snapshot before exiting.
38950:M 10 Sep 06:21:53.429 * DB saved on disk
38950:M 10 Sep 06:21:53.429 * Removing the pid file.
38950:M 10 Sep 06:21:53.429 # Redis is now ready to exit, bye bye...
39659:M 10 Sep 06:21:53.808 * Redis 3.2.11 (00000000/0) 64 bit, standalone mode, port 6379, pid 39659 ready to start.
39659:M 10 Sep 06:21:53.808 # Server started, Redis version 3.2.11
39659:M 10 Sep 06:21:53.809 * DB loaded from disk: 0.000 seconds
39659:M 10 Sep 06:21:53.810 * The server is now ready to accept connections on port 6379

Redis-server Verbose logs

44263:M 10 Sep 06:32:27.832 - DB 0: 31 keys (0 volatile) in 32 slots HT.
44263:M 10 Sep 06:32:27.832 - 3 clients connected (0 slaves), 827584 bytes in use
44263:M 10 Sep 06:32:32.844 - DB 0: 31 keys (0 volatile) in 32 slots HT.
44263:M 10 Sep 06:32:32.844 - 3 clients connected (0 slaves), 827584 bytes in use
44263:M 10 Sep 06:32:37.860 - DB 0: 31 keys (0 volatile) in 32 slots HT.
44263:M 10 Sep 06:32:37.861 - 3 clients connected (0 slaves), 827584 bytes in use
44263:M 10 Sep 06:32:42.888 - DB 0: 31 keys (0 volatile) in 32 slots HT.
44263:M 10 Sep 06:32:42.888 - 3 clients connected (0 slaves), 827584 bytes in use
44263:signal-handler (1568097167) Received SIGTERM scheduling shutdown...
44263:M 10 Sep 06:32:47.699 # User requested shutdown...
44263:M 10 Sep 06:32:47.700 * Saving the final RDB snapshot before exiting.
44263:M 10 Sep 06:32:47.718 * DB saved on disk
44263:M 10 Sep 06:32:47.718 * Removing the pid file.
44263:M 10 Sep 06:32:47.718 # Redis is now ready to exit, bye bye...
44978:M 10 Sep 06:32:48.085 * Redis 3.2.11 (00000000/0) 64 bit, standalone mode, port 6379, pid 44978 ready to start.
44978:M 10 Sep 06:32:48.085 # Server started, Redis version 3.2.11
44978:M 10 Sep 06:32:48.085 * DB loaded from disk: 0.000 seconds
44978:M 10 Sep 06:32:48.086 * The server is now ready to accept connections on port 6379
44978:M 10 Sep 06:32:48.086 - DB 0: 31 keys (0 volatile) in 32 slots HT.
44978:M 10 Sep 06:32:48.086 - 0 clients connected (0 slaves), 765984 bytes in use
44978:M 10 Sep 06:32:53.097 - DB 0: 31 keys (0 volatile) in 32 slots HT.
44978:M 10 Sep 06:32:53.097 - 0 clients connected (0 slaves), 765984 bytes in use
44978:M 10 Sep 06:32:58.108 - DB 0: 31 keys (0 volatile) in 32 slots HT.
44978:M 10 Sep 06:32:58.108 - 0 clients connected (0 slaves), 765984 bytes in use
44978:M 10 Sep 06:32:58.744 - Accepted 10.1.0.11:58060
44978:M 10 Sep 06:32:58.744 - Reading from client: Connection reset by peer
44978:M 10 Sep 06:32:58.749 - Accepted 10.1.0.10:54662
44978:M 10 Sep 06:32:58.750 - Reading from client: Connection reset by peer
44978:M 10 Sep 06:32:59.180 - Accepted 10.1.0.8:53212
44978:M 10 Sep 06:33:03.121 - DB 0: 31 keys (0 volatile) in 32 slots HT.
44978:M 10 Sep 06:33:03.121 - 1 clients connected (0 slaves), 786856 bytes in use
44978:M 10 Sep 06:33:08.132 - DB 0: 31 keys (0 volatile) in 32 slots HT.
44978:M 10 Sep 06:33:08.132 - 1 clients connected (0 slaves), 786856 bytes in use
44978:M 10 Sep 06:33:13.145 - DB 0: 31 keys (0 volatile) in 32 slots HT.
44978:M 10 Sep 06:33:13.145 - 1 clients connected (0 slaves), 786856 bytes in use
44978:M 10 Sep 06:33:18.157 - DB 0: 31 keys (0 volatile) in 32 slots HT.
44978:M 10 Sep 06:33:18.157 - 1 clients connected (0 slaves), 786856 bytes in use
44978:M 10 Sep 06:33:23.168 - DB 0: 31 keys (0 volatile) in 32 slots HT.
44978:M 10 Sep 06:33:23.168 - 1 clients connected (0 slaves), 786856 bytes in use
44978:M 10 Sep 06:33:28.181 - DB 0: 31 keys (0 volatile) in 32 slots HT.
44978:M 10 Sep 06:33:28.182 - 1 clients connected (0 slaves), 786856 bytes in use
44978:M 10 Sep 06:33:29.791 - Accepted 10.1.0.10:54812
44978:M 10 Sep 06:33:29.791 - Accepted 10.1.0.11:58242
44978:M 10 Sep 06:33:29.792 - Reading from client: Connection reset by peer
44978:M 10 Sep 06:33:29.792 - Reading from client: Connection reset by peer
44978:M 10 Sep 06:33:30.698 - Accepted 10.1.0.7:45992
44978:M 10 Sep 06:33:30.814 - Accepted 10.1.0.6:44336
44978:M 10 Sep 06:33:33.192 - DB 0: 31 keys (0 volatile) in 32 slots HT.
44978:M 10 Sep 06:33:33.192 - 3 clients connected (0 slaves), 828600 bytes in use
44978:M 10 Sep 06:33:38.209 - DB 0: 31 keys (0 volatile) in 32 slots HT.
44978:M 10 Sep 06:33:38.209 - 3 clients connected (0 slaves), 828600 bytes in use
44978:M 10 Sep 06:33:43.221 - DB 0: 31 keys (0 volatile) in 32 slots HT.
44978:M 10 Sep 06:33:43.221 - 3 clients connected (0 slaves), 828600 bytes in use
44978:M 10 Sep 06:33:48.234 - DB 0: 31 keys (0 volatile) in 32 slots HT.
44978:M 10 Sep 06:33:48.234 - 3 clients connected (0 slaves), 828600 bytes in use
44978:M 10 Sep 06:33:53.249 - DB 0: 31 keys (0 volatile) in 32 slots HT.
44978:M 10 Sep 06:33:53.249 - 3 clients connected (0 slaves), 828600 bytes in use
44978:M 10 Sep 06:33:58.261 - DB 0: 31 keys (0 volatile) in 32 slots HT.
44978:M 10 Sep 06:33:58.261 - 3 clients connected (0 slaves), 828600 bytes in use
44978:M 10 Sep 06:34:02.159 - Accepted 10.1.0.10:54950
44978:M 10 Sep 06:34:02.160 - Reading from client: Connection reset by peer
44978:M 10 Sep 06:34:02.161 - Accepted 10.1.0.11:58420
44978:M 10 Sep 06:34:02.161 - Reading from client: Connection reset by peer
44978:M 10 Sep 06:34:03.276 - DB 0: 31 keys (0 volatile) in 32 slots HT.
44978:M 10 Sep 06:34:03.276 - 3 clients connected (0 slaves), 827576 bytes in use
44978:M 10 Sep 06:34:08.292 - DB 0: 31 keys (0 volatile) in 32 slots HT.
44978:M 10 Sep 06:34:08.292 - 3 clients connected (0 slaves), 827576 bytes in use
44978:M 10 Sep 06:34:13.305 - DB 0: 31 keys (0 volatile) in 32 slots HT.
44978:M 10 Sep 06:34:13.306 - 3 clients connected (0 slaves), 827576 bytes in use
44978:signal-handler (1568097258) Received SIGTERM scheduling shutdown...
44978:M 10 Sep 06:34:18.216 # User requested shutdown...
44978:M 10 Sep 06:34:18.216 * Saving the final RDB snapshot before exiting.
44978:M 10 Sep 06:34:18.247 * DB saved on disk
44978:M 10 Sep 06:34:18.247 * Removing the pid file.
44978:M 10 Sep 06:34:18.247 # Redis is now ready to exit, bye bye...
45737:M 10 Sep 06:34:18.557 * Redis 3.2.11 (00000000/0) 64 bit, standalone mode, port 6379, pid 45737 ready to start.
45737:M 10 Sep 06:34:18.559 # Server started, Redis version 3.2.11
45737:M 10 Sep 06:34:18.560 * DB loaded from disk: 0.000 seconds
45737:M 10 Sep 06:34:18.560 * The server is now ready to accept connections on port 6379
45737:M 10 Sep 06:34:18.561 - DB 0: 31 keys (0 volatile) in 32 slots HT.
45737:M 10 Sep 06:34:18.561 - 0 clients connected (0 slaves), 766024 bytes in use
45737:M 10 Sep 06:34:23.573 - DB 0: 31 keys (0 volatile) in 32 slots HT.
45737:M 10 Sep 06:34:23.573 - 0 clients connected (0 slaves), 766024 bytes in use
45737:M 10 Sep 06:34:28.588 - DB 0: 31 keys (0 volatile) in 32 slots HT.
45737:M 10 Sep 06:34:28.589 - 0 clients connected (0 slaves), 766024 bytes in use
45737:M 10 Sep 06:34:33.599 - DB 0: 31 keys (0 volatile) in 32 slots HT.
45737:M 10 Sep 06:34:33.599 - 0 clients connected (0 slaves), 766024 bytes in use

Sometimes I am facing below error logs in Redis server I am running Redis server as standalone mode

104680:S 11 Sep 10:05:13.913 * SLAVE OF 192.3.70.16:12220 enabled (user request from 'id=1600 addr=192.3.70.16:42370 fd=9 name= age=0 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=32768 obl=0 oll=0 omem=0 events=r cmd=slaveof')
104680:S 11 Sep 10:05:14.880 * Connecting to MASTER 192.3.70.16:12220
104680:S 11 Sep 10:05:14.881 * MASTER <-> SLAVE sync started
104680:S 11 Sep 10:05:15.092 # Error condition on socket for SYNC: Connection refused
104680:S 11 Sep 10:05:15.883 * Connecting to MASTER 192.3.70.16:12220
104680:S 11 Sep 10:05:15.883 * MASTER <-> SLAVE sync started
104680:S 11 Sep 10:05:16.093 # Error condition on socket for SYNC: Connection refused
104680:S 11 Sep 10:05:16.886 * Connecting to MASTER 192.3.70.16:12220
104680:S 11 Sep 10:05:16.886 * MASTER <-> SLAVE sync started
104680:S 11 Sep 10:05:17.093 * Non blocking connect for SYNC fired the event.
104680:S 11 Sep 10:05:17.300 * Master replied to PING, replication can continue...
104680:S 11 Sep 10:05:17.714 * Partial resynchronization not possible (no cached master)
104680:S 11 Sep 10:05:17.926 * Full resync from master: ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ:0
104680:S 11 Sep 10:05:17.926 * MASTER <-> SLAVE sync: receiving 3372687 bytes from master
104680:S 11 Sep 10:05:19.400 * MASTER <-> SLAVE sync: Flushing old data
104680:S 11 Sep 10:05:19.400 * MASTER <-> SLAVE sync: Loading DB in memory
104680:S 11 Sep 10:05:19.400 # Wrong signature trying to load DB from file
104680:S 11 Sep 10:05:19.400 # Failed trying to load the MASTER synchronization DB from disk
104680:S 11 Sep 10:05:19.892 * Connecting to MASTER 192.3.70.16:12220
104680:S 11 Sep 10:05:19.892 * MASTER <-> SLAVE sync started
104680:S 11 Sep 10:05:20.100 * Non blocking connect for SYNC fired the event.
104680:M 11 Sep 10:05:21.184 * MASTER MODE enabled (user request from 'id=1600 addr=192.3.70.16:42370 fd=9 name= age=8 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=32768 obl=0 oll=0 omem=0 events=r cmd=slaveof')
104680:S 11 Sep 10:05:22.073 * SLAVE OF 192.3.70.16:51622 enabled (user request from 'id=1605 addr=192.3.70.16:42508 fd=9 name= age=0 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=32768 obl=0 oll=0 omem=0 events=r cmd=slaveof')
104680:S 11 Sep 10:05:22.906 * Connecting to MASTER 192.3.70.16:51622
104680:S 11 Sep 10:05:22.906 * MASTER <-> SLAVE sync started
104680:S 11 Sep 10:05:23.117 # Error condition on socket for SYNC: Connection refused

Upvotes: 1

Views: 4844

Answers (3)

no746
no746

Reputation: 558

I've encountered this problem and it was a permission problem. Check your Redis, so it has all the required permissions to all the directory it needs.

Upvotes: 1

tuantm
tuantm

Reputation: 19

I have the same error and now i suspect command: SLAVE OF 192.3.70.16:12220 enabled (user request from 'id=1600 addr=192.3.70.16:42370 fd=9 name= age=0 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=32768 obl=0 oll=0 omem=0 events=r cmd=slaveof')

Please, check who send this command to your redis server? Try set: protected-mode yes (redis.cfg) and config connecting password for your redis server

Upvotes: 1

jack
jack

Reputation: 26

The log say : 44263:M 10 Sep 06:32:47.699 # User requested shutdown...
try to reinstall

Upvotes: 0

Related Questions