This article is a mirror article of machine translation, please click here to jump to the original article.

View: 11092|Reply: 3

[linux] CentOS installed Redis 4.0.8

[Copy link]
Posted on 3/23/2018 2:20:49 PM | | |
Redis official website download address: https://redis.io/download, latest version: 4.0.8, as shown below:


The installation steps are as follows:

--1. Download
wget http://download.redis.io/releases/redis-4.0.8.tar.gz
(If you are a command-line version of CentOS, you need to install the C language environment using the following command.) yum install gcc-c++  )

--2. Unzip the installation package and install it (directory/root/pack/redis-4.0.8)
tar -xf redis-4.0.8.tar.gz
cd redis-4.0.8
make
make install

--3. Create a redis configuration folder and storage folder
mkdir -p /etc/redis
mkdir -p /var/redis/6379

--4. Copy the configuration file
cp /root/pack/redis-4.0.8/redis.conf /etc/redis/6379.conf

--5. Modify the 6379.conf configuration file
daemonize to yes
dir repair car completion/var/redis/6379
Comment out bind 127.0.0.1
Open RequirePass and set the password to xxxxxx

--6. Copy the startup script file
cp /root/pack/redis-4.0.8/utils/redis_init_script /etc/init.d/redis_6379


--7. You can now use the following commands to start and close Redis
/etc/init.d/redis_6379 start
/etc/init.d/redis_6379 stop

--8. After setting the password, use /etc/init.d/redis_6379 stop to solve the invalid solution
stop) item to add the password -a xxxxxx


--9. Let Redis start automatically with the system
This also requires a simple modification of the Redis initialization script, adding the following two sentences to the position of the fourth line at the head of the opened redis initialization script file:
# chkconfig: 2345 90 10
# description: Redis is a persistent key-value database



In the red box in the picture above, there are two additional lines of comments, and after adding, save it, and you can add Redis to the system startup item through the following command

--10. Set the boot to execute the redis script
chkconfig redis_6379 on

--After passing the above operations, you can also directly use the following commands to start and close Redis in the future, as follows




Stop Redis

Considering that Redis may be syncing data in memory to the hard drive, forcibly killing the Redis process can result in data loss. The correct way to stop Redis should be to send a SHUTDOWN command to Redis, which is:

redis-cli SHUTDOWN
When Redis receives the SHUTDOWN command, it will first disconnect all clients, then perform persistence according to the configuration, and finally complete the exit.
Redis can handle SIGTERM signals properly, so PIDs using the kill Redis process can also terminate Redis normally, just like sending a SHUTDOWN command.


Finally, attach the 6379.conf and redis_6379 configuration file:

The 6379.conf file is as follows:



redis_6379 profile:







Previous:CentOS views all running service IP and port information
Next:ActiveMQ5.15.3 fails to start, and UnsupportedClassVersionError is reported
 Landlord| Posted on 3/23/2018 2:28:51 PM |


I use the redis client of window to test the server side connected to redis:



The test results are as follows:


Posted on 3/25/2018 1:09:03 AM |
I installed it with one click with the pagoda
Posted on 3/25/2018 11:26:11 PM |
Prompt:Authors are banned or removed content is automatically blocked
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com