From 4dfb2d173ab1939cd784143e27e0dc16d0c42f29 Mon Sep 17 00:00:00 2001 From: Gianluca Borello Date: Thu, 18 Oct 2018 16:06:47 -0700 Subject: [PATCH] Bootstrap with --force Since the container image always does the bootstrap when it starts, we can end up in a situation where the container is restarted while it preserves its previous hostname (e.g. container restarted in a Kubernetes pod). This causes the bootstrap process to fail, because Router will already find an entry matching the existing hostname inside the mysql_innodb_cluster_metadata.hosts table, so it will fail with: Error: It appears that a router instance named '' has been previously configured in this host. If that instance no longer exists, use the --force option to overwrite it. It seems the only sensible option to be resilient to this sort of failure is to bootstrap with --force, so that the registration can be properly reclaimed. Signed-off-by: Gianluca Borello --- 8.0/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/8.0/run.sh b/8.0/run.sh index c23a5041..1bbb412b 100755 --- a/8.0/run.sh +++ b/8.0/run.sh @@ -46,7 +46,7 @@ if [ "$1" = 'mysqlrouter' ]; then fi done echo "Succesfully contacted cluster with $MYSQL_INNODB_NUM_MEMBERS members. Bootstrapping." - mysqlrouter --bootstrap "$MYSQL_USER@$MYSQL_HOST:$MYSQL_PORT" --user=mysqlrouter --directory /tmp/mysqlrouter <<< "$MYSQL_PASSWORD" + mysqlrouter --bootstrap "$MYSQL_USER@$MYSQL_HOST:$MYSQL_PORT" --user=mysqlrouter --directory /tmp/mysqlrouter --force <<< "$MYSQL_PASSWORD" sed -i -e 's/logging_folder=.*$/logging_folder=/' /tmp/mysqlrouter/mysqlrouter.conf echo "Starting mysql-router." exec "$@" --config /tmp/mysqlrouter/mysqlrouter.conf