sun11506 2016-11-30 02:13 采纳率: 0%
浏览 8025

redis运行一段时间后,客户端链接不上

redis运行一天后,redis-cli或者使用jredis链接redis服务,提示连接超时或者链接拒绝。重启redis服务就可以重新使用了!大牛没帮忙看看什么问题?

配置文件如下:

port 6379

tcp-backlog 511

timeout 60000

tcp-keepalive 0

loglevel debug

logfile "D:\redis-2.8.19\redis.log"

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-disable-tcp-nodelay no

slave-priority 100

requirepass foobared

maxclients 10000

maxheap 2gb

maxmemory 2gb

maxmemory-policy volatile-lru

appendonly no

appendfsync everysec

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-log-slower-than 10000

slowlog-max-len 128

################################ LATENCY MONITOR ##############################

The Redis latency monitoring subsystem samples different operations

at runtime in order to collect data related to possible sources of

latency of a Redis instance.

#

Via the LATENCY command this information is available to the user that can

print graphs and obtain reports.

#

The system only logs operations that were performed in a time equal or

greater than the amount of milliseconds specified via the

latency-monitor-threshold configuration directive. When its value is set

to zero, the latency monitor is turned off.

#

By default latency monitoring is disabled since it is mostly not needed

if you don't have latency issues, and collecting data has a performance

impact, that while very small, can be measured under big load. Latency

monitoring can easily be enalbed at runtime using the command

"CONFIG SET latency-monitor-threshold " if needed.

latency-monitor-threshold 0

############################# Event notification ##############################

Redis can notify Pub/Sub clients about events happening in the key space.

This feature is documented at http://redis.io/topics/notifications

#

For instance if keyspace events notification is enabled, and a client

performs a DEL operation on key "foo" stored in the Database 0, two

messages will be published via Pub/Sub:

#

PUBLISH keyspace@0:foo del

PUBLISH keyevent@0:del foo

#

It is possible to select the events that Redis will notify among a set

of classes. Every class is identified by a single character:

#

K Keyspace events, published with keyspace@ prefix.

E Keyevent events, published with keyevent@ prefix.

g Generic commands (non-type specific) like DEL, EXPIRE, RENAME, ...

$ String commands

l List commands

s Set commands

h Hash commands

z Sorted set commands

x Expired events (events generated every time a key expires)

e Evicted events (events generated when a key is evicted for maxmemory)

A Alias for g$lshzxe, so that the "AKE" string means all the events.

#

The "notify-keyspace-events" takes as argument a string that is composed

of zero or multiple characters. The empty string means that notifications

are disabled.

#

Example: to enable list and generic events, from the point of view of the

event name, use:

#

notify-keyspace-events Elg

#

Example 2: to get the stream of the expired keys subscribing to channel

name keyevent@0:expired use:

#

notify-keyspace-events Ex

#

By default all notifications are disabled because most users don't need

this feature and the feature has some overhead. Note that if you don't

specify at least one of K or E, no events will be delivered.

notify-keyspace-events ""

############################### ADVANCED CONFIG ###############################

Hashes are encoded using a memory efficient data structure when they have a

small number of entries, and the biggest entry does not exceed a given

threshold. These thresholds can be configured using the following directives.

hash-max-ziplist-entries 512
hash-max-ziplist-value 64

Similarly to hashes, small lists are also encoded in a special way in order

to save a lot of space. The special representation is only used when

you are under the following limits:

list-max-ziplist-entries 512
list-max-ziplist-value 64

Sets have a special encoding in just one case: when a set is composed

of just strings that happen to be integers in radix 10 in the range

of 64 bit signed integers.

The following configuration setting sets the limit in the size of the

set in order to use this special memory saving encoding.

set-max-intset-entries 512

Similarly to hashes and lists, sorted sets are also specially encoded in

order to save a lot of space. This encoding is only used when the length and

elements of a sorted set are below the following limits:

zset-max-ziplist-entries 128
zset-max-ziplist-value 64

HyperLogLog sparse representation bytes limit. The limit includes the

16 bytes header. When an HyperLogLog using the sparse representation crosses

this limit, it is converted into the dense representation.

#

A value greater than 16000 is totally useless, since at that point the

dense representation is more memory efficient.

#

The suggested value is ~ 3000 in order to have the benefits of

the space efficient encoding without slowing down too much PFADD,

which is O(N) with the sparse encoding. The value can be raised to

~ 10000 when CPU is not a concern, but space is, and the data set is

composed of many HyperLogLogs with cardinality in the 0 - 15000 range.

hll-sparse-max-bytes 3000

Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in

order to help rehashing the main Redis hash table (the one mapping top-level

keys to values). The hash table implementation Redis uses (see dict.c)

performs a lazy rehashing: the more operation you run into a hash table

that is rehashing, the more rehashing "steps" are performed, so if the

server is idle the rehashing is never complete and some more memory is used

by the hash table.

The default is to use this millisecond 10 times every second in order to

actively rehash the main dictionaries, freeing memory when possible.

#

If unsure:

use "activerehashing no" if you have hard latency requirements and it is

not a good thing in your environment that Redis can reply from time to time

to queries with 2 milliseconds delay.

#

use "activerehashing yes" if you don't have such hard requirements but

want to free memory asap when possible.

activerehashing yes

The client output buffer limits can be used to force disconnection of clients

that are not reading data from the server fast enough for some reason (a

common reason is that a Pub/Sub client can't consume messages as fast as the

publisher can produce them).

#

The limit can be set differently for the three different classes of clients:

#

normal -> normal clients including MONITOR clients

slave -> slave clients

pubsub -> clients subscribed to at least one pubsub channel or pattern

#

The syntax of every client-output-buffer-limit directive is the following:

#

client-output-buffer-limit

#

A client is immediately disconnected once the hard limit is reached, or if

the soft limit is reached and remains reached for the specified number of

seconds (continuously).

So for instance if the hard limit is 32 megabytes and the soft limit is

16 megabytes / 10 seconds, the client will get disconnected immediately

if the size of the output buffers reach 32 megabytes, but will also get

disconnected if the client reaches 16 megabytes and continuously overcomes

the limit for 10 seconds.

#

By default normal clients are not limited because they don't receive data

without asking (in a push way), but just after a request, so only

asynchronous clients may create a scenario where data is requested faster

than it can read.

#

Instead there is a default limit for pubsub and slave clients, since

subscribers and slaves receive data in a push fashion.

#

Both the hard or the soft limit can be disabled by setting them to zero.

client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60

Redis calls an internal function to perform many background tasks, like

closing connections of clients in timeot, purging expired keys that are

never requested, and so forth.

#

Not all tasks are perforemd with the same frequency, but Redis checks for

tasks to perform according to the specified "hz" value.

#

By default "hz" is set to 10. Raising the value will use more CPU when

Redis is idle, but at the same time will make Redis more responsive when

there are many keys expiring at the same time, and timeouts may be

handled with more precision.

#

The range is between 1 and 500, however a value over 100 is usually not

a good idea. Most users should use the default of 10 and raise this up to

100 only in environments where very low latency is required.

hz 10

When a child rewrites the AOF file, if the following option is enabled

the file will be fsync-ed every 32 MB of data generated. This is useful

in order to commit the file to the disk more incrementally and avoid

big latency spikes.

aof-rewrite-incremental-fsync yes

################################## INCLUDES ###################################

Include one or more other config files here. This is useful if you

have a standard template that goes to all Redis server but also need

to customize a few per-server settings. Include files can include

other files, so use this wisely.

#

include /path/to/local.conf

include /path/to/other.conf

  • 写回答

1条回答

  • zqbnqsdsmd 2016-11-30 04:30
    关注
    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!