CentOS 搭建Redis4 環境

下載

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

 

安裝步驟

tar xvf redis-4.0.10.tar.gz github

make redis

make install vim

which redis-cli app

 

配置文件

vi /etc/redis/6379.conf spa

參考 命令行

https://raw.githubusercontent.com/antirez/redis/4.0/redis.conf server

修改以下配置項: ip

dir /mnt/disk1/redis/6379 get

appendonly yes

daemonize yes

pidfile /var/run/redis_6379.pid

 

命令行啓動

redis-server /etc/redis/6379.conf

 

設置爲系統服務

vim /etc/systemd/system/redis-6379.service

 

代碼參考:

[Unit]

Description=The redis-server Process Manager

After=syslog.target network.target

 

[Service]

Type=forking

PIDFile=/var/run/redis_6379.pid

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

ExecReload=/bin/kill -USR2 $MAINPID

ExecStop=/bin/kill -SIGINT $MAINPID

 

[Install]

WantedBy=multi-user.target

 

系統服務命令

systemctl start redis-6379.service

systemctl stop redis-6379.service

systemctl enable redis-6379.service

相關文章
相關標籤/搜索