Installation and configuration guide for the Redis database on the CentOS system
- 2020-05-12 06:25:23
- OfStack
1. Check the installation dependency program
yum install gcc-c++
yum install -y tcl
yum install wget
2. Get the installation files
wget http://download.redis.io/releases/redis-2.8.13.tar.gz
3. Unzip the file
tar -xzvf redis-2.8.19.tar.gz
mv redis-2.8.19 /usr/local/redis
4. Enter the directory
cd /usr/local/redis
5. Compile and install
make
make install
6. Set the profile path
mkdir -p /etc/redis
cp redis.conf/etc/redis
7. Modify the configuration file
vi /etc/redis/redis.conf
Only modify:
daemonize yes ( no-->yes )
8, start,
/usr/local/bin/redis-server /etc/redis/redis.conf
9. View startup
ps -ef | grep redis
10. Use the client
wget http://download.redis.io/releases/redis-2.8.13.tar.gz
0
11. Close the client
wget http://download.redis.io/releases/redis-2.8.13.tar.gz
1
12. Startup configuration
wget http://download.redis.io/releases/redis-2.8.13.tar.gz
2
PS: have redis run as a service
Following are the steps to configure redis as a service by first copying the utils/redis_init_script file under /etc/ init.d
cp /usr/local/redis-2.8.19/utils/redis_init_script /etc/rc.d/init.d/redis
Copies redis_init_script to/etc/rc d/init d /, renamed as redis at the same time
then
wget http://download.redis.io/releases/redis-2.8.13.tar.gz
4
Add in line 2 of the document
wget http://download.redis.io/releases/redis-2.8.13.tar.gz
5
Then pay attention to
wget http://download.redis.io/releases/redis-2.8.13.tar.gz
6
Since our installation directory is /usr/local/ redis-2.8.19, the above two lines are changed to
wget http://download.redis.io/releases/redis-2.8.13.tar.gz
7
Also note the redis file
$EXEC $CONF
Add & after CONF
wget http://download.redis.io/releases/redis-2.8.13.tar.gz
9
"&" means to move the service to a later stage. Otherwise, when the service is started, the Redis service will occupy the foreground and occupy the main user interface, so that other commands cannot be executed.
Can be seen in the/etc/init d/redis file, so line 1:
CONF="/etc/redis/${REDISPORT}.conf"
Copy the redis configuration file to /etc/redis/
mkdir /etc/redis
cp /usr/local/redis-2.8.19/redis.conf /etc/redis/6379.conf
After completing the above operation, you can register the service:
chkconfig --add redis
Then start the redis service
tar -xzvf redis-2.8.19.tar.gz
mv redis-2.8.19 /usr/local/redis
3
redis is ready to run as a service