Cannot assign requested address with YugabyteDB and Docker Volume

138 Views Asked by At

Problem when using yugabyte with persistence volume in docker. On first run everything work fine, but when re-create container with existing volume, it fail to start:

master.err :
./../src/yb/master/master_main.cc:131] Network error (yb/util/net/socket.cc:325): Error binding socket to 172.28.0.3:7100: Cannot assign requested address (system error 99)
    @          0x2938618  google::LogMessage::SendToLog()
    @          0x29394d3  google::LogMessage::Flush()
    @          0x29399cf  google::LogMessageFatal::~LogMessageFatal()
    @          0x2677cde  main
    @     0x7fb112f46825  __libc_start_main
    @          0x260802e  _start (edited) 

There is a yugabyted.conf in yb-data/conf with the ip is written there When we re-create container the container will get new ip but the ip in yugabyted.conf is old ip address of container

...
"advertise_address": "172.28.0.3", 
...
1

There are 1 best solutions below

0
FranckPachot On

When starting with yugabyted, the directory set by --base_dir holds the configuration in conf/yugabyted.conf, and the data directory in data which is set by --fs_data_dirs when starting yb-master and yb-tserver.

If you want the data directory in the volume but not the configuration, you can set it with:

--tserver_flags=fs_data_dirs=/ybdata --master_flags=fs_data_dirs=/ybdata

and leave --base_dir within the container

Another possibility if you want the configuration in the external volume is to use a configuration that is not dependent on container addresses, like with:

--advertise_address=0.0.0.0

which will listen on all interfaces