In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly shows you "how to install redis-4.0.1 under CentOS", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "how to install redis-4.0.1 under CentOS" this article.
1. Download Redis
Download the latest Linux version of Redis, I use redis-4.0.1.tar.gz. Baidu cloud disk link: https://pan.baidu.com/s/1bo5UOUV password: iofs
2. Compilation
Redis is installed through source code, so we need to install the gcc compiler first, as well as the tcl package on which redis depends
Yum install gcc tcl
Downloading installation package
Installation completed
3. Create an installation directory
Mkdir redis
4. Upload and decompress
Upload the downloaded redis to the new directory, and then decompress it
Tar-xzvf redis-4.0.1.tar.gz
5. Specify the installation directory
Use PREFIX to specify the redis installation directory, make PREFIX=/home/diweikang/redis/ install
After the installation is complete, you can see that there is a bin directory in the / home/diweikang/redis directory, and in the bin directory is the redis command script
6. Configure redis as a service
Following the above steps, the startup script for redis is: / home/diweikang/redis/redis-4.0.1/utils/redis_init_script
Copy the startup script to the / etc/rc.d/init.d/ directory and name it redis
Cp / home/diweikang/redis/redis-4.0.1/utils/redis_init_script / etc/rc.d/init.d/redis
Edit the / etc/rc.d/init.d/redis file and modify the configuration so that it can be registered as a service
Vi / etc/rc.d/init.d/redis
(1) add a line after the first line of the monitor: # chkconfig: 2345 8090 if it is not added, it will prompt: service redis does not support chkconfig when registering the service
(2) the REDISPORT port remains unchanged at 6379 (note that the port name will be related to the following configuration file name)
(3) change EXEC to / home/diweikang/redis/bin/redis-server
(4) change CLIEXEC to / home/diweikang/redis/bin/redis-cli
(5) configuration file settings
Create the redis profile directory mkdir conf
Copy the redis configuration file / home/diweikang/redis/redis-4.0.1/redis.conf to the directory / home/diweikang/redis/conf and name it 6379.conf after the port number
Cp / home/diweikang/redis/redis-4.0.1/redis.conf / home/diweikang/redis/conf/6379.conf
After making the above preparations, make the following adjustments to the CONF property
CONF changed to / home/diweikang/redis/conf/$ {REDISPORT} .conf
(6) change the command opened by redis and execute it in the background.
$EXEC $CONF &
The function of & is to transfer the service to the background
The content of the modified service script is
7. Register redis as a service
Chkconfig-add redis
8. The firewall opens the corresponding port
Vi / etc/sysconfig/iptables
Restart Firewall service iptables restart
9. Modify redis configuration file 6379.conf
Change daemonize no to daemonize yes
Change pidfile / var/run/redis.pid to pidfile / var/run/redis_6379.pid
Comment out the bound host, otherwise the client cannot connect to # bind 127.0.0.1
Change protected-mode yes to protected-mode no
10. Start the redis service
Service redis start
11. Add redis to the environment variable
Vi / etc/profile
Make the configuration effective
Source / etc/profile
12. Verification
Use redis-cli to send commands.
The above is all the contents of the article "how to install redis-4.0.1 under CentOS". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, 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.