【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 
相关推荐
Channing Lewis2 小时前
SQL Server 简介和与其它数据库对比
数据库
阿文弟2 小时前
浅谈Mysql的MVCC机制(RC与RR隔离级别)
数据库·mysql
要睡觉_ysj3 小时前
MySQL锁机制与MVCC深度解析
数据库·mysql
看到千里之外的云3 小时前
用service 和 SCAN实现sqlplus/jdbc连接Oracle 11g RAC时负载均衡
数据库·oracle·负载均衡
野犬寒鸦3 小时前
Redis核心数据结构操作指南:字符串、哈希、列表详解
数据结构·数据库·redis·后端·缓存·哈希算法
袖清暮雨5 小时前
ClickHouse讲解
大数据·数据库·数据仓库·clickhouse·oracle
vvilkim5 小时前
MongoDB 备份与恢复策略全面指南:保障数据安全的完整方案
数据库·mongodb
是桃萌萌鸭~5 小时前
使用 mysqldump 获取 MySQL 表的完整创建 DDL
数据库·mysql
泽韦德5 小时前
【MySQL】第11节|MySQL 8.0 主从复制原理分析与实战(一)
android·数据库·mysql
chxii5 小时前
10.2sql
数据库·sql·sqlite