【Redis】Redis安装

Redis安装

复制代码
apt install redis -y

修改 /etc/redis/redis.conf

  • 修改 bind 127.0.0.1 为 bind 0.0.0.0

  • 修改 protected-mode yes 为 protected-mode no

    1 # By default, if no "bind" configuration directive is specified, Redis listens
    2 # for connections from all the network interfaces available on the server.
    3 # It is possible to listen to just one or multiple selected interfaces using
    4 # the "bind" configuration directive, followed by one or more IP addresses.
    5 #
    6 # Examples:
    7 #
    8 # bind 192.168.1.100 10.0.0.1
    9 # bind 127.0.0.1 ::1
    10 #
    11 # ~~~ WARNING ~~~ If the computer running Redis is directly exposed to the
    12 # internet, binding to all the interfaces is dangerous and will expose the
    13 # instance to everybody on the internet. So by default we uncomment the
    14 # following bind directive, that will force Redis to listen only into
    15 # the IPv4 loopback interface address (this means Redis will be able to
    16 # accept connections only from clients running into the same computer it
    17 # is running).
    18 #
    19 # IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
    20 # JUST COMMENT THE FOLLOWING LINE.
    21 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    22 # bind 127.0.0.1 # 注释掉这行
    23 bind 0.0.0.0 # 添加这行
    24
    25 protected-mode no # 把 yes 改成 no

控制 Redis 启动

启动 Redis 服务

bash 复制代码
service redis-server start

停止 Redis 服务

bash 复制代码
service redis-server stop

重启 Redis 服务

bash 复制代码
service redis-server restart 
相关推荐
梦影_7 分钟前
MySQL进阶教程(五)—— SQL调优(下)
android·大数据·数据库·后端·sql·mysql·database
考虑考虑7 分钟前
mariadb数据库
数据库·后端·mariadb
John_Hui2 小时前
Windows 10 安装版本:mysql-8.1.0-winx64.zip
数据库·windows·mysql
莫晓燚2 小时前
双机部署若依 (RuoYi‑Vue) 传统环境部署---实战
linux·运维·数据库·redis·mysql·nginx·ruoyi
updayday8543 小时前
客户附件不该发往旧邮箱,如何在发送前拦截 - Ping64 邮件安全管控
大数据·网络·数据库·安全·智能路由器
倔强的石头_3 小时前
连接异常排障手册:拒连、超时、认证失败、空闲断开
数据库
lhbweilai3 小时前
QT(了解各个控件和布局)上
数据库·qt
夕除3 小时前
redis--resp
redis
莫晓燚4 小时前
搭建Redis 主从复制---实战
数据库·redis·缓存
灵晔君4 小时前
【MySQL】数据库基础
数据库·mysql·adb