Redis installed on CentOS

First, the installation-dependent GCC

yum install -y gcc 

Second, download and unzip the installation package

wget http://download.redis.io/releases/redis-5.0.3.tar.gz

tar -zxvf redis-5.0.3.tar.gz

Third, the switch to the redis extracted directory, compile

cd-repeat 5.0.3

make

Fourth, the installation to specify the installation directory

make install PREFIX=/usr/local/redis

Fifth, copy directory, edit redis.conf file, modify the value daemonize background start

cp /usr/local/redis-5.0.3/redis.conf /usr/local/redis/bin/

force redis.conf

Sixth, set the boot

we /etc/systemd/system/redis.service

① the ExecStart configured their path

[Unit]

Description=redis-server

After=network.target

 

[Service]

Type=forking

ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/bin/redis.conf

PrivateTmp=true

 

[Install]

WantedBy=multi-user.target

② commonly used commands

systemctl start redis.service # start redis service

 

systemctl stop redis.service # stop redis service

 

systemctl restart redis.service # restart the service

 

systemctl status redis.service   #查看服务当前状态

 

systemctl enable redis.service   #设置开机自启动

 

systemctl disable redis.service   #停止开机自启动

七、设置远程连接

vim /usr/local/redis/bin/redis.conf bind 0.0.0.0

Guess you like

Origin www.cnblogs.com/wenha/p/12079198.html