我是 redis 的新手,但我想在我的 Raspberry Pi 4 (RP) 上设置一个,以便在 Django 应用程序 (带有 celery) 中使用它。
我在我的 RP 上安装了防火墙,ufw
并允许来自我电脑 IP 的端口 6379(redis 端口)的流量进入。
然后我编辑了我的redis.config
RP
bind 192...... #The IP address for my pc
但是现在 redis-server 无法启动。日志中写道:
Could not create server TCP listening socket 192....:6379 bind: Cannot assign requested address
如果我绑定,0.0.0.0
它就可以正常工作,并且我可以从本地电脑访问服务器。
据我所知,“绑定”就像“允许来自该 IP 的连接”,但我可能误解了它。
您对错误设置“意味着什么”有任何想法吗?是防火墙问题吗?我是否遗漏了什么redis.config
?
答案1
据我所知,“绑定”就像“允许来自该 IP 的连接”,但我可能误解了它。
你有。redis 的配置文件相当简单:
# By default, if no "bind" configuration directive is specified, Redis listens # for connections from all available network interfaces on the host machine. # It is possible to listen to just one or multiple selected interfaces using # the "bind" configuration directive, followed by one or more IP addresses. # Each address can be prefixed by "-", which means that redis will not fail to # start if the address is not available. Being not available only refers to # addresses that does not correspond to any network interface. Addresses that # are already in use will always fail, and unsupported protocols will always BE # silently skipped.
bind 指令告诉 redis哪个要监听的网络接口,而不是应该接受来自哪个 IP 的连接。0.0.0.0
表示所有可用的网络接口。
答案2
您可以使用Windows防火墙来限制对REDIS端口的连接。 https://manage.accuwebhosting.com/knowledgebase/2984/如何配置Windows防火墙以允许仅特定IP地址连接你的端口.html