mysql-repository_fuer_ubuntu_einbinden
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
| mysql-repository_fuer_ubuntu_einbinden [2016-04-27 07:48:28] – [Ubuntu 14.04 LTS (trusty)] manfred | mysql-repository_fuer_ubuntu_einbinden [2018-04-12 14:08:42] (aktuell) – manfred | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| + | ====== MySQL-Repository für Ubuntu einbinden ====== | ||
| + | |||
| + | * [[http:// | ||
| + | * [[http:// | ||
| + | |||
| + | |||
| + | ===== Ubuntu 14.04 LTS (trusty) ===== | ||
| + | |||
| + | * [[http:// | ||
| + | * [[http:// | ||
| + | |||
| + | Repository eintragen: | ||
| + | > vi / | ||
| + | ### http:// | ||
| + | deb http:// | ||
| + | deb http:// | ||
| + | deb http:// | ||
| + | deb http:// | ||
| + | deb http:// | ||
| + | deb http:// | ||
| + | deb http:// | ||
| + | |||
| + | GPG-Schlüssel von MySQL ([[http:// | ||
| + | > apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 5072E1F5 | ||
| + | > apt-key export 5072E1F5 > mysql_pubkey.asc | ||
| + | > vi mysql_pubkey.asc | ||
| + | |||
| + | GPG-Schlüssel für das Repository importieren: | ||
| + | > gpg --import mysql_pubkey.asc | ||
| + | > apt-key add mysql_pubkey.asc | ||
| + | |||
| + | oder | ||
| + | > gpg -a --export 5072E1F5 | apt-key add - | ||
| + | |||
| + | anzeigen lassen | ||
| + | > apt-key list | ||
| + | > aptitude update | ||
| + | |||
| + | MySQL+MySQLFailsafe installieren: | ||
| + | > aptitude install mysql-community-server mysql-utilities | ||
| + | |||
| + | |||
| + | ==== GTID-Replikation aktivieren bzw. Knoten verbinden ==== | ||
| + | |||
| + | In diesem Beispiel soll der Replikations-User //otto// heißen. | ||
| + | |||
| + | |||
| + | === Kürzfassung, | ||
| + | |||
| + | [root@master ~]# echo " | ||
| + | [root@master ~]# echo "GRANT SUPER, | ||
| + | [root@master ~]# mysqladmin reload | ||
| + | [root@master ~]# echo "SHOW GLOBAL VARIABLES LIKE ' | ||
| + | +---------------+--------------------------------------------+ | ||
| + | | Variable_name | Value | | ||
| + | +---------------+--------------------------------------------+ | ||
| + | | gtid_executed | cbca7510-08a2-11e6-a5e0-842b2b60d0af: | ||
| + | +---------------+--------------------------------------------+ | ||
| + | |||
| + | [root@slave ~]# echo "STOP SLAVE; RESET MASTER; RESET SLAVE;" | ||
| + | [root@slave ~]# echo "SET GLOBAL GTID_PURGED=' | ||
| + | [root@slave ~]# echo "SHOW GLOBAL VARIABLES LIKE ' | ||
| + | +---------------+--------------------------------------------+ | ||
| + | | Variable_name | Value | | ||
| + | +---------------+--------------------------------------------+ | ||
| + | | gtid_executed | cbca7510-08a2-11e6-a5e0-842b2b60d0af: | ||
| + | +---------------+--------------------------------------------+ | ||
| + | | ||
| + | [root@slave ~]# echo "STOP SLAVE; CHANGE MASTER TO MASTER_HOST=' | ||
| + | [root@slave ~]# echo "SHOW SLAVE STATUS \G;" | mysql -t | ||
| + | |||
| + | [root@master ~]# echo "SHOW SLAVE HOSTS;" | ||
| + | +-----------+-------+------+-----------+--------------------------------------+ | ||
| + | | Server_id | Host | Port | Master_id | Slave_UUID | ||
| + | +-----------+-------+------+-----------+--------------------------------------+ | ||
| + | | 9992 | slave | 3306 | 9991 | 8a4aff7c-08a2-11e6-98f0-842b2b4f25d0 | | ||
| + | +-----------+-------+------+-----------+--------------------------------------+ | ||
| + | |||
| + | |||
| + | ==== MySQLFailover einrichten ==== | ||
| + | |||
| + | Quelle: [[http:// | ||
| + | |||
| + | In diesem Beispiel soll der Failover-User //amidala// heißen. | ||
| + | |||
| + | > echo " | ||
| + | > echo "GRANT SELECT, SUPER, GRANT OPTION, REPLICATION SLAVE, RELOAD, DROP, CREATE, INSERT ON *.* TO ' | ||
| + | > echo " | ||
| + | > mysqladmin reload | ||
| + | | ||
| + | [root@db01 ~]# mysqlfailover --master=root: | ||
| + | MySQL Replication Failover Utility | ||
| + | Failover Mode = auto Next Interval = Mon Apr 25 12:24:54 2016 | ||
| + | | ||
| + | Master Information | ||
| + | ------------------ | ||
| + | Binary Log File | ||
| + | mysql-bin.000002 | ||
| + | | ||
| + | GTID Executed Set | ||
| + | cbca7510-08a2-11e6-a5e0-842b2b60d0af: | ||
| + | | ||
| + | Replication Health Status | ||
| + | +-------+-------+---------+--------+------------+---------+ | ||
| + | | host | port | role | state | gtid_mode | ||
| + | +-------+-------+---------+--------+------------+---------+ | ||
| + | | db01 | 3306 | MASTER | ||
| + | | db02 | 3306 | SLAVE | UP | ON | OK | | ||
| + | | db03 | 3306 | SLAVE | UP | ON | OK | | ||
| + | +-------+-------+---------+--------+------------+---------+ | ||
| + | |||
| + | |||
| + | === Failover starten === | ||
| + | |||
| + | > mysqlfailover --master=root: | ||
| + | Failover starting in ' | ||
| + | 2016-04-25 16:25:35 PM CRITICAL The server db02:3306 does not comply to the latest GTID feature support. Errors: | ||
| + | Missing gtid_executed system variable. | ||
| + | ERROR: The server db02:3306 does not comply to the latest GTID feature support. Errors: | ||
| + | Missing gtid_executed system variable. | ||
| + | |||
| + | > mysqlrpladmin --slaves=root: | ||
| + | WARNING: Using a password on the command line interface can be insecure. | ||
| + | # Checking privileges. | ||
| + | # Checking privileges on candidates. | ||
| + | # Performing failover. | ||
| + | ERROR: The server db02:3306 does not comply to the latest GTID feature support. Errors: | ||
| + | Missing gtid_executed system variable. | ||
| + | |||
| + | Bug (wurde in //MySQL Utilities 1.6.3// behoben, also erst fehlerfrei in '' | ||
| + | > vi / | ||
| + | ... | ||
| + | 1428 res = self.exec_query(" | ||
| + | ... | ||
| + | |||
| + | unter Verwendung der MySQL-Utilities wird eine Replikation nicht mit dem "'' | ||
| + | [root@slave ~]# mysqlrpladmin --slaves=root: | ||
| + | WARNING: Using a password on the command line interface can be insecure. | ||
| + | # Checking privileges. | ||
| + | # Checking privileges on candidates. | ||
| + | # Performing failover. | ||
| + | # Candidate slave db02:3306 will become the new master. | ||
| + | # Checking slaves status (before failover). | ||
| + | # Preparing candidate for failover. | ||
| + | # Creating replication user if it does not exist. | ||
| + | # Stopping slaves. | ||
| + | # Performing STOP on all slaves. | ||
| + | # Switching slaves to new master. | ||
| + | # Disconnecting new master as slave. | ||
| + | # Starting slaves. | ||
| + | # Performing START on all slaves. | ||
| + | # Checking slaves for errors. | ||
| + | # Failover complete. | ||
| + | # | ||
| + | # Replication Topology Health: | ||
| + | +-------+-------+---------+--------+------------+---------+ | ||
| + | | host | port | role | state | gtid_mode | ||
| + | +-------+-------+---------+--------+------------+---------+ | ||
| + | | db02 | 3306 | MASTER | ||
| + | | db03 | 3306 | SLAVE | UP | ON | OK | | ||
| + | +-------+-------+---------+--------+------------+---------+ | ||
| + | # ...done. | ||
| + | |||
| + | mit dem "'' | ||
| + | [root@master ~]# mysqlfailover --master=root: | ||
| + | MySQL Replication Failover Utility | ||
| + | Failover Mode = auto Next Interval = Mon Apr 25 16:49:07 2016 | ||
| + | | ||
| + | Master Information | ||
| + | ------------------ | ||
| + | Binary Log File | ||
| + | mysql-bin.000003 | ||
| + | | ||
| + | GTID Executed Set | ||
| + | 0d411222-0aed-11e6-81fb-842b2b60d0af: | ||
| + | | ||
| + | Replication Health Status | ||
| + | +-------+-------+---------+--------+------------+---------+ | ||
| + | | host | port | role | state | gtid_mode | ||
| + | +-------+-------+---------+--------+------------+---------+ | ||
| + | | db02 | 3306 | MASTER | ||
| + | | db03 | 3306 | SLAVE | UP | ON | OK | | ||
| + | +-------+-------+---------+--------+------------+---------+ | ||
| + | |||
| + | Nach jedem Schwenk muss der "'' | ||
