Hi, I’m trying to run Yugabyte in Docker but I’m having a lot of trouble getting it to work reliably (more details here).
I’m trying to tell yugabyted which specific master address to use, but it is not working.
I’m starting it with this command: bin/yugabyted start --background=false --advertise_address "$$(hostname -i)" --master_flags "master_addresses=yugabyte:7100" --tserver_flags "tserver_master_addrs=yugabyte:7100"
But this is what ends up showing in the config file: "current_masters": ",172.19.0.2:7100",
…which seems to completely break the database (unable to connect with ysqlsh), even though the IP is correct.
If I remove --master_flags and --tserver_flags and manually edit the config file to: "current_masters": "yugabyte:7100",
…it works as intented, even if the container’s IP changes (which was my original issue), however, I don’t want to rely on the config file because it seems to be dynamic (I’ve seen that field automatically set to yugabyte:7100,172.19.0.2:7100 before), so I would like it to specify the exact hostname that is to be used.
2.25. which exact build I’ll have to check. and I technically did fix that, but by manually editing a config file that I don’t think I’m supposed to change. right now I’m trying to figure out how to permanently fix it in a way that would work in a new installation.
I’ve created a different Yugabyte service for another project and I’m once again facing the same issue, except now I cannot connect at all. even after enabling DNS and setting the correct hostname in current_masters. no errors in logs. it just doesn’t work. I need help.
Yugabyted doesn’t allow users to update the master address. It is not advisable to set the current_masters in the yugabyted.conf file, its dynamically obtained by the yugabyted based on the current masters in the Universe.
Why are we trying to set the master address? please help us understand your usecase.
I’m trying to set the master address because the automatic IP address that is detected does not work since I’m running Yugabyte inside a docker container where IPs are dynamic and change depending on which (Compose) service starts first. When it does change, the old IP remains in the config, and Yugabyte locks up because it endlessly attempts to connect to the old IP.
@HeCorr I’ll try to replicate the issue internally. I’m not sure why Docker is resolving the DNS address to its backing ip-address. join_ip and current_masters should have been the DNS name. I’ll get back to you on this by Tomorrow EOD.
I’ve actually halted development on the project that used Yugabyte, so I haven’t used it since February and kinda forgot about this issue.
I might give it another try this week.
Edit 1: So I tried it again with v2025.1.0.0-b168 in Docker directly (without Compose, following the docs) and it does seem to work as long as I don’t actually remove the container, which I can’t remember if Compose does, so I’ll try with that next.
Edit 2: I solved the error I was having (socket.gaierror: [Errno -2] Name or service not known). By defining a container hostname and manually editing yugabyted.conf, but I imagine that using the advertise_address flag would have worked too, but I only had to do this once anyway since I didn’t have a static hostname initially.