一、redis单例安装(linux)
系列导航
环境:centos7.5
需要的安装包: redis-4.0.10.tar.gz
安装步骤
1、安装包解压
拷贝redis-4.0.10.tar.gz 到/opt目录下
cd /opt
tar -xzvf redis-4.0.10.tar.gz
注:安装包获取方式(免费):
(1)登录-注册:http://resources.kittytiger.cn/
(2)签到获取积分
(3)搜索:redis安装包 redis-2.8.10.tar.gz+redis-4.0.10.tar.gz
2、编译
[root]# cd /opt/redis-4.0.10
[root]# make
注:contos7.9编译时会报错 /bin/sh: cc: command not found
解决:yum -y install gcc gcc-c++ libstdc++-devel
3、启动redis
[root@minio4 redis-4.0.10]# /opt/redis-4.0.10/src/redis-server /opt/redis-4.0.10/redis.conf
注:启动后当前界面不能退出,退出服务就停了
nohup /opt/redis-4.0.10/src/redis-server /opt/redis-4.0.10/redis.conf & 这样就是后台启动,启动后退出当前页面服务不会停止。
启动成功后如下所示
187320:C 07 May 19:16:21.702 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
187320:C 07 May 19:16:21.702 # Redis version=4.0.10, bits=64, commit=00000000, modified=0, pid=187320, just started
187320:C 07 May 19:16:21.702 # Configuration loaded
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 4.0.10 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 187320
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
187320:M 07 May 19:16:21.706 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
187320:M 07 May 19:16:21.707 # Server initialized
187320:M 07 May 19:16:21.707 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
187320:M 07 May 19:16:21.707 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
187320:M 07 May 19:16:21.707 * Ready to accept connections
4、启动客户端
[root@minio4 src]# cd /opt/redis-4.0.10/src
[root@minio4 src]# ./redis-cli
127.0.0.1:6379>
5、退出客户端
127.0.0.1:6379> exit
6、关闭服务端
[root@minio4 src]# cd /opt/redis-4.0.10/src
[root@minio4 src]# ./redis-cli -p 6379 shutdown
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!