【Redis】Redis安装

Redis安装

复制代码
apt install redis -y

修改 /etc/redis/redis.conf

  • 修改 bind 127.0.0.1bind 0.0.0.0

  • 修改 protected-mode yesprotected-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 分钟前
Redis Insight黑屏,页面空白
redis·redis insight
静听山水43 分钟前
SQLite
数据库·sqlite
草明1 小时前
clickhouse 检查是否有删除语句在执行
数据库·clickhouse
风语者日志2 小时前
攻防世界—easyupload
数据库·web安全·ctf·小白入门
彡皮2 小时前
qt实用学习案例:数据库设计+图表显示+model-view模式+样式表定制
数据库·qt·学习
码出钞能力2 小时前
如何屏蔽GORM个别sql的日志
数据库·sql·gorm
TDengine (老段)2 小时前
TDengine 数字函数 RADIANS 用户手册
大数据·数据库·sql·物联网·时序数据库·tdengine·涛思数据
小蒜学长3 小时前
springboot基于JAVA的二手书籍交易系统的设计与实现(代码+数据库+LW)
java·数据库·spring boot·后端
野犬寒鸦3 小时前
从零起步学习MySQL || 第七章:初识索引底层运用及性能优化(结合底层数据结构讲解)
java·数据库·后端·mysql·oracle
6极地诈唬4 小时前
【sqlite】WAL初探
数据库·sqlite