下载
wget http://download.redis.io/releases/redis-4.0.10.tar.gz
安装步骤
tar xvf redis-4.0.10.tar.gz
make
make install
which redis-cli
配置文件
vi /etc/redis/6379.conf
参考
https://raw.githubusercontent.com/antirez/redis/4.0/redis.conf
修改如下配置项:
dir /mnt/disk1/redis/6379
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