【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 
相关推荐
stereohomology8 分钟前
AI解读:某IM软件本地数据库密钥提取与解密
数据库·攻防·加密解密·数字平权
zzzll111111 分钟前
大模型技术原理与应用实践
java·数据库·人工智能
倔强的石头_12 分钟前
数据库迁移工具从单机作业走向云端协同
数据库
yours_Gabriel15 分钟前
【一】数据库基础:SQL语句、函数、约束、多表查询、事务
数据库·sql·oracle
Wang's Blog20 分钟前
PostgreSQL笔记58: 性能监控工具全景——从内核指标到操作系统诊断
数据库·笔记·postgresql
kyle~26 分钟前
计算机系统 --- 缓存一致性
开发语言·c++·缓存·计算机系统
智购科技智能售货柜9 小时前
2026自动售货机整机可靠性测试:从高低温交变到EMC电磁兼容的认证工程实践~YH
运维·服务器·数据库·人工智能·物联网
ltl9 小时前
RocksDB 架构演进:相对 LevelDB 的 diff 地图
数据库
ltl9 小时前
存储读取性能优化:索引、Bloom Filter 与读放大
数据库
2602_9599609212 小时前
谢飞机面试大厂:Spring Boot、JVM、Redis、Kafka、微服务与音视频搜索场景求生实录
java·jvm·spring boot·redis·面试题