标签:redis star cte 设置 ystemd stop centos 密码 cli
1.https://redis.io/download 下载安装包上传到服务器
2.解压到目录
tar -zxvf redis-5.0.7.tar.gz -C /opt/
3.编译
cd /opt/redis-5.0.7
make
4.安装
cd src
make install PREFIX=/opt/redis
5.拷贝配置文件
mkdir /opt/redis/conf
cp /opt/redis-5.0.7/redis.conf /opt/redis/conf
6.修改配置文件
bind 127.0.0.1 加#注释掉,允许远程访问
protected-mode yes 修改为 no 允许远程访问
daemonize no 修改为 yes 后台运行
requirepass 123456 设置密码
7.启动测试
systemctl start redis.service
cd /opt/redis/bin
./redis-cli
auth 123456
set username chenwei
get username
8.设置开机自启
cd /lib/systemd/system
touch redis.service
chmod 755 redis.service
参考以下内容修改
[Unit]
Description=Redis Server Manager
After=syslog.target network.target
[Service]
Type=forking
PIDFile=/var/run/redis_6379.pid
ExecStart=/opt/redis/bin/redis-server /opt/redis/conf/redis.conf
ExecReload=/bin/kill -USR2 $MAINPID
ExecStop=/bin/kill -SIGINT $MAINPID
[Install]
WantedBy=multi-user.target
重载
systemctl daemon-reload
设置重启
systemctl enable redis.service
标签:redis star cte 设置 ystemd stop centos 密码 cli
原文地址:https://www.cnblogs.com/jenkins/p/12228577.html