Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of Redis configuration File Code

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article will explain in detail the sample analysis of the Redis configuration file code. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

Redis configuration file parsing is available on the Internet, so I won't repeat it here. Provide some parameters that are worth modifying, especially those marked in red, otherwise it is easy to have a master-slave synchronous dead cycle.

NETWORKbind 127.0.0.1 defaults to bind 127.0.0.1. Comment out protected-mode no default protected-mode yes and change it to noport 6379. It is recommended to modify it to avoid using the default port tcp-backlog 6379. It is recommended to increase the Linux kernel parameter / proc/sys/net/core/somaxconn to 2048GENERALlogfile at the same time. "it is recommended to modify the log path SNAPSHOTTINGsave 900 1save 300 10save 60 10000 to comment out these three lines of trigger rdb persistence. Turn on trigger persistence in high concurrency cases, it is easy to do save operation all the time dbfilename dump.rdb is modified according to the actual situation, it is recommended to modify to dump+ port. Rdbdir. / according to the actual situation, it is recommended to modify to and logfile, the configuration file in the same parent directory, such as / app/redis/ {conf,data,log} REPLICATIONreplica-read-only yes is recommended to be modified to no, when the master node fails, the slave node can be used immediately. Repl-timeout 60 is recommended to set longer to avoid full replication of large nodes in high concurrency cases. Repl-backlog-size 1mb is recommended to be set to 100mbreplication in 60 seconds, and to avoid full replication when generating rdb+ transfer rdb+ and loading rdb, the copy squeeze buffer of the primary node is not enough, which leads to full replication all the time. LAZY FREEING lazy deletion parameter. Enable the configuration item to avoid service blocking lazyfree-lazy-eviction yes expulsion policy lazy deletion caused by large key expiration deletion. It is recommended to enable lazyfree-lazy-expire yes expired key lazy deletion, lazyfree-lazy-server-del yes del operation lazy deletion, and replica-lazy-flush yes flush lazy deletion. It is recommended to enable APPEND ONLY MODEappendonly yes. It is recommended to enable appendfilename "appendonly.aof" from the node. According to the actual port modification, it is recommended to modify the appendonly+ port. Aofappendfsync always from the node is recommended to be modified to everysec, with a compromise persistence policy, which is persisted to aof once per second. Auto-aof-rewrite-percentage 100 is modified according to the actual situation to avoid the expansion of aof files by 100% at the business peak, triggering automatic aofrewrite operations. It is recommended to disable the master-slave replication buffer limit for blocking service ADVANCED CONFIGclient-output-buffer-limit replica 000, so as to avoid the failure of slave to complete full synchronization during the period of hard and soft limits. As a result, it is recommended to close the master-slave synchronization dead cycle ACTIVE DEFRAGMENTATIONactivedefrag no to avoid debris recovery during peak periods. When the fragmentation rate increases, it can be opened during the low peak period of the business.

Knowledge point expansion:

If you think Redis is a key value store, you can use it instead of MySQL;. If you think it is a persistent cache, you may just use it to store some frequently accessed temporary data (instead of Memcached); in addition, you can also use Redis as a lightweight message queue because it supports list data structures and PUB/SUB commands built-in; it can also be used as a lightweight distributed locking system. Redis is an acronym for REmote DIctionary Server, which Redis explains on its official website as:

Redis is an open source, advanced key-value store.

It is often referred to as a data structure server since keys

Can contain strings, hashes, lists, sets and sorted sets.

This is the end of this article on "sample Analysis of Redis profile Code". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report