redis

What does the bind parameter do in 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:


Solution

  • 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).

    redis-server and redis-stack-server will only listen to connections made to the address specified in via the bind option (localhost by default). 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-server will only accept client connections made to 127.0.0.1 (only local ones).

    If you set it to a generic "catch-all" address (an IP block containing all possible IP addresses):

    bind 0.0.0.0
    

    it will accept connection to any address (and hence any connection that can be made to your redis-server 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 (where it should be running) and will drop the rest.