当前位置: 移动技术网 > IT编程>软件设计>架构 > Centos7安装redis5.0.7

Centos7安装redis5.0.7

2019年11月25日  | 移动技术网IT编程  | 我要评论

1. 安装依赖包

yum install -y gcc gcc-c++

 

2. 下载最新版redis安装包并解压安装

cd /usr/local/src

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

tar -zxvf redis-5.0.7.tar.gz
make

make install

 

3.  打开 redis.conf 并更改配置文件

更改密码
# requirepass foobared
requirepass xxx

允许后台静默运行
#daemonize no
daemonize yes

更改日志文件
#logfile ""
logfile "/var/log/redis/6379.log"

 

4. 创建配置文件软链

ln -s /usr/local/src/redis-5.0.7/redis.conf /etc/redis/6379.conf

 

5. 增加启动服务脚本

新增配置文件
touch /usr/lib/systemd/system/redis.service redis.service内容如下: [unit] description=redis 6379 after=syslog.target network.target [service] type=forking privatetmp=yes restart=always execstart=/usr/local/bin/redis-server /etc/redis/redis.conf execstop=/usr/local/bin/redis-cli -h 127.0.0.1 -p 6379 -a jcon shutdown user=root group=root limitcore=infinity limitnofile=100000 limitnproc=100000 [install] wantedby=multi-user.target

重新加载redis服务配置文件
systemctl daemon-reload

启动redis
systemctl start redis
停止redis
systemctl stop redis
重启redis
systemctl restart redis
加入开机启动
systemctl enable redis
禁止开机启动
systemctl disable redis
查看状态
systemctl status redis



 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网