redis ++: Redis in aof backup policy configuration parameters

 When using redis, will configure the appropriate storage strategy to ensure redis and not due to accidental hang up, the data will not disappear in a short time restart.

In the current version, it redis provided bgsave and aof two strategies, this paper describes aof the relevant parameters and why this is safe enough.

appendonly:

  Open aof properties, aof this control is enabled.

appendfilename:

  File name written to the file. After the open aof, each command (command other than read), will be written to a file, the file that is actually written here.

appendfsync:

  Write strategy, the default value everysec, write once per second (call flush).

  The other two values, always | no, respectively, each outside redis write command to write the file, and guaranteed by the operating system.

  always the hard pressure, everysec is a balance, no minimum pressure on the hard drive, but by the scheduling control system, the greatest risk of losing data.

no-appendfsync-on-rewrite:

  With a single write whether written in the background, the default value no (expressed the need for synchronization). Here's the background to write, represent the background is rewriting files (including bgsave and bgrewriteaof.bgrewriteaof lot of information online are not covered after the fact to turn off bgsave, that is aof major rewrite files).

  no new operation represents a set of master process will be blocked off, but yes to set the new primary process will not be blocked until after the completion of the whole background to write this part of the set and then synchronized to the operation aof file. But there may be a risk of data loss (the probability is very small),

  If required, the performance can be set to yes, only the asynchronous processing commands written in the background.

auto-aof-rewrite-percentage:

  aof file growth percentage refers to the ratio of the size of the current growth aof file than the last rewritten.

  aof aof rewrite that after a certain file size, re-write the entire memory among aof file to reflect the latest state (equivalent to bgsave).

  This avoids, aof file is too large and small real memory data problem (frequent changes of data problems).

auto-aof-rewrite-min-size:

  aof file rewrite the smallest file size, that is only the beginning aof file must be met to trigger this document, the latter will not be rewritten each time according to the variables (depending on the size since the last complete rewrite).

  This variable is initialized to start redis only valid if the recovery is redis, the lastSize equal to the initial aof file size.

aof-load-truncated:

  It refers to the redis when restored, will ignore the last instruction with potential problems.

  The default value is yes. That is, when aof written, there may be a problem of wrong instructions (sudden power outages, half-written), in which case, yes, and will continue to log, but no direct recovery will fail.

Linux kernel parameters:

  Further, a parameter associated with the linux kernel that is rewritten aof overcommit_memory.

  That is during the rewrite, how the distribution of child process memory.

  (Rewriting is rewriting the background, the child will be assigned). The default value is 0, the establishment is set to 1, in order to ensure the success of the child process can allocate memory (ie using copyOnWrite memory allocation strategy, and the main process will be used when there is no set command with a memory), and it does not judge the adequacy of current memory.

 

Guess you like

Origin www.cnblogs.com/codingmode/p/12632717.html