#!/usr/bin/env bash if [ -d /opt/idssys/defaults ]; then source /opt/idssys/defaults/colors.inc source /opt/idssys/defaults/default.inc else source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)" source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)" fi echo "" echo -e "${idsCL[LightGreen]}Cluster Control Removal Script${idsCL[Default]}" echo "" cd ~ rm -f ./install-cc wget https://severalnines.com/downloads/cmon/install-cc chmod +x ./install-cc sed -i 's/\/var\/lib\/mysql\/mysql.sock/\/var\/run\/mysqld\/mysqld.sock/g' ./install-cc read -n 1 -p "Are you sure you wish to remove Cluster Control and all data (Y/n)?" choice case "$choice" in [Nn]) echo '';; * ) echo '' apt remove --purge -y clustercontrol* apt remove --purge -y mysql-server* apt remove --purge -y "mysql*" "*s9s*" apache2 "php*" apt --purge -y autoremove apt clean rm -Rf /etc/cmon.d rm -Rf /var/www/clustercontrol rm -Rf /var/lib/cmon rm -Rf /var/lib/prometheus rm -Rf /etc/apache2 rm -Rf /var/www rm -Rf /etc/php rm -Rf /root/.s9s rm -Rf /etc/s9s.conf rm -f /etc/ssl/certs/s9server* rm -Rf /root/s9s_tmp find /etc -iname "*cmon*" -exec rm {} \; /root/install-cc --uninstall echo '' ;; esac read -n 1 -p "Would you like to now re-install Cluster Control (Y/n)?" choice case "$choice" in [Nn]) echo ''; exit 0;; * ) echo -e "Server 1: Pri MySQL & PostgreSQL\nServer 2: LAN & WAN MySQL" read -n 1 -p "Select which server to install(1/2)? " serverchoice case "${serverchoice}" in [Nn]) echo ''; exit 0;; * ) ./install-cc -1 /opt/copycerts.sh # apt install -y mailutils xtrabackup apt install -y mailutils echo echo read -p "Enter a password to set for the Admin account in MySQL: " pwd echo echo "Enter the root MySQL password:" mysql -u root -p -e "CREATE USER 'admin'@'%' IDENTIFIED BY '${pwd}';GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION;" read -n 1 -p "Login at https://mysql.scity.us and setup the admin user, verify it brings up the deploy prompt. Once complete then press ENTER" choice2 echo echo echo "Importing Previous Database Clusters" if [ "${serverchoice}" == "1" ]; then /usr/bin/s9s cluster --register \ --cluster-type=galera \ --nodes="10.10.1.51;10.10.1.52;10.2.1.51" \ --vendor=mariadb \ --provider-version=10.4 \ --db-admin="root" \ --db-admin-passwd='Dc$@54115' \ --os-user=root \ --os-key-file=/root/.ssh/id_rsa \ --cluster-name="iDS-MySQL-Galera" \ --wait /usr/bin/s9s cluster --register \ --cluster-type=postgresql \ --nodes="10.10.0.211;10.10.0.212" \ --vendor=mariadb \ --provider-version=13 \ --db-admin="root" \ --db-admin-passwd='Dc$@54115' \ --os-user=root \ --os-key-file=/root/.ssh/id_rsa \ --cluster-name="IDS-Headscale-PostgreSQL" \ --wait elif [ "${serverchoice}" == "2" ]; then /usr/bin/s9s cluster --register \ --cluster-type=galera \ --nodes="100.100.55.2;100.100.55.3;100.100.55.4" \ --vendor=mariadb \ --provider-version=10.6 \ --db-admin="root" \ --db-admin-passwd='Dc$@54115' \ --os-user=root \ --os-key-file=/root/.ssh/id_rsa \ --cluster-name="iDS-WAN-DNS-MySQL-Galera" \ --wait /usr/bin/s9s cluster --register \ --cluster-type=galera \ --nodes="100.100.10.1;100.100.10.2;100.100.10.3" \ --vendor=mariadb \ --provider-version=10.6 \ --db-admin="root" \ --db-admin-passwd='Dc$@54115' \ --os-user=root \ --os-key-file=/root/.ssh/id_rsa \ --cluster-name="iDS-LAN-DNS-MySQL-Galera" \ --wait fi # bash <(curl -sL https://git.schroedercity.com/voltron/Misc-Scripts/raw/master/install-postfix.sh) echo echo "Install Completed" ;; esac exit 0