centos8 安装、配置redis6
一、安装
下载最新版本
cd /tmp
wget http://download.redis.io/releases/redis-6.0.8.tar.gz
解压
tar -zxvf redis-6.0.8.tar.gz
安装
cd redis-6.0.8
make && make install PREFIX=/usr/local/redis
二、配置
mkdir /usr/local/redis/conf.d
复制示例配置
cp redis.conf /usr/local/redis/conf.d
建立数据、日志存储目录
mkdir -p /var/redis/data
mkdir /var/redis/log
修改
vim /usr/local/redis/conf.d/redis.conf
daemonize yes 行225
supervised systemd 行236
修改存储规则 行~307
dir /var/redis/data/ 数据文件存储目录 行~365
logfile "/var/redis/log/redis.log" 日志存储文件 行 ~260
建立service文件,以便systemctl控制
cd /etc/systemd/system
touch redis.service
vim redis.service
[Unit] Description=RedisService After=network.target [Service] Type=forking PIDFile=/var/run/redis_6379.pid ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/conf.d/redis.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target
三、启动
systemctl enable redis
systemctl start redis
查看启动情况
systemctl status redis