我已经使用谷歌点击部署来安装redis服务器。它一直不稳定。这是我每分钟检查的健康状况检查:
redisClient = redis.StrictRedis(host = config['redis']['host'], port = config['redis']['port'], socket_timeout = 3)
redisClientConnection.get('bla_bla')
所以我决定安装一个新的。这是他的redis.conf文件。
daemonize yes
pidfile /var/run/redis.pid
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 0
loglevel notice
logfile ""
databases 16
#save 900 1
#save 300 10
#save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir ./
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-ping-slave-period 10
repl-disable-tcp-nodelay no
slave-priority 100
# maxmemory-samples 3
appendonly no
appendfilename "appendonly.aof"
# appendfsync always
appendfsync everysec
# appendfsync no
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
lua-time-limit 5000
slowlog-max-len 128
notify-keyspace-events ""
list-max-ziplist-entries 512
list-max-ziplist-value 64
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
aof-rewrite-incremental-fsync yes
由于平均每10 7分钟超时(2次失败),它仍然失败:
last execution2015-03-18 09:14:09
history[0,0,0,0,2,0,0,2,0,0,0,0,2,2,2,2,0,0,0,0,0]
我的应用有10个客户端使用client list
你可以在我的conf中看到我已经取消了持久性(保存)。我只使用redis作为缓存。 我的问题是:为什么每隔约5-7分钟计时一次
这是错误和堆栈跟踪:
TimeoutError: Timeout reading from socket
Traceback (most recent call last): File "healthCheck.py", line 14, in get redisClientConnection.get('bla_bla') File "/usr/local/lib/python2.7/dist-packages/redis/client.py", line 863, in get return self.execute_command('GET', name) File "/usr/local/lib/python2.7/dist-packages/redis/client.py", line 565, in execute_command return self.parse_response(connection, command_name, **options) File "/usr/local/lib/python2.7/dist-packages/redis/client.py", line 577, in parse_response response = connection.read_response() File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 569, in read_response response = self._parser.read_response() File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 224, in read_response response = self._buffer.readline() File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 162, in readline self._read_from_socket() File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 133, in _read_from_socket raise TimeoutError("Timeout reading from socket") TimeoutError: Timeout reading from socket
修改
我在实际的redis服务器上添加了健康检查:
check-app-running.rb
#! /usr/bin/env ruby
exec "redis-cli set mykey somevalue"
exec "redis-cli get mykey"
exit 0
它运行良好:
last execution2015-03-18 10:14:51
history[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
所以现在我怀疑网络。任何想法??