centos8安装redis
一,下载:
1,下载页面:
2,下载
[ source]# wget http://211.136.65.167/cache/download.redis.io/releases/redis-5.0.7.tar.gz?ich_args2=126-04144902061721_e60a775f321316a0d251397c9b042707_10001002_9c896c2cd0caf9d89238518939a83798_63a1132906332dae875e26b3cc346d8a [ source]# mv redis-5.0.7.tar.gz\?ich_args2\=126-04144902061721_e60a775f321316a0d251397c9b042707_10001002_9c896c2cd0caf9d89238518939a83798_63a1132906332dae875e26b3cc346d8a redis-5.0.7.tar.gz
说明:架构森林是一个专注架构的博客,对应的源码可以访问这里获取
说明:作者邮箱:
二,解压:
[ source]# tar -xzvf redis-5.0.7.tar.gz
三,准备编译
1, 请在操作前确认gcc是否已安装,
如未安装,可以执行这个命令安装:
[ redis-5.0.7]# yum install gcc
2,请在操作前确认tcl是否已安装
如未安装,可以执行这个命令安装:
[ redis-5.0.7]# yum install tcl
四,编译:
[ source]# cd redis-5.0.7/ [ redis-5.0.7]# make MALLOC=libc
说明:make 后加 MALLOC的参数的原因:
避免提示找不到 jemalloc/jemalloc.h
五,测试编译:
[ redis-5.0.7]# make test
如果看到以下字样:表示无错误:
\o/ All tests passed without errors!
六,安装:
[ redis-5.0.7]# mkdir /usr/local/soft/redis5 [ redis-5.0.7]# cd /usr/local/soft/redis5/ [ redis5]# mkdir bin [ redis5]# mkdir conf [ redis5]# cd bin/ [ bin]# cp /usr/local/source/redis-5.0.7/src/redis-cli ./ [ bin]# cp /usr/local/source/redis-5.0.7/src/redis-server ./ [ bin]# cd ../conf/ [ conf]# cp /usr/local/source/redis-5.0.7/redis.conf ./
七,配置:
[ conf]# vi redis.conf
设置以下两个地方:
# daemonize no daemonize yes # maxmemory <bytes> maxmemory 128MB
说明:分别是以daemon方式独立运行 / 内存的最大使用限制
八,运行:
[ conf]# /usr/local/soft/redis5/bin/redis-server /usr/local/soft/redis5/conf/redis.conf
九,检查端口是否在使用中
[ conf]# netstat -anp | grep 6379 tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 16073/redis-server
十,查看redis的当前版本:
[ conf]# /usr/local/soft/redis5/bin/redis-server -v Redis server v=5.0.7 sha=00000000:0 malloc=libc bits=64 build=8e31d2ed9a4c9593
十一,使redis可以用systemd方式启动和管理
1,编辑service文件
[ liuhongdi]# vim /lib/systemd/system/redis.service
2,service文件内容:
[Unit] Description=Redis After=network.target [Service] Type=forking PIDFile=/var/run/redis_6310.pid ExecStart=/data/app/redis/src/redis-server /data/app/redis/config/redis6310.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target
3.重载系统服务
[ liuhongdi]# systemctl daemon-reload
4,用来管理redis
启动 systemctl start redis 查看状态 systemctl status redis 使开机启动 systemctl enable redis
十二,查看本地centos的版本:
[ lib]# cat /etc/redhat-release CentOS Linux release 8.1.1911 (Core)
相关推荐
王道革 2020-11-25
wangdonghello 2020-11-03
Langeldep 2020-11-16
chenhualong0 2020-11-16
聚合室 2020-11-16
koushr 2020-11-12
MRFENGG 2020-11-11
guoyanga 2020-11-10
fackyou00 2020-11-10
Orangesss 2020-11-03
dongCSDN 2020-10-31
rainandtear 2020-10-30
Quietboy 2020-10-30
liuyulong 2020-10-29
fansili 2020-10-29
温攀峰 2020-10-23
jackbon 2020-10-19
kaixinfelix 2020-10-04