CentOS 在线安装redis(防坑)

redis

此安装过程,基于GUI桌面,不是最小化安装
此为个人笔记,如遇问题,请先留言。

安装

  • 使用root权限,下面操作使用管理员权限
   su
输入密码
  • 使用yum安装
    yum -y install redis
  • 安装好之后启动Redis服务
    systemctl start redis
  • 配置config

    另外为了可以使 Redis 能被远程连接,需要修改配置文件,路径为 /etc/redis.conf。

    vim /etc/redis.conf
1.修改这一行
bing 127.0.0.1 
例:
# bing 127.0.0.1
或:
bind 0.0.0.0

2.推荐按设置密码
requirepass foobared
例:
requirepass password

3. 配置后台运行
daemonize yes

4.关闭保护模式
protected-mode no
  • 重启Redis服务
    systemctl restart redis

其他操作

启动等操作

# 启动
systemctl start redis

# 查看状态
systemctl status redis

# 停止
systemctl stop redis

# 重启
systemctl restart redis

防火墙

主机不能连接虚拟机的redis,关闭防火墙

# 查看防火墙状态
systemctl status firewalld.service

# 开启防火墙
systemctl start firewalld.service

# 关闭防火墙
systemctl stop firewalld.service

# 禁用防火墙服务
systemctl disable firewalld.service
  • 10
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值