Redis 中的 bind 参数有什么作用? [英] What does the bind parameter do in Redis?

查看:68
本文介绍了Redis 中的 bind 参数有什么作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Redis 中的 bind 参数是什么?bind 的文档假设我已经知道 bind 是什么意思(我不知道).bind 是否设置了以下 IP 地址:

What is the bind parameter in Redis? The documentation for bind assumes that I already know what bind means (which I don't). Does bind set the IP address of:

  • Redis 服务器?(我认为这是正确的答案,但后来我不明白我们为什么需要那个)
  • 将被授权连接到 Redis 的客户端?(我试过了,没有用,所以可能不正确)
  • the Redis server? (I think this is the correct answer, but then I don't understand why we need that)
  • the client that will be authorized to connect to Redis? (I tried and it didn't work, so probably incorrect)

推荐答案

它相当于 mysql bind-address 选项并以完全相同的方式工作.

It's the redis equivalent of mysql bind-address option and works in exactly the same way.

它将 redis 实例绑定到特定的接口(以及特定的 ip 地址).

It binds the redis instance to specific interface (and hence specific ip address).

基本上你的 redis 服务器只会监听通过 bind 选项指定的地址的连接.这是一种安全措施,允许丢弃不是在特定网络内部建立的连接.

Basically your redis server will only listen to connections made to the address specified in via the bind option. This is a security measure that allows for dropping connections not made inside the particular network.

所以如果你设置

bind 127.0.0.1

redis 将只接受到 127.0.0.1 的客户端连接(仅限本地连接).

redis will only accept client connections made to 127.0.0.1 (only local ones).

如果你设置为

bind 0.0.0.0

它将接受与运行 redis 的机器上的任何接口使用的任何地址的连接(以及因此可以与您的 redis 实例建立的任何连接).

it will accept connection to any address (and hence any connection that can be made to your redis instance) that is used by any interface on the machine where redis is running.

如果您将其设置为任何其他特定地址,那么 redis 将期望与该特定地址建立连接并丢弃其余地址.

If you set it to any other specific address then redis will expect connections to be made to that specific address and will drop the rest.

这篇关于Redis 中的 bind 参数有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆