Bind ip wrong in redis config
Asked Answered
O

4

5

log:Creating Server TCP listening socket (myip:port): bind: Cannot assign requested address

my redis.conf

bind 10.114.234.11

when i cofig like this

bind 127.0.0.1

it works well

Ola answered 23/12, 2014 at 13:36 Comment(0)
S
8

You likely do not currently have any interfaces set up for the 10.x.x.x subnet. If you're on any flavor of Linux, ifconfig should be able to tell you which interfaces are currently set up. For example, I'm running Mint 17:

$ ifconfig | grep "inet addr"
inet addr:127.0.0.1  Mask:255.0.0.0
inet addr:192.168.1.3  Bcast:192.168.1.255  Mask:255.255.255.0

So I (like you) would not be able to bind Redis (or most any other service requesting a TCP socket) to 10.x.x.x. If you are really trying to listen for connections on that subnet, you will need to change your network setup (how exactly that would be done depends largely on your operating system).

Seaworthy answered 27/12, 2014 at 13:53 Comment(0)
P
3

At /etc/redis/redis.conf Please change

bind 127.0.0.1 ::1 

to

bind 0.0.0.0

then restart

/etc/init.d/redis-server restart

It's work to me

Pb answered 2/6, 2022 at 4:57 Comment(0)
M
1

I also faced same issue while setting up redis for remote access. I was using google cloud platform and we created Google compute engine VM instance where we installed our Redis server. Redis doesn't ship with by default with security configured. You have to perform some steps to secure it. By updating IP address in redis.conf in bind will allow access only from that IP addresses. When we were doing it, we were getting same error.

To solve this issue we haven't added IP addresses in redis.conf file instead in Google cloud firewall rules when we add port open record in network -> IP ranges you can specify IP address which you want allow to access redis. In redis.conf file update from bind 127.0.0.1 to bind 0.0.0.0. So basically we will restrict it from Google cloud firewall rules dashboard.

Below are steps to add IP address restrictions:

  • Login to your google cloud console

  • Navigate to VPC Network -> Firewall Rules

  • Click on CREATE FIREWALL RULE or edit existing one if it's already there
  • In Source IP ranges add your IP address to allow access only - See below screenshot

enter image description here

  • Once you create this rule add this source tags under your VM instances network type and you are done.
Manlike answered 31/3, 2018 at 7:29 Comment(0)
G
1

I have faced the same issue when I changed the default redis.conf to custom Redis conf and after changing the bind as below then it started working, Please be aware that the below conf will open the Redis connection from all sources.

bind 127.0.0.1 -::1 to bind 0.0.0.0 -::1

Gerius answered 23/6, 2021 at 6:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.