Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the bind parameter do in Redis?

Tags:

redis

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:

  • 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)
like image 239
usual me Avatar asked Aug 20 '14 23:08

usual me


1 Answers

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

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

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.

So if you set

bind 127.0.0.1

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

If you set it to

bind 0.0.0.0

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.

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.

like image 72
soulcheck Avatar answered Oct 12 '22 15:10

soulcheck