====== Replica restore ====== === First thing === Verify on the sysmgmt wich server is affected (if master or slave) on the "Hosts & Components" section; it will be marked as "down" or "out of sync", in the former case verify first that the machine is up and running. For both MySQL and MongoDB there is always a "Master" and "Slave", make sure to check who is who before proceeding. \\ ==== MySQL ==== This works for both Config(Config1/Config2) and Reporting(DB1/DB2) DBs. \\ - Login to both machines (SSH) - On Slave login into mysql interface: mysql -u super -p*password* - On Slave show slave status with the following myslq command: SHOW SLAVE STATUS; - On Master stop all BP services with: /usr/lib/servicepattern/setup/sp_servers.sh stop - On Slave stop slave with the following mysql command and exit: STOP SLAVE; EXIT; - Choose a proper position for this file: it's very big, mind to check disk space before a mysqldump: 'df -h' -> this is to check disk utilization and where a disk is mounted, for example, if we see the following situation: Filesystem Size Used Avail Use% Mounted on Disk1 100G 73G 27G 73% / Disk2 300G 30G 270G 10% /mnt Is much better to put the backup in the second disk, so anywhere in the /mnt folder. (**This is only an example, you will not see those disks in the actual machines**) - Make a mysql backup of Master (the "healthy" one) **on Slave** (this way is much faster, in alternative you would have to make the backup on Master, download it and re-upload it on Slave, this operation could take **several hours** instead of a couple of minutes) with the following command: mysqldump -u super -p*password* --host=*DB1 hostname* --all-databases > /*path*/*to*/*file*.sql - Reconnect to mysql console on Slave (command from step 2) - See wich dbs exist and drop everything except "information_schema", "performance_schema" and "mysql" with the following commands: SHOW databases; DROP DATABASE *database name*; - Exit from mysql and load the backup you have done previously of Master in Slave with the following command: mysql -u super -p*password* < /*path*/*to*/*file*.sql - Login to mysql on both Master and Slave (command from step 2)