【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 
相关推荐
男孩李8 分钟前
浅谈PostgreSQL 模式(SCHEMA)
数据库·postgresql
TG:@yunlaoda360 云老大13 分钟前
如何在华为云国际站代理商控制台进行基础状态核查的常见问题解答
数据库·华为云·php
CeshirenTester26 分钟前
Cursor自动调试代码实战教程
数据库·oracle
老马952727 分钟前
事务工具类
数据库·后端
小张是铁粉37 分钟前
oracle 数据库学习之体系结构(1-4章)
数据库·学习
TH_139 分钟前
22、oracle导入数据,sys_user表数据错误
数据库·oracle
严文文-Chris1 小时前
【向量数据库到底是什么?】
数据库
老马聊技术1 小时前
HBase单节点环境搭建详细教程
大数据·数据库·hbase
子夜江寒1 小时前
Python 操作 MySQL 数据库
数据库·python·mysql
梦帮科技1 小时前
第二十二篇:AI驱动的工作流优化:性能瓶颈自动检测
数据结构·数据库·人工智能·python·开源·极限编程