参考网址:
https://blog.csdn.net/weixin_43260474/article/details/106003751?fps=1&locationNum=2
上一篇文章:https://www.144d.com/post-673.html
已经描述了安装过程里面遇到的问题,并已解决,表示安装成功。
以下步骤开始配置:
执行网上教程最多的命令:
./utils/install_server.sh
Welcome to the redis service installer
This script will help you easily set up a running redis server
This systems seems to use systemd.
Please take a look at the provided example service unit files in this directory, and adapt and install them. Sorry!
1、拷贝conf配置文件,在redis的目录下有一个redis.conf文件,拷贝至/etc/redis目录下,没有则需要创建目录
cp redis.conf /etc/redis/6379.conf
vi /etc/redis/6379.conf
#下面要是改的参数 可以通过vim的/查找
port 6379
daemonize yes
pidfile /var/run/redis_6379.pid
logfile "/var/log/redis_6379.log"
#这个是redis数据持久化存放的地方
dir /var/lib/redis/6379
mkdir /var/lib/redis/6379
vim /usr/lib/systemd/system/redis_6379.service
[Unit]
Description=redis_6379
After=network.target
[Service]
Type=forking
#pid文件路径,这个要和redis.conf文件的一致
PIDFile=/var/run/redis_6379.pid
#这就是执行命令 前面为redis-server所在路径 后一个为刚配置的conf文件
ExecStart=/usr/local/bin/redis-server /etc/redis/6379.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
systemctl start redis_6379
systemctl enable redis_6379
#看端口占用
netstat -lnp|grep 6379
#看服务启动状态
systemctl status redis_6379