Redis-多种方法安装部署
yum 安装
1.安装扩展源
yum -y install epel-release
2.安装Redis
yum -y install redis
3.启动Redis
systemctl start redis
systemctl enable redis
4.连接Redis
这里的redis也和其他软件一样,开始是没有密码,就算有密码也可以这样连接,只是在执行命令的会提示认证失败。
[root@localhost ~]# redis-cli
127.0.0.1:6379> info
Server
redis_version:3.2.12
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:7897e7d0e13773f
redis_mode:standalone
os:Linux 3.10.0-1160.el7.x86_64 x86_64
#省略部分信息
编译安装
1.下载软件包
自行官网下载对应版本
2.解压&编译
由于centos7系列,再加上上使用的Redis软件版本比较新,所以编译过程我这里就略过了,有兴趣可以去我的历史文章,如何编译:Linux软件安装。
tar xvf redis-stable.tar.gz
cd redis-stable
编译完成以后实际上我们就是获取下面几个二进制包。
3.启动Redis
当然这里是前台启动,甚至都没有指定配置配置。如果是指定配置文件启动则是下面的方式。
redis-server redis.conf
[root@localhost src]# redis-server
7575:C 09 Jan 2026 00:31:50.967 # WARNING Memory overcommit must be enabled! Without it, a background save or replication 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.
7575:C 09 Jan 2026 00:31:50.968 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
7575:C 09 Jan 2026 00:31:50.968 * Redis version=8.3.240, bits=64, commit=00000000, modified=1, pid=7575, just started
7575:C 09 Jan 2026 00:31:50.968 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
7575:M 09 Jan 2026 00:31:50.968 * Increased maximum number of open files to 10032 (it was originally set to 1024).
7575:M 09 Jan 2026 00:31:50.968 * monotonic clock: POSIX clock_gettime
.
.-__ ''-._ _.- . . ‘’-._ Redis Open Source
.- .-```. ```\/ _.,_ ''-._ 8.3.240 (00000000/1) 64 bit ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.-.|'_.-'| Port: 6379 | -. ._ / _.-' | PID: 7575 -._ -._ -./ .-’ .-’
|-._-. -.__.-' _.-'_.-'| | -.-._ _.-'_.-' | https://redis.io -._ -._-..-'.-’ .-’
|-._-. -.__.-' _.-'_.-'| | -.-._ _.-'_.-' | -._ -._-..-‘_.-’ _.-’
-._ -..-’ _.-’
-._ _.-' -..-’
7575:M 09 Jan 2026 00:31:50.969 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
7575:M 09 Jan 2026 00:31:50.969 * Server initialized
7575:M 09 Jan 2026 00:31:50.969 * Ready to accept connections tcp
4.连接redis
[root@localhost src]# redis-cli
127.0.0.1:6379> info
Server
redis_version:8.3.240
redis_git_sha1:00000000
redis_git_dirty:1
redis_build_id:fcebfdad2f0b4098
redis_mode:standalon
- 点赞
- 收藏
- 关注作者
评论(0)