-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[yugabyted] Error binding socket after docker host restart #18572
Comments
Thanks a lot, @pablopla for filling the issue and identifying the root cause. Yes, YugabyteDB needs a static network identity for its nodes, with a static IP. That's why in Kubernetes it is deployed with StatefulSets. For labs, can do something similar with Docker network. Reproduce without restarting the hostBy starting another container when the YugabyteDB one is stopped, it takes the IP address and then the next start will get a new one assigned:
The error is:
because this address is already used by another container. Solution: Static IPWhat is different here is that I add
Of course, if another container is started on the same network without setting another IP address, we will encounter the same problem. But now we have full control of the IP assigned. |
Thank you for the workaround. This should be documented here, here and here. The need to use "--name yugabyte" to be able to connect to the database with ysqlsh also need to be documented. The docs on the docker hub page should have a short description of Yugabyte and all the specific instructions of using the container. |
Yes, I'll ping the Doc team. |
…ased deployments. Summary: In docker based deployments, yugabyted by default binds to the ip_address of the container. When the hostname machine restarts, yugabyted fails to restart as the ip-address of the container would have changed. Updating the default behavior of yugabyted to bind with container `hostname` in docker deployments. ### Tests 1. Start yugabyted node docker ```sh docker run -d --name yugabyte --hostname yugabyte -p7000:7000 -p9000:9000 -p15433:15433 -p5433:5433 -p9042:9042 nchandrappa/yugabyte:2.25.0.0-hostname bin/yugabyted start --background=false ``` 2. Stop YB container ```sh docker stop <container-id> ``` 3. Start YB container ```sh docker start <container-id> ``` Jira: DB-7509 Test Plan: manual test Reviewers: sgarg-yb Reviewed By: sgarg-yb Subscribers: yugabyted-dev Differential Revision: https://phorge.dev.yugabyte.com/D39786
…name for docker based deployments. Summary: Original commit: 59e080a / D39786 In docker based deployments, yugabyted by default binds to the ip_address of the container. When the hostname machine restarts, yugabyted fails to restart as the ip-address of the container would have changed. Updating the default behavior of yugabyted to bind with container `hostname` in docker deployments. ### Tests 1. Start yugabyted node docker ```sh docker run -d --name yugabyte --hostname yugabyte -p7000:7000 -p9000:9000 -p15433:15433 -p5433:5433 -p9042:9042 nchandrappa/yugabyte:2.25.0.0-hostname bin/yugabyted start --background=false ``` 2. Stop YB container ```sh docker stop <container-id> ``` 3. Start YB container ```sh docker start <container-id> ``` Jira: DB-7509 Test Plan: manual test Reviewers: sgarg-yb Reviewed By: sgarg-yb Subscribers: yugabyted-dev Differential Revision: https://phorge.dev.yugabyte.com/D40978
Jira Link: DB-7509
Description
Yugabyte container fail to bind socket after restarting the host.
Docker assign IP addresses to containers based on the start order. If you have several containers running on your machine and restart the host, the Yugabyte container might get a different address.
To reproduce:
sudo docker run -it -d --restart=always -p 5433:5433 --hostname yugabyte --name yugabyte yugabytedb/yugabyte:2.18.1.0-b84 bin/yugabyted start --daemon=false
sudo docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' yugabyte
sudo docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' yugabyte
cat /root/var/logs/tserver.err
20 tablet_server_main_impl.cc:208] Network error (yb/util/net/socket.cc:325): Error binding socket to 172.19.0.7:9100: Cannot assign requested address (system error 99)
Warning: Please confirm that this issue does not contain any sensitive information
The text was updated successfully, but these errors were encountered: