Docker常用软件安装之Redis,java核心技术卷电子版

Creating a pid file is best effort: if Redis is not able to create it

nothing bad happens, the server will start and run normally.

pidfile /var/run/redis_6379.pid

Specify the server verbosity level.

This can be one of:

debug (a lot of information, useful for development/testing)

verbose (many rarely useful info, but not a mess like the debug level)

notice (moderately verbose, what you want in production probably)

warning (only very important / critical messages are logged)

loglevel notice

Specify the log file name. Also the empty string can be used to force

Redis to log on the standard output. Note that if you use standard

output for logging but daemonize, logs will be sent to /dev/null

logfile “”

To enable logging to the system logger, just set ‘syslog-enabled’ to yes,

and optionally update the other syslog parameters to suit your needs.

syslog-enabled no

Specify the syslog identity.

syslog-ident redis

Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7.

syslog-facility local0

Set the number of databases. The default database is DB 0, you can select

a different one on a per-connection basis using SELECT where

dbid is a number between 0 and ‘databases’-1

databases 16

################################ SNAPSHOTTING ################################

Save the DB on disk:

save

Will save the DB if both the given number of seconds and the given

number of write operations against the DB occurred.

In the example below the behaviour will be to save:

after 900 sec (15 min) if at least 1 key changed

after 300 sec (5 min) if at least 10 keys changed

after 60 sec if at least 10000 keys changed

Note: you can disable saving completely by commenting out all “save” lines.

It is also possible to remove all the previously configured save

points by adding a save directive with a single empty string argument

like in the following example:

save “”

save 120 1

save 300 10

save 60 10000

By default Redis will stop accepting writes if RDB snapshots are enabled

(at least one save point) and the latest background save failed.

This will make the user aware (in a hard way) that data is not persisting

on disk properly, otherwise chances are that no one will notice and some

disaster will happen.

If the background saving process will start working again Redis will

automatically allow writes again.

However if you have setup your proper monitoring of the Redis server

and persistence, you may want to disable this feature so that Redis will

continue to work as usual even if there are problems with disk,

permissions, and so forth.

stop-writes-on-bgsave-error yes

Compress string objects using LZF when dump .rdb databases?

For default that’s set to ‘yes’ as it’s almost always a win.

If you want to save some CPU in the saving child set it to ‘no’ but

the dataset will likely be bigger if you have compressible values or keys.

rdbcompression yes

Since version 5 of RDB a CRC64 checksum is placed at the end of the file.

This makes the format more r

《一线大厂Java面试题解析+后端开发学习笔记+最新架构讲解视频+实战项目源码讲义》

【docs.qq.com/doc/DSmxTbFJ1cmN1R2dB】 完整内容开源分享

esistant to corruption but there is a performance

hit to pay (around 10%) when saving and loading RDB files, so you can disable it

for maximum performances.

RDB files created with checksum disabled have a checksum of zero that will

tell the loading code to skip the check.

rdbchecksum yes

The filename where to dump the DB

dbfilename dump.rdb

The working directory.

The DB will be written inside this directory, with the filename specified

above using the ‘dbfilename’ configuration directive.

The Append Only File will also be created inside this directory.

Note that you must specify a directory here, not a file name.

dir ./

################################# REPLICATION #################################

Master-Slave replication. Use slaveof to make a Redis instance a copy of

another Redis server. A few things to understand ASAP about Redis replication.

1) Redis replication is asynchronous, but you can configure a master to

stop accepting writes if it appears to be not connected with at least

a given number of slaves.

2) Redis slaves are able to perform a partial resynchronization with the

master if the replication link is lost for a relatively small amount of

time. You may want to configure the replication backlog size (see the next

sections of this file) with a sensible value depending on your needs.

3) Replication is automatic and does not need user intervention. After a

network partition slaves automatically try to reconnect to masters

and resynchronize with them.

slaveof

If the master is password protected (using the “requirepass” configuration

directive below) it is possible to tell the slave to authenticate before

starting the replication synchronization process, otherwise the master will

refuse the slave request.

masterauth

When a slave loses its connection with the master, or when the replication

is still in progress, the slave can act in two different ways:

1) if slave-serve-stale-data is set to ‘yes’ (the default) the slave will

still reply to client requests, possibly with out of date data, or the

data set may just be empty if this is the first synchronization.

2) if slave-serve-stale-data is set to ‘no’ the slave will reply with

an error “SYNC with master in progress” to all the kind of commands

but to INFO and SLAVEOF.

slave-serve-stale-data yes

You can configure a slave instance to accept writes or not. Writing against

a slave instance may be useful to store some ephemeral data (because data

written on a slave will be easily deleted after resync with the master) but

may also cause problems if clients are writing to it because of a

misconfigura

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值