【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 
相关推荐
码不停蹄的玄黓几秒前
生产可用的 Redis 分布式锁完整实现
数据库·redis·分布式
咸鱼翻身小阿橙3 分钟前
文件读写 + Qt Model/View + 自定义分页+搜索过滤
java·数据库·qt
l1t6 分钟前
DeepSeek总结的DuckDB-Iceberg 在 v1.5.3 中的新特性
数据库·duckdb
Database_Cool_6 分钟前
数据仓库弹性扩缩容怎么实现?阿里云 AnalyticDB MySQL Serverless 弹性架构详解
数据库·人工智能·阿里云
abcy0712139 分钟前
django聚合函数
数据库·sqlite
念越9 分钟前
数据库系统概论第6版王珊版:第二章关系代数与第三章SQL期末重点整理
数据库·sql·性能优化
TDengine (老段)12 分钟前
TDengine 数据保留与 TTL — 多级存储、过期删除与分层迁移
大数据·数据库·物联网·时序数据库·tdengine·涛思数据
安当加密030116 分钟前
等保2.0三级数据库加密:2026检查清单 + TDE部署实战(附脚本)
数据库·网络安全·数据安全·tde·等保2.0·数据库加密·tde透明加密
解决问题no解决代码问题20 分钟前
TiDB 原理与节点宕机实战讲解
数据库·tidb
江湖中的阿龙26 分钟前
Redis 五大核心数据类型底层原理
数据库·redis·缓存