CentOS Steam 9安装 Redis

CentOS Steam 9安装 Redis

1. 安装Redis服务

shell 复制代码
yum install redis

2. 启动/关闭/重启 Redis 服务

  • 启动 Redis 服务命令:

    shell 复制代码
    systemctl start redis.service
  • 关闭 Redis 服务命令:

    shell 复制代码
    systemctl stop redis.service
  • 重启 Redis 服务命令:

    shell 复制代码
    systemctl restart redis.service
  • 注意:Redis 启动成功后如下

3. 设置开机启动

shell 复制代码
systemctl enable redis.service

4. 设置 Redis 密码

  • 编辑配置文件

    shell 复制代码
    vi /etc/redis/redis.conf
  • 找到 "# requirepass foobared",去掉前面的 "#",并把 "foobared" 改成你的密码。

  • 保存文件,重启 Redis 服务

    shell 复制代码
    systemctl restart redis.service
  • 验证密码

5. 开启远程连接

  • 编辑配置文件

    shell 复制代码
    vi /etc/redis/redis.conf
  • 找到 bind 127.0.0.1 将其注释

  • 找到 protected-mode yes 将其改为 protected-mode no

  • 保存文件,重启 Redis 服务

    shell 复制代码
    systemctl restart redis.service
  • 开放 6379 端口 重点

    注意:CentOS Stream系统默认开启了防火墙,若需要远程能登录,需开放6379端口。

    shell 复制代码
    firewall-cmd --zone=public --add-port=6379/tcp --permanent
    shell 复制代码
    firewall-cmd --reload
  • 若为云服务器需设置 安全组,若未设置依旧无法远程连接。

相关推荐
koddnty4 小时前
在c++中使用HOOK修改sleep函数
linux·c++
Jovin Giogic4 小时前
简明教程:记录 Ubuntu系统命令行安装TexLive,配置vscode
linux·vscode·ubuntu·latex·texlive
猫豆~4 小时前
Shell脚本部署——8day
linux·云计算
屿行屿行4 小时前
【Linux】浅析Linux内存管理机制
linux
潘晓可4 小时前
Docker部署Bookstack
运维·docker·容器
Serverless社区4 小时前
阿里云新发的AgentRun 有哪些“大招”,一文详解来了
运维·阿里云·云原生·serverless
誰能久伴不乏4 小时前
深入理解 `poll` 函数:详细解析与实际应用
linux·服务器·c语言·c++·unix
倔强的石头1064 小时前
Linux 进程深度解析(二):进程状态、fork 创建与特殊进程(僵尸 与 孤儿)
linux·运维·服务器
小李小李无与伦比4 小时前
使用Simiki,部署.md文档
linux·运维·服务器
做人不要太理性4 小时前
【Linux系统】ELF 文件格式的硬核揭秘
java·linux·服务器