redis配置详解(中英文)(4)

# 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.
#
# 如果master设置了密码保护(通过 "requirepass" 选项来配置),那么slave在开始同步之前必须
# 进行身份验证,否则它的同步请求会被拒绝。
# masterauth <master-password>

# 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失去和master的连接,或者同步正在进行中,slave的行为可以有两种:
#
# 1) 如果 slave-serve-stale-data 设置为 "yes" (默认值),slave会继续响应客户端请求,
# 可能是正常数据,或者是过时了的数据,也可能是还没获得值的空数据。
# 2) 如果 slave-serve-stale-data 设置为 "no",slave会回复"正在从master同步
# (SYNC with master in progress)"来处理各种请求,除了 INFO 和 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
# misconfiguration.
#
# Since Redis 2.6 by default slaves are read-only.
#
# Note: read only slaves are not designed to be exposed to untrusted clients
# on the internet. It's just a protection layer against miSUSE of the instance.
# Still a read only slave exports by default all the administrative commands
# such as CONFIG, DEBUG, and so forth. To a limited extent you can improve
# security of read only slaves using 'rename-command' to shadow all the
# administrative / dangerous commands.
#
# 你可以配置salve实例是否接受写操作。可写的slave实例可能对存储临时数据比较有用(因为写入salve
# 的数据在同master同步之后将很容被删除),但是如果客户端由于配置错误在写入时也可能产生一些问题。
#
# 从Redis2.6默认所有的slave为只读
#
# 注意:只读的slave不是为了暴露给互联网上不可信的客户端而设计的。它只是一个防止实例误用的保护层。
# 一个只读的slave支持所有的管理命令比如config,debug等。为了限制你可以用'rename-command'来
# 隐藏所有的管理和危险命令来增强只读slave的安全性
slave-read-only yes

# Replication SYNC strategy: disk or socket.
#
# -------------------------------------------------------
# WARNING: DISKLESS REPLICATION IS EXPERIMENTAL CURRENTLY
# -------------------------------------------------------
#
# New slaves and reconnecting slaves that are not able to continue the replication
# process just receiving differences, need to do what is called a "full
# synchronization". An RDB file is transmitted from the master to the slaves.
# The transmission can happen in two different ways:
#
# 1) Disk-backed: The Redis master creates a new process that writes the RDB
# file on disk. Later the file is transferred by the parent
# process to the slaves incrementally.
# 2) Diskless: The Redis master creates a new process that directly writes the
# RDB file to slave sockets, without touching the disk at all.
#
# With disk-backed replication, while the RDB file is generated, more slaves
# can be queued and served with the RDB file as soon as the current child producing
# the RDB file finishes its work. With diskless replication instead once
# the transfer starts, new slaves arriving will be queued and a new transfer
# will start when the current one terminates.
#
# When diskless replication is used, the master waits a configurable amount of
# time (in seconds) before starting the transfer in the hope that multiple slaves
# will arrive and the transfer can be parallelized.
#
# With slow disks and fast (large bandwidth) networks, diskless replication
# works better.
#
# 主从备份策略: 写磁盘方式或者写socket方式.
#
# -------------------------------------------------------
# 注意: 当前主从无磁盘备份还处于试验阶段
# -------------------------------------------------------
#
# 新的从redis或者那些不能进行部分同步备份的redis需要进行"全磁盘备份".
# 一个RDB文件会从主redis传输到从redis.
# 这个传输可以使用两种不同的策略:
#
# 1) 磁盘方式: 主redis会创建一个子进程进行写RDB文件到磁盘中,
# 之后这个文件会被父进程传送给从redis.
# 2) 无磁盘方式: 主redis会创建一个子进程进行直接将RDB文件通过socket传送给从redis
# 而无需使用到磁盘.
#
# 使用磁盘主从备份的方式, 当这个RDB文件产生之后, 多个从redis可以进行排队等待当前子进程
# 完成这个RDB文件的写工作后进行同步。
# 使用无磁盘主从备份的方式,一旦这个传输已经开始,那么新连接进来的从redis需要等待新的一次
# 全新的传输,这个需要等待上一次传输的完成。
#
# 当采用无磁盘备份的方式之后, 主redis会等待一定的时间之后才会开始传输, 以便尽可能多的
# 对多个从redis进行同时备份,即平衡备份。这个时间可以在这里配置,单位为秒。
# 即配置 repl-diskless-sync-delay x
#
# 对于磁盘比较慢的而且带宽比较大的环境下,无磁盘主从备份会工作得更好。

repl-diskless-sync no

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/7014cdb75c0f80fd240c5e6b9af887eb.html