1

In my Ubuntu virtual machine in Hyper-V, I have installed Redis and it runs on startup (by doing sudo systemctl enable redis) and I have configured it to bind 127.0.0.1 192.168.10.100 in the config (the 2nd IP is for internal connections across the local network).

The problem I have is that when I start the virtual machine, it won't allow connections from other local computers (connecting from 192.168.10.100). But when I restart Redis by doing sudo systemctl restart redis it only then allows.

This problem is not because I forgot to restart Redis when adding 192.168.10.100 to the Redis bind.

7
  • In init script did you run redis after the second IP is up? Commented Aug 31, 2022 at 15:20
  • @RomeoNinov I haven't modified /etc/systemd/system/redis.service so I'm not sure. Looking at that file I don't see where I could bind it. It does have --supervised systemd. It also says --daemonized no but in redis.conf it's set to yes
    – parpar8090
    Commented Aug 31, 2022 at 16:23
  • You do not get my point. You set second IP. Is it run redis after the set of this second IP? Commented Aug 31, 2022 at 16:30
  • @RomeoNinov I'm not sure, how can I check?
    – parpar8090
    Commented Aug 31, 2022 at 16:46
  • If you run second IP in systemd you should have in redix Requires=secondip.service and/or After=secondip.service Commented Aug 31, 2022 at 16:57

1 Answer 1

0

This happens because redis is started before your interface is actually up and configured, I've been dealing with the same issue

I've added After=network-online.target to my redis.service file, this should actually wait until the network interface is "up", instead of just initialised (which may or may not include an IP). This might work for you

Unfortunately I haven't been able to test this yet, but I will update this comment once I've rebooted this system at least once

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .