Merge pull request #4487 from johscheuer/docker-add-support-multiple-hostnames

Use only one IP address that matches the hostname
This commit is contained in:
Alec Grieser 2021-04-13 15:12:38 -07:00 committed by GitHub
commit 7a1133fbf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 7 deletions

View File

@ -23,21 +23,18 @@
source /var/fdb/scripts/create_cluster_file.bash
function create_server_environment() {
fdb_dir=/var/fdb
env_file=$fdb_dir/.fdbenv
: > $env_file
env_file=/var/fdb/.fdbenv
if [[ "$FDB_NETWORKING_MODE" == "host" ]]; then
public_ip=127.0.0.1
elif [[ "$FDB_NETWORKING_MODE" == "container" ]]; then
public_ip=$(grep `hostname` /etc/hosts | sed -e "s/\s *`hostname`.*//")
public_ip=$(hostname -i | awk '{print $1}')
else
echo "Unknown FDB Networking mode \"$FDB_NETWORKING_MODE\"" 1>&2
exit 1
fi
echo "export PUBLIC_IP=$public_ip" >> $env_file
echo "export PUBLIC_IP=$public_ip" > $env_file
if [[ -z $FDB_COORDINATOR && -z "$FDB_CLUSTER_FILE_CONTENTS" ]]; then
FDB_CLUSTER_FILE_CONTENTS="docker:docker@$public_ip:$FDB_PORT"
fi

View File

@ -26,4 +26,4 @@ source /var/fdb/.fdbenv
echo "Starting FDB server on $PUBLIC_IP:$FDB_PORT"
fdbserver --listen_address 0.0.0.0:$FDB_PORT --public_address $PUBLIC_IP:$FDB_PORT \
--datadir /var/fdb/data --logdir /var/fdb/logs \
--locality_zoneid=`hostname` --locality_machineid=`hostname` --class $FDB_PROCESS_CLASS
--locality_zoneid="$(hostname)" --locality_machineid="$(hostname)" --class $FDB_PROCESS_CLASS