当前位置: 首页 > news >正文

中国建设网官方网站硅灰青海玉树网站建设

中国建设网官方网站硅灰,青海玉树网站建设,网络推广app是违法的吗,龙岩网站推广软件文章目录 一、RDB (Redis Database)1.1 RDB 优势1.2 RDB 缺点1.3 RDB 如何工作1.4 RDB配置1.5 开启/关闭#xff0c;RDB快照策略#xff0c;save指令1.6 持久化硬盘文件#xff0c;dbfilename指令1.7 持久化硬盘文件的存储地址#xff0c;dir指令 二、AOF (Append Only Fil… 文章目录 一、RDB (Redis Database)1.1 RDB 优势1.2 RDB 缺点1.3 RDB 如何工作1.4 RDB配置1.5 开启/关闭RDB快照策略save指令1.6 持久化硬盘文件dbfilename指令1.7 持久化硬盘文件的存储地址dir指令 二、AOF (Append Only File)2.1 AOF 优势2.2 AOF 缺点2.3 AOF 如何工作2.4 AOF配置2.5 开启/关闭appendonly指令2.6 AOF文件appendfilename指令2.7 AOF文件目录dir指令2.8 AOF追加策略appendfsync指令2.9 AOF写入被意外中断数据也能恢复到上一句命令可靠性高 三、No persistence 禁用持久化四、RDB 和 AOF 能否同时开启五、如何选择 RDB 和 AOF六、官方文档 持久化是指将Redis内存中的数据写入磁盘当遇到重启Redis或重启服务器时再将磁盘上的数据恢复到内存中 Redis持久化选项有4种 RDB (Redis Database) 以指定的时间间隔进行数据的快照备份。 AOF (Append Only File) 记录更改数据的命令例如SET, 然后在重启时再次执行这些命令从而恢复数据。 RDB AOF 组合使用 No persistence 禁用持久化 一、RDB (Redis Database) RDB开启后Redis 可以自动创建某个时间点的快照以便重启的时候将快照中的数据恢复在内存中。 1.1 RDB 优势 以快照的形式备份非常适合灾难后进行数据的恢复大数据时更快地重新启动。因为是以时间节点的形式备份节省了资源也最大限度地提高了Redis的性能。 1.2 RDB 缺点 因为是以快照的形式备份会阻塞线程来保证数据完整性当遇到大数据时阻塞时间会被放大。以时间节点的形式处理服务停止工作时可能还没到达时间点会导致部分数据丢失只能恢复到上一个时间节点上。Redis运行时手动复制RDB文件是安全的那怕Redis正在写入临时RDB文件原始的RDB文件也是完整的。每个时刻RDB文件会有一份可以创建cron任务备份RDB文件。记录不同时刻的RDB文件。 1.3 RDB 如何工作 达到配置中save指令条件时子进程将内存中的数据集写入临时RDB文件再进行原子替换操作替换旧的RDB文件。 此时RDB文件只会有一份。 1.4 RDB配置 以windows版为例 在redis.conf中 redis.windows-service.conf 和 redis.windows.conf redis.windows-service.conf 旨在作为服务/守护进程运行。这意味着它应该在后台运行并由操作系统管理(重启时启动崩溃时重新启动等)。 redis.windows.conf 旨在从命令行或脚本运行并在用户空间中进行管理。 两个配置文件基本相同更细的区别不再赘述。 在windows服务管理中启用、停用redis服务仅修改redis.windows-service.conf配置即可 ################################ SNAPSHOTTING ################################ # # Save the DB on disk: # # save seconds changes # # 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 900 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 thats set to yes as its 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 resistant 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 ./ 1.5 开启/关闭RDB快照策略save指令 # 900秒15分钟后如果至少有一个按键发生变化 save 900 1 # 300秒5分钟后如果至少有10个按键发生变化 save 300 10 # 60秒后如果至少有10000个密钥发生更改 save 60 10000 注释或删除掉所有策略就可以禁用RDB模式添加自定义策略只需要满足save指令规则即可 1.6 持久化硬盘文件dbfilename指令 dbfilename dump.rdb指定了文件的名称、扩展名dump.rdb是一个的二进制文件 1.7 持久化硬盘文件的存储地址dir指令 dir ./默认是当前安装目录下 AOF和RDB模式使用了这个公共配置项如果修改RDB和AOF都受影响 二、AOF (Append Only File) 2.1 AOF 优势 持久化的同步有不同的策略fsync策略参照后面文章可以自行灵活配置即使由于某种原因磁盘已满或其他原因AOF文件中存在不完整命令redis check aof工具也能很容易地修复它。AOF文件过大时文件会被拆分和重写用当前数据集所需的最小操作命令集生成一个全新的AOF文件再进行原子替换操作切换新旧AOF文件 2.2 AOF 缺点 AOF文件通常比RDB文件大因为RDB是时间点的数据快照AOF是整个数据变动过程的完整命令。AOF重写过程时, 可能会占用更多内存, 先缓冲在内存中并在最后写入新的AOF 2.3 AOF 如何工作 Redis 收到更改数据集的命令(例如SET)时将该命令写入到缓冲区最后依据fsync策略从缓冲区再追加AOF文件中。需要恢复时执行中AOF文件中命令即可。 Redis 7.0.0以后AOF文件过大时原始的单个AOF文件被拆分为基本文件最多一个和增量文件可能有多个 2.4 AOF配置 以windows版为例 在redis.conf中 redis.windows-service.conf 和 redis.windows.conf redis.windows-service.conf 旨在作为服务/守护进程运行。这意味着它应该在后台运行并由操作系统管理(重启时启动崩溃时重新启动等)。 redis.windows.conf 旨在从命令行或脚本运行并在用户空间中进行管理。 两个配置文件基本相同更细的区别不再赘述。 在windows服务管理中启用、停用redis服务仅修改redis.windows-service.conf配置即可 ############################## APPEND ONLY MODE ################################ By default Redis asynchronously dumps the dataset on disk. This mode is # good enough in many applications, but an issue with the Redis process or # a power outage may result into a few minutes of writes lost (depending on # the configured save points). # # The Append Only File is an alternative persistence mode that provides # much better durability. For instance using the default data fsync policy # (see later in the config file) Redis can lose just one second of writes in a # dramatic event like a server power outage, or a single write if something # wrong with the Redis process itself happens, but the operating system is # still running correctly. # # AOF and RDB persistence can be enabled at the same time without problems. # If the AOF is enabled on startup Redis will load the AOF, that is the file # with the better durability guarantees. # # Please check http://redis.io/topics/persistence for more information.appendonly no# The name of the append only file (default: appendonly.aof) appendfilename appendonly.aof# The fsync() call tells the Operating System to actually write data on disk # instead of waiting for more data in the output buffer. Some OS will really flush # data on disk, some other OS will just try to do it ASAP. # # Redis supports three different modes: # # no: dont fsync, just let the OS flush the data when it wants. Faster. # always: fsync after every write to the append only log. Slow, Safest. # everysec: fsync only one time every second. Compromise. # # The default is everysec, as thats usually the right compromise between # speed and data safety. Its up to you to understand if you can relax this to # no that will let the operating system flush the output buffer when # it wants, for better performances (but if you can live with the idea of # some data loss consider the default persistence mode thats snapshotting), # or on the contrary, use always thats very slow but a bit safer than # everysec. # # More details please check the following article: # http://antirez.com/post/redis-persistence-demystified.html # # If unsure, use everysec.# appendfsync always appendfsync everysec # appendfsync no# When the AOF fsync policy is set to always or everysec, and a background # saving process (a background save or AOF log background rewriting) is # performing a lot of I/O against the disk, in some Linux configurations # Redis may block too long on the fsync() call. Note that there is no fix for # this currently, as even performing fsync in a different thread will block # our synchronous write(2) call. # # In order to mitigate this problem its possible to use the following option # that will prevent fsync() from being called in the main process while a # BGSAVE or BGREWRITEAOF is in progress. # # This means that while another child is saving, the durability of Redis is # the same as appendfsync none. In practical terms, this means that it is # possible to lose up to 30 seconds of log in the worst scenario (with the # default Linux settings). # # If you have latency problems turn this to yes. Otherwise leave it as # no that is the safest pick from the point of view of durability. no-appendfsync-on-rewrite no# Automatic rewrite of the append only file. # Redis is able to automatically rewrite the log file implicitly calling # BGREWRITEAOF when the AOF log size grows by the specified percentage. # # This is how it works: Redis remembers the size of the AOF file after the # latest rewrite (if no rewrite has happened since the restart, the size of # the AOF at startup is used). # # This base size is compared to the current size. If the current size is # bigger than the specified percentage, the rewrite is triggered. Also # you need to specify a minimal size for the AOF file to be rewritten, this # is useful to avoid rewriting the AOF file even if the percentage increase # is reached but it is still pretty small. # # Specify a percentage of zero in order to disable the automatic AOF # rewrite feature.auto-aof-rewrite-percentage 100 auto-aof-rewrite-min-size 64mb# An AOF file may be found to be truncated at the end during the Redis # startup process, when the AOF data gets loaded back into memory. # This may happen when the system where Redis is running # crashes, especially when an ext4 filesystem is mounted without the # dataordered option (however this cant happen when Redis itself # crashes or aborts but the operating system still works correctly). # # Redis can either exit with an error when this happens, or load as much # data as possible (the default now) and start if the AOF file is found # to be truncated at the end. The following option controls this behavior. # # If aof-load-truncated is set to yes, a truncated AOF file is loaded and # the Redis server starts emitting a log to inform the user of the event. # Otherwise if the option is set to no, the server aborts with an error # and refuses to start. When the option is set to no, the user requires # to fix the AOF file using the redis-check-aof utility before to restart # the server. # # Note that if the AOF file will be found to be corrupted in the middle # the server will still exit with an error. This option only applies when # Redis will try to read more data from the AOF file but not enough bytes # will be found. aof-load-truncated yes 2.5 开启/关闭appendonly指令 默认情况下 Redis 没有开启 AOFRedis 6.0 之后已经默认是开启了 通过 appendonly 参数开启yes/no 开启/关闭 appendonly yes2.6 AOF文件appendfilename指令 appendfilename appendonly.aof2.7 AOF文件目录dir指令 dir ./默认是当前安装目录下 AOF和RDB模式使用了这个公共配置项如果修改RDB和AOF都受影响 2.8 AOF追加策略appendfsync指令 appendfsync everysec # appendfsync always # appendfsync no everysec 默认值, 后台线程每秒主动同步一次将缓冲区数据写入到aof文件性能和数据一致性的折中方案。 always 每次缓冲区有更改数据集的命令时直接写入AOF文件性能差一点但数据一致性更高。 no 不主动进行写入到aof文件等待操作系统刷新数据数据一致比较差性能更好Linux 下一般为 30 秒一次。 2.9 AOF写入被意外中断数据也能恢复到上一句命令可靠性高 当写入AOF文件时redis或服务器发生故障可能导致命令写入了一半命令不完整当服务恢复时redis能自己检测出来异常的命令将其截断然后将数据恢复到上一个命令记录的时刻可能最多损失1秒的数据配置是 appendfsync everysec * Reading RDB preamble from AOF file... * Reading the remaining AOF tail... # !!! Warning: short read while loading the AOF file !!! # !!! Truncating the AOF at offset 439 !!! # AOF loaded anyway because aof-load-truncated is enabled三、No persistence 禁用持久化 在上面文章中已经讲述到了RDB、AOF的开启关闭 将RDB、AOF都关闭其实就是不使用持久化。 关闭后redis对于数据的操作不会被同步到RDB、AOF文件 关闭后重启服务后也不会从RDB、AOF文件恢复数据所以重启服务后redis没有数据。 关闭后向redis写入key-val数据如果重启服务redis就回丢失数据 如果再次开启RDB、AOF模式重启服务后会再次加载RDB、AOF文件中的数据。 四、RDB 和 AOF 能否同时开启 AOF和RDB可以同时启用 AOF文件将优先使用因为它保证是最完整的 五、如何选择 RDB 和 AOF 个人理解RDB是必须要开启的Redis默认也是开启的 简单的快照是一个有效的恢复手段哪怕中间有小部分数据丢失。 普通场景, 能承受一定的数据丢失可能只开启RDB即可。 数据安全性要求高的场景可能需要RDB和AOF同时开启 任何时候都应该再借助数据库mqsql、 sql server进行持久化做最后一道防线。 六、官方文档 https://redis.io/docs/management/persistence/
http://www.tj-hxxt.cn/news/138081.html

相关文章:

  • iss服务器网站建设网站开发近期市场
  • 做网站详情的图片公众号排版编辑器app
  • 山东省住房城乡建设厅网站做布料的著名网站
  • 青海建设厅网站特种作业做网站赚不到钱了
  • 企业门户网站案例企业名录搜索软件带名字
  • 有公网ip 如何做一网站中国建设银行网站首页joy
  • 淘宝网站开发的意义google企业网站seo
  • 做商演任务的网站安徽万振建设集团网站
  • 羽贝网站建设googleplay官方下载
  • 招商加盟的网站应该怎么做网站开发struts
  • 平面设计的网站有哪些成都vi设计十强
  • 网站开发维护运维扬州网站建设价格低
  • 购物网站的文化建设问题承德市外贸网站建设
  • 关于网站建设的技巧网络营销有什么作用
  • 物流网站毕业设计php做大型网站
  • 帝国做企业网站海口cms建站系统
  • 公司网站建站哪个系统好用云匠网app
  • 网站页面做静安网站开发
  • 做网站准备什么问题泉州做网站工作室
  • 幸运飞艇网站建设济南设计公司招聘信息
  • 集约化网站建设用php做网站出现的问题
  • 设计实例网站交互式网站开发技术
  • 太原建设北路小学网站宁夏建设造价网站
  • 宝塔服务器搭建网站教程生态旅游网站的建设的内容
  • 专业电商网站建设哪家好找培训班一般在什么平台
  • 大连网站建设方法一个云主机 多个网站
  • 定制开发电商网站建设代理记账如何获取客户
  • 做网站的收获及感想深圳福田中学
  • 网站制作培训多少钱泰安网站建设总结
  • 高端html5网站建设辽宁省住房和城乡建设厅