运维开发网

Centos8 安装redis6.2.1 记录(编译安装)

运维开发网 https://www.qedev.com 2021-04-08 12:32 出处:51CTO 作者:iiooppjj
centos8 redis
OS:CentOS Linux release 8.2.2004 (Core)
Redis server v=6.2.1

1.下载并解压安装包(官方网址:https://redis.io/)

#cd /tmp/
#wget http://download.redis.io/releases/redis-6.2.1.tar.gz
#tar xvf redis-6.2.1.tar.gz

2.编译前准备

# yum install gcc tcl

3.编译

# cd /tmp/redis-6.2.1
# make test

4.准备启动目录并拷贝相关文件

# mkdir -p /usr/bin/redis6/bin
# mkdir -p /usr/bin/redis6/conf
# cp /tmp/redis-6.2.1/src/redis-cli /usr/bin/redis6/bin/
# cp /tmp/redis-6.2.1/src/redis-server /usr/bin/redis6/bin
# cp /tmp/redis-6.2.1/redis.conf /usr/bin/redis6/conf/

5.修改配置文件

# vi /usr/bin/redis6/conf/redis.conf
设置以下两个地方:

#daemonize no
daemonize yes

#maxmemory <bytes>
maxmemory 1024MB 
tips:分别是以daemon方式独立运行及内存的最大使用限制

6.测试运行

# /usr/bin/redis6/bin/redis-server  /usr/bin/redis6/conf/redis.conf 
# netstat -anp | grep 6379
   tcp        0      0 127.0.0.1:6379          0.0.0.0:               LISTEN      16073/redis-server 

7.版本查看

# /usr/bin/redis6/bin/redis-server -v
Redis server v=6.2.1 sha=00000000:0 malloc=jemalloc-5.1.0 bits=64 build=d73951bfa54b7c37

8.纳入systemd方式启动及管理

# vim /lib/systemd/system/redis.service
[Unit]
Description=Redis
After=network.target

[Service]
Type=forking
PIDFile=/var/run/redis_6379.pid
ExecStart=/usr/bin/redis6/bin/redis-server  /usr/bin/redis6/conf/redis.conf 
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target
重载
# systemctl daemon-reload 
启动
# systemctl start redis    
查看状态
# systemctl status redis
使开机启动
# systemctl enable redis

扫码领视频副本.gif

0

上一篇:

:下一篇

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号