From 701f19ab9cc8c90661968b7e2abd261877a32ccb Mon Sep 17 00:00:00 2001 From: Arif Ali Date: Tue, 18 Oct 2022 08:55:25 +0100 Subject: [PATCH] amend innodb recover doc with a few extra bits --- recover_innodb_cluster.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/recover_innodb_cluster.md b/recover_innodb_cluster.md index efeaa6f..2f54bae 100644 --- a/recover_innodb_cluster.md +++ b/recover_innodb_cluster.md @@ -6,11 +6,16 @@ mysql-innodb-cluster/1 active idle 1/lxd/6 10.0.1.114 mysql-innodb-cluster/2* active idle 2/lxd/6 10.0.1.156 Unit is ready: Mode: R/O, Cluster is ONLINE and can tolerate up to ONE failure. ``` +1. Grab a backup of the mysql Database + + ``` + juju run-action --wait mysql-innodb-cluster/leader mysqldump + ``` + 1. Stop the mysql on the unit `mysql-innodb-cluster/0` ``` sudo systemctl stop mysql - sudo mv /var/lib/mysql /var/lib/mysql.old ``` 1. Remove the member from the cluster @@ -36,6 +41,7 @@ mysql-innodb-cluster/2* active idle 2/lxd/6 10.0.1.156 ``` juju ssh mysql-innodb-cluster/0 + sudo -i cd /var/lib mv mysql mysql.old.$(date +%s) mkdir mysql @@ -54,6 +60,12 @@ mysql-innodb-cluster/2* active idle 2/lxd/6 10.0.1.156 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: wyPd_?kEd03p ``` + This can easily grabbed by running the following command + + ``` + grep temporary /var/log/mysql/error.log + ``` + First we need to get the root password that is stored ``` @@ -94,7 +106,7 @@ mysql-innodb-cluster/2* active idle 2/lxd/6 10.0.1.156 mysql -u clusteruser -p -e 'SELECT user,host FROM mysql.user' ``` -1. Re-add instance to cluster: +1. Re-add instance to cluster (you may need to replace `leader` by the unit number that is `Mode: R/W`: ``` juju run-action --wait mysql-innodb-cluster/leader add-instance address=10.0.1.137 @@ -133,4 +145,4 @@ After that check the cluster status: ``` juju run-action --wait mysql-innodb-cluster/leader cluster-status -``` \ No newline at end of file +```