• 【REdis】如何让Redis能供外界访问


    【前篇】

     https://www.cnblogs.com/heyang78/p/15962970.html

    【Deny提示】

    如果没有进行设置,redis只能本机操作,从外界访问您迟早会看到下列文字:

    Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside.

    因此,不进行设置还不行。

    【修改redis.conf文件】

    vi redis.conf

    将bind 127.0.0.1 -::1 一句屏蔽掉,变成 #bind 127.0.0.1 -::1

    将protected-mode yes 改写成 protected-mode no

    daemonize no一句,保持,如果是yes请改为no

    【运行redis】

    [hy@localhost ~]$ cd redis-6.2.6
    [hy@localhost redis-6.2.6]$ ls
    00-RELEASENOTES  COPYING   MANIFESTO   runtest-cluster    src
    BUGS             deps      README.md   runtest-moduleapi  tests
    CONDUCT          INSTALL   redis.conf  runtest-sentinel   TLS.md
    CONTRIBUTING     Makefile  runtest     sentinel.conf      utils
    [hy@localhost redis-6.2.6]$ vi redis.conf
    [hy@localhost redis-6.2.6]$ cd src
    [hy@localhost src]$ ./redis-server ../redis.conf

    前面是步骤,粗体是关键。

    此后,外界访问redis的路径便通达了。

    END

  • 相关阅读:
    auto_ptr(转载)
    OSG在VS2008下的配置安装
    没有找到MSVCR80.dll (转)
    获取程序数据路径(转)
    vc中error LNK2001:unresolved external symbol _WinMain@16的解决方法(转)
    wxWidgets编程笔记二(samples使用设置)
    关于简繁转换的工作以及校正转换词汇表的设计
    汉文博士简繁汉字转换功能测试版已经上线
    感谢wangyanhan和sanwsw网友为汉文博士制作数据库
    汉文博士新增四角号码检索字典
  • 原文地址:https://www.cnblogs.com/heyang78/p/15963288.html
Copyright © 2020-2023  润新知