【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 
相关推荐
wdfk_prog11 分钟前
LWIP教程 10:从 `tcp_receive()` 到 `ooseq` / SACK——TCP 乱序、重组与选择确认
网络·数据库·tcp/ip
狼与自由12 分钟前
Mysql 3种日志的区别
数据库·mysql
linweidong18 分钟前
Redis 集群故障排查与修复实战:从 Connection refused 到内存打满的七个现场
运维·数据库·redis·缓存·redis集群·运维面经·实施面经
StackTraces24 分钟前
从零跑通 Meilisearch 本地搜索服务:6 步,外加 4 个容易卡住的地方
数据库·后端
CoLiuRs27 分钟前
订单不是一张表:订单聚合与状态机
数据库·架构
用户62228840481929 分钟前
Redis 内存管理与过期淘汰策略:从 maxmemory 到 LRU / LFU,一篇讲透
java·redis
shuoshuohaohao30 分钟前
Spring-boot-3 -注解 yaml配置 -日志
java·数据库·mysql
IT邦德42 分钟前
Bond-DBCheck 邦德智能巡检平台助力 DBA
数据库·dba
无毁的湖光-Al1 小时前
解Bug之路-隔离故障点后业务不恢复?-热点Key处理与亚稳态故障
java·数据库·mysql
l1t1 小时前
DeepSeek总结的有符号、无符号、未对齐:从汇编到 SQL 的教训
汇编·数据库·sql