In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the relevant knowledge of CentOS7 how to install and configure Redis, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will have something to gain after reading this CentOS7 how to install and configure Redis. Let's take a look.
Installation
Decompress and enter the directory tar xzf redis-4.0.12.tar.gz and cd redis-4.0.12/
Compile to the specified directory make prefix=/usr/local/redis install to create / usr/local/redis/ect directory, copy the redis.conf over
The / usr/local/redis directory structure is as follows
Add redis to the system service and execute vim / usr/lib/systemd/system/redis-server.service, as follows
[unit] description=the redis-server process managerafter=syslog.target network.target [service] type=simplepidfile=/var/run/redis.pidexecstart=/usr/local/redis/bin/redis-server / usr/local/redis/etc/redis.confexecreload=/bin/kill-s hup $mainpidexecstop=/bin/kill-s quit $mainpid [install] wantedby=multi-user.target
Enable the service systemctl start redis-server
Set to boot boot systemctl enable redis-server
Test, use redis-cli test to take a look
Modify redis configuration
Modify the data save path, create a new / usr/local/redis/data directory, and set dir to this path
Rdb and aof persistence
The default rdb is save 9001 save 300 10 save 60 10000, that is, 1 change in 900 seconds, 10 changes in 300 seconds, and 10000 changes in 60 seconds. Any of the above conditions can be met and the default value is used.
Aof is turned off by default, so change appendonly to yes. There are three options for update conditions. Always means to manually call fsync () after each update operation to write data to disk (slow, secure), everysec means to synchronize once per second (eclectic, default), no indicates that operating systems such as data cache are synchronized to disk (fast), and the default value is fine.
Both can be used at the same time, and other related configurations use the default values.
Modify data elimination strategy
The maximum memory usage maxmemory is annotated by default, set to 512m. Note that the unit is bytes, so the value is 536870912.
Redis provides a total of six data elimination strategies after exceeding the value, which are
Volatile-lru: select the most recently unused data release from the dataset with the expiration time set
Allkeys-lru: select the most recently unused data release from the dataset (including datasets that set expiration time and those that do not set expiration time)
Volatile-random: from a dataset with an expiration time set, randomly select a data to release
Allkeys-random: randomly select a data from the dataset (including setting expiration time and not setting expiration time) to enter and release
Volatile-ttl: from the dataset with the expiration time set, select the data that is about to expire to release.
Noeviction: no data is deleted (but redis will also release it based on the reference counter), and an error will be returned directly if there is not enough memory.
Here set maxmemory-policy to volatile-lru.
Other configurations will remain at default values and will be modified later as required. Remember to restart the service systemctl restart redis-server after the modification is completed.
This is the end of the article on "how to install and configure Redis for CentOS7". Thank you for reading! I believe you all have a certain understanding of "how to install and configure Redis in CentOS7". If you want to learn more, you are welcome to follow the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.