percona_xtradb_cluster_galera
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
| percona_xtradb_cluster_galera [2020-12-10 13:49:22] – manfred | percona_xtradb_cluster_galera [2021-10-26 16:21:01] (aktuell) – [DB-Basis-Installation] manfred | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| + | ====== Percona XtraDB Cluster + Galera ====== | ||
| + | |||
| + | * [[http:// | ||
| + | * **[[http:// | ||
| + | |||
| + | [[https:// | ||
| + | * Port **3306 TCP** - mysql | ||
| + | * Port **4444 TCP** - used for SST (State Snapshot Transfer) | ||
| + | * Port **4567 UDP+TCP** - used by Galera for inter-node communication | ||
| + | * Port **4568 TCP** (< | ||
| + | * zusätzliches: | ||
| + | * '' | ||
| + | * '' | ||
| + | * damit längere SST-Übertragungen nicht von SystemD unterbrochen werden: | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | |||
| + | ===== DB-Basis-Installation ===== | ||
| + | |||
| + | * [[https:// | ||
| + | |||
| + | PXC-Repository (8.0): | ||
| + | > echo "deb http:// | ||
| + | > echo "deb http:// | ||
| + | > echo "deb http:// | ||
| + | > apt update | ||
| + | > apt install percona-xtradb-cluster-server percona-xtrabackup-80 | ||
| + | |||
| + | oder so: | ||
| + | > apt install wget gnupg2 lsb-release curl qpress | ||
| + | > wget https:// | ||
| + | > dpkg -i percona-release_latest.generic_all.deb | ||
| + | | ||
| + | > cat / | ||
| + | # | ||
| + | # This repo is managed by " | ||
| + | # | ||
| + | deb http:// | ||
| + | deb-src http:// | ||
| + | | ||
| + | > apt update | ||
| + | > apt install percona-release | ||
| + | | ||
| + | > percona-release enable pxc-80 release | ||
| + | > percona-release enable pxb-80 release | ||
| + | > percona-release enable tools release | ||
| + | | ||
| + | > percona-release show | ||
| + | The following repositories are enabled on your system: | ||
| + | aptrelease | ||
| + | pxb-80 - release | ||
| + | pxc-80 - release | ||
| + | tools - release | ||
| + | <*> All done! | ||
| + | | ||
| + | > apt update | ||
| + | > apt install percona-xtradb-cluster-server percona-xtrabackup-80 | ||
| + | |||
| + | |||
| + | ===== DB-Konfiguration ===== | ||
| + | |||
| + | < | ||
| + | # | ||
| + | # https:// | ||
| + | # | ||
| + | # Bei " | ||
| + | # https:// | ||
| + | # https:// | ||
| + | # sonst kommt es zu dem Fehler: | ||
| + | # [ERROR] WSREP: Requesting state transfer failed: -113(No route to host) | ||
| + | # Most likely it is due to inability to communicate with the cluster primary component. Restart required. | ||
| + | # Ein Komma an Ender der Zeile besagt, dass auch dynamisch nach anderen Hostnamen gesucht werden darf | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | ### Standard für DB: 3306 | ||
| + | port = 3306 | ||
| + | bind-address | ||
| + | # | ||
| + | ### Standard für SST: 4444 | ||
| + | wsrep_sst_receive_address | ||
| + | wsrep_sst_donor | ||
| + | # | ||
| + | ### Standard für InterCom: 4567 | ||
| + | # | ||
| + | wsrep_cluster_address | ||
| + | wsrep_node_address | ||
| + | # | ||
| + | ### Standard für IST / replication: | ||
| + | ### https:// | ||
| + | ### https:// | ||
| + | wsrep_provider_options | ||
| + | # | ||
| + | # | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Ubuntu-Installation ===== | ||
| + | |||
| + | //Als erstes muss ein frisches " | ||
| + | |||
| + | erstmal alle neuen Updates installieren: | ||
| + | > aptitude update && aptitude -y safe-upgrade && aptitude autoclean | ||
| + | |||
| + | diese Software brauche ich: | ||
| + | > aptitude install ssh vim mc screen sysstat links | ||
| + | |||
| + | diese Software beschleunigt die DB: | ||
| + | > aptitude install libaio1 | ||
| + | |||
| + | damit wir weitere GPG-Schlüssel importieren können: | ||
| + | > aptitude install python-software-properties | ||
| + | |||
| + | |||
| + | ===== Galera ===== | ||
| + | |||
| + | * [[http:// | ||
| + | * [[http:// | ||
| + | |||
| + | von der [[https:// | ||
| + | * [[https:// | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | |||
| + | ===== Percona ===== | ||
| + | |||
| + | * [[http:// | ||
| + | * [[http:// | ||
| + | |||
| + | GPG-Schlüssel holen: | ||
| + | * [[http:// | ||
| + | * [[http:// | ||
| + | |||
| + | apt-key adv --keyserver keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A | ||
| + | |||
| + | |||
| + | === Percona-GPG-Schlüssel === | ||
| + | |||
| + | * [[http:// | ||
| + | |||
| + | < | ||
| + | -----BEGIN PGP PUBLIC KEY BLOCK----- | ||
| + | Version: GnuPG v1.4.11 (GNU/Linux) | ||
| + | |||
| + | mQGiBEsm3aERBACyB1E9ixebIMRGtmD45c6c/ | ||
| + | AX63hhEs4MUCGO7KnON1hpjuNN7MQZtGTJC0iX97X2Mk+IwB1KmBYN9sS/ | ||
| + | itj2RAkug4PFHR9dy21v0flj66KjBS3GpuOadpcrZ/ | ||
| + | f/ | ||
| + | YQunRlhB9f9QUFfhfnjRn8wjeYasMARDctCde5nbx3Pc+nRIXoB4D1Z1ZxRzR/ | ||
| + | 7S4i8KRr9xhommFnDv/ | ||
| + | 7DV3BACj1cBwCf8tckWsvFtQfCP4CiBB50Ku49MU2Nfwq7durfIiePF4IIYRDZgg | ||
| + | kHKSfP3oUZBGJx00BujtTobERraaV7lIRIwETZao76MqGt9K1uIqw4NT/ | ||
| + | rFaOmAkaujbcB11HYIyjtkAGq9mXxaVqCC3RPWGr+fqAx/ | ||
| + | eVNRTCBEZXZlbG9wbWVudCBUZWFtIDxteXNxbC1kZXZAcGVyY29uYS5jb20+iGAE | ||
| + | ExECACAFAksm3aECGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAKCRAcTL3NzS79 | ||
| + | Kpk/ | ||
| + | Ag0ESybdoRAIAKKUV8rbqlB8qwZdWlmrwQqg3o7OpoAJ53/ | ||
| + | lHkwGqEqfbFYoTbOCEEJi2yFLg9UJCSBM/ | ||
| + | O0PzVAF7rCnWaIz76iY+AMI6xKeRy91TxYo/ | ||
| + | chAExMTgbnoPx1ka1Vqbe6iza+FnJq3f4p9luGbZdSParGdlKhGqvVUJ3FLeLTqt | ||
| + | caOn5cN2ZsdakE07GzdSktVtdYPT5BNMKgOAxhXKy11IPLj2Z5C33iVYSXjpTelJ | ||
| + | b2qHvcg9XDMhmYJyE3O4AWFh2no3Jf4ypIcABA0IAJO8ms9ov6bFqFTqA0UW2gWQ | ||
| + | cKFN4Q6NPV6IW0rV61ONLUc0VFXvYDtwsRbUmUYkB/ | ||
| + | / | ||
| + | eEihtcjltGAoS54+6C3lbjrHUQhLwPGqlAh8uZKzfSZq0C06kTxiEqsG6VDDYWy6 | ||
| + | L7qaMwOqWdQtdekKiCk8w/ | ||
| + | ZSL00Mx+g3NA7pQ1Yo5Vhok034mP8L2fBLhhWaK3LG63jYvd0HLkUFhNG+xjkpeI | ||
| + | SQQYEQIACQUCSybdoQIbDAAKCRAcTL3NzS79KlacAJ9H6emL/ | ||
| + | eMTmmQCfXRLIoNjJa20VEwJDzR7YVdBEiQI= | ||
| + | =AD5m | ||
| + | -----END PGP PUBLIC KEY BLOCK----- | ||
| + | </ | ||
| + | |||
| + | |||
| + | ==== Installation des Percona-Repository' | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | |||
| + | === Percona GPG-Key ==== | ||
| + | |||
| + | Um die Authentizität der Percona-Pakete zu verifizieren benötig aptitude deren öffentlichen GPG-Schlüssel. | ||
| + | \\ [[http:// | ||
| + | |||
| + | |||
| + | ==== Percona XtraDB Cluster + Galera - Grundinstallation - Ubuntu 16.04 ==== | ||
| + | |||
| + | > apt install percona-xtradb-cluster-57 | ||
| + | |||
| + | > dpkg -L percona-xtradb-cluster-server-5.7 | fgrep libgalera_smm.so | ||
| + | / | ||
| + | / | ||
| + | | ||
| + | > vi / | ||
| + | ... | ||
| + | wsrep_provider | ||
| + | ... | ||
| + | |||
| + | |||
| + | ==== " | ||
| + | |||
| + | * [[http:// | ||
| + | * [[https:// | ||
| + | |||
| + | |||
| + | === Vorbereitungen === | ||
| + | |||
| + | Repository einrichten: | ||
| + | > echo 'deb http:// | ||
| + | > aptitude update | ||
| + | |||
| + | die XtraDB hat nach der Installation keine '' | ||
| + | > echo ' | ||
| + | |||
| + | > vi / | ||
| + | < | ||
| + | # | ||
| + | [client] | ||
| + | |||
| + | # This will be passed to all mysql clients | ||
| + | # It has been reported that passwords should be enclosed with ticks/ | ||
| + | # escpecially if they contain "#" | ||
| + | # Remember to edit / | ||
| + | port = 3306 | ||
| + | socket | ||
| + | default_character_set | ||
| + | |||
| + | # | ||
| + | [mysql] | ||
| + | default_character_set | ||
| + | |||
| + | # | ||
| + | [mysqld_safe] | ||
| + | socket | ||
| + | nice = 0 | ||
| + | |||
| + | # | ||
| + | [server] | ||
| + | sql-mode="" | ||
| + | |||
| + | # | ||
| + | [mysqld] | ||
| + | pid_file | ||
| + | log_bin | ||
| + | relay_log | ||
| + | log_error | ||
| + | log_warnings | ||
| + | # | ||
| + | |||
| + | character_set_server | ||
| + | collation_server | ||
| + | # | ||
| + | skip_character_set_client_handshake | ||
| + | ### http:// | ||
| + | max_connect_errors | ||
| + | max_connections | ||
| + | connect_timeout | ||
| + | interactive_timeout | ||
| + | wait_timeout | ||
| + | expire_logs_days | ||
| + | sync_binlog | ||
| + | log_slave_updates | ||
| + | local_infile | ||
| + | auto_increment_offset | ||
| + | auto_increment_increment | ||
| + | |||
| + | # | ||
| + | ### | ||
| + | ### muss ein vielfaches von 256 sein | ||
| + | ### Standard vor MySQL 5.6 ist 1024 | ||
| + | ### Standard ab MySQL 5.6 ist 8192 | ||
| + | binlog_row_event_max_size | ||
| + | ### | ||
| + | ### http:// | ||
| + | ### | ||
| + | ### statement: anweisungsbasierte Replikation (Statement-Based Replication, | ||
| + | ### row: datensatzbasierte Replikation (Row-Based Replication, | ||
| + | ### Standard vor MySQL 5.1.12 ist STATEMENT | ||
| + | ### Standard ab MySQL 5.1.12 ist MIXED | ||
| + | ### | ||
| + | ### http:// | ||
| + | ### Bei nichtdeterministischer Datenmodifikation ist nur " | ||
| + | # Standard in " | ||
| + | binlog_format | ||
| + | # | ||
| + | # Standard seit MySQL 5.5.7: 0 | ||
| + | innodb_file_per_table | ||
| + | # | ||
| + | # | ||
| + | # Standard in MySQL 5.5: 0 | ||
| + | innodb_locks_unsafe_for_binlog | ||
| + | # Standard in MySQL 5.5: 1 | ||
| + | innodb_autoinc_lock_mode | ||
| + | # Standard in MySQL 5.5: 8M | ||
| + | # | ||
| + | # Standard in MySQL 5.5: 0 | ||
| + | innodb_thread_concurrency | ||
| + | |||
| + | # | ||
| + | ### Einstellungen von der alten Dialing-DB (MySQL 5.1) | ||
| + | |||
| + | ### key_buffer_size + (read_buffer_size + sort_buffer_size) * max_connections = K bytes of memory | ||
| + | key_buffer_size | ||
| + | # [Warning] The syntax ' | ||
| + | # | ||
| + | max_allowed_packet | ||
| + | max_heap_table_size | ||
| + | # query_cache_limit | ||
| + | # query_cache_size | ||
| + | # query_cache_type | ||
| + | slow_query_log_file | ||
| + | # sql_auto_is_null | ||
| + | table_open_cache | ||
| + | thread_cache_size | ||
| + | tmp_table_size | ||
| + | |||
| + | # | ||
| + | </ | ||
| + | |||
| + | |||
| + | Percona XtraDB Cluster installieren: | ||
| + | > aptitude install percona-xtradb-cluster-galera percona-xtradb-cluster-client-5.5 percona-xtradb-cluster-server-5.5 percona-xtradb-cluster-common-5.5 libmysqlclient18 tinyca | ||
| + | | ||
| + | ... | ||
| + | | ||
| + | * Percona XtraDB Cluster is distributed with several useful UDF (User Defined Function) from Percona Toolkit. | ||
| + | * Run the following commands to create these functions: | ||
| + | | ||
| + | mysql -e " | ||
| + | mysql -e " | ||
| + | mysql -e " | ||
| + | | ||
| + | * See http:// | ||
| + | | ||
| + | | ||
| + | * Starting MySQL (Percona XtraDB Cluster) database server mysqld | ||
| + | ... | ||
| + | | ||
| + | > update-rc.d mysql enable 2345 | ||
| + | > echo " | ||
| + | > chmod 0600 ~/.my.cnf | ||
| + | | ||
| + | > mysqlshow | ||
| + | |||
| + | den [[http:// | ||
| + | > echo "GRANT RELOAD, LOCK TABLES, REPLICATION CLIENT ON *.* TO ' | ||
| + | |||
| + | root-Zugriff soll auch von außen funktionieren | ||
| + | > echo " | ||
| + | > echo " | ||
| + | > echo " | ||
| + | > mysqladmin reload | ||
| + | |||
| + | so verhindert man (bei Bedarf) das automatische updaten der DB (siehe auch [[http:// | ||
| + | > echo ' | ||
| + | > echo 'Pin: release o=Percona Development Team' >> / | ||
| + | > echo ' | ||
| + | |||
| + | bei Startproblemen stehen die Log-Daten in der letzten tmp-Datei im "/ | ||
| + | > ls -rtlh /tmp/tmp.* | ||
| + | -rw------- 1 mysql root 18K 2013-09-23 17:39 / | ||
| + | -rw------- 1 mysql root 18K 2013-09-24 11:26 / | ||
| + | | ||
| + | > cat / | ||
| + | InnoDB: using the same InnoDB data or log files. | ||
| + | InnoDB: Unable to lock ./ibdata1, error: 11 | ||
| + | InnoDB: Check that you do not already have another mysqld process | ||
| + | InnoDB: using the same InnoDB data or log files. | ||
| + | InnoDB: Unable to lock ./ibdata1, error: 11 | ||
| + | InnoDB: Check that you do not already have another mysqld process | ||
| + | InnoDB: using the same InnoDB data or log files. | ||
| + | InnoDB: Unable to lock ./ibdata1, error: 11 | ||
| + | InnoDB: Check that you do not already have another mysqld process | ||
| + | InnoDB: using the same InnoDB data or log files. | ||
| + | 130924 13: | ||
| + | InnoDB: Error in opening ./ibdata1 | ||
| + | 130924 13: | ||
| + | InnoDB: Error number 11 means ' | ||
| + | InnoDB: Some operating system error numbers are described at | ||
| + | InnoDB: http:// | ||
| + | 130924 13:58:36 InnoDB: Could not open or create data files. | ||
| + | 130924 13:58:36 InnoDB: If you tried to add new data files, and it failed here, | ||
| + | 130924 13:58:36 InnoDB: you should now edit innodb_data_file_path in my.cnf back | ||
| + | 130924 13:58:36 InnoDB: to what it was, and remove the new ibdata files InnoDB created | ||
| + | 130924 13:58:36 InnoDB: in this failed attempt. InnoDB only wrote those files full of | ||
| + | 130924 13:58:36 InnoDB: zeros, but did not yet use them in any way. But be careful: do not | ||
| + | 130924 13:58:36 InnoDB: remove old data files which contain your precious data! | ||
| + | 130924 13:58:36 [ERROR] Plugin ' | ||
| + | 130924 13:58:36 [ERROR] Plugin ' | ||
| + | 130924 13:58:36 [ERROR] Unknown/ | ||
| + | 130924 13:58:36 [ERROR] Aborting | ||
| + | | ||
| + | 130924 13:58:36 [Note] / | ||
| + | |||
| + | Bei diesem Fehler ('' | ||
| + | d.h. es läuft noch ein MySQL-Prozess: | ||
| + | > ps alx | fgrep -v grep | fgrep mysql | ||
| + | 4 0 12123 | ||
| + | 4 106 12754 12123 20 0 1855536 133468 poll_s Sl ? 0:02 / | ||
| + | |||
| + | den kann man z.B. so beenden: | ||
| + | > killall / | ||
| + | |||
| + | Jetzt noch ein paar Sekunden warten und dann sollte kein mysql-Prozess mehr laufen und die DB wieder starten können: | ||
| + | > ps alx | fgrep -v grep | fgrep mysql | ||
| + | > service mysql start | ||
| + | * Stopping MySQL (Percona XtraDB Cluster) mysqld | ||
| + | * Starting MySQL (Percona XtraDB Cluster) database server mysqld | ||
| + | |||
| + | |||
| + | === debian-sys-maint === | ||
| + | |||
| + | **An dieser Stelle sollte sicher gestellt werden, dass alle zukünftigen Cluster-Knoten für den Benutzer " | ||
| + | > cat / | ||
| + | # Automatically generated for Debian scripts. DO NOT TOUCH! | ||
| + | [client] | ||
| + | host = localhost | ||
| + | user = debian-sys-maint | ||
| + | password = 455uoHrKFLHFNwgP | ||
| + | socket | ||
| + | [mysql_upgrade] | ||
| + | host = localhost | ||
| + | user = debian-sys-maint | ||
| + | password = 455uoHrKFLHFNwgP | ||
| + | socket | ||
| + | basedir | ||
| + | | ||
| + | > mysqlshow -udebian-sys-maint -p455uoHrKFLHFNwgP | ||
| + | +--------------------+ | ||
| + | | | ||
| + | +--------------------+ | ||
| + | | information_schema | | ||
| + | | dialing | ||
| + | | mysql | | ||
| + | | performance_schema | | ||
| + | +--------------------+ | ||
| + | |||
| + | Um diesen Benutzer auch auf den anderen Knoten dieses Passwort zu geben, muss das ausgewählte Passwort in der Datei //"/ | ||
| + | > echo " | ||
| + | > mysqladmin reload | ||
| + | |||
| + | |||
| + | ==== Konfiguration ==== | ||
| + | |||
| + | * [[http:// | ||
| + | * [[http:// | ||
| + | * [[http:// | ||
| + | |||
| + | Tuning: | ||
| + | * [[http:// | ||
| + | * [[http:// | ||
| + | * [[http:// | ||
| + | * [[http:// | ||
| + | * [[https:// | ||
| + | - '' | ||
| + | - '' | ||
| + | - '' | ||
| + | * [[http:// | ||
| + | |||
| + | * [[Galera-Beispiel für clustereinstellungen.cnf]] | ||
| + | |||
| + | > vi / | ||
| + | < | ||
| + | # | ||
| + | [mysqld] | ||
| + | server_id | ||
| + | report_host | ||
| + | |||
| + | # | ||
| + | # | ||
| + | |||
| + | # | ||
| + | ### Galera-Optionen | ||
| + | # | ||
| + | wsrep_node_address | ||
| + | wsrep_node_name | ||
| + | wsrep_cluster_name | ||
| + | # | ||
| + | # Replikations-Benutzer und -Passwort | ||
| + | wsrep_sst_auth | ||
| + | # | ||
| + | # IPs der Clustermitglieder, | ||
| + | # beim Start des ersten Node muss diese Variable leer sein (nach dem ergänzen: service mysql bootstrap-pxc) | ||
| + | wsrep_cluster_address | ||
| + | # | ||
| + | # | ||
| + | wsrep_slave_threads | ||
| + | wsrep_sst_method | ||
| + | wsrep_sst_auth | ||
| + | # | ||
| + | ### Ubuntu 10.04 LTS | ||
| + | # | ||
| + | # | ||
| + | ### Ubuntu 12.04 LTS | ||
| + | wsrep_provider | ||
| + | # | ||
| + | wsrep_provider_options | ||
| + | wsrep_certify_nonPK | ||
| + | # | ||
| + | </ | ||
| + | |||
| + | '' | ||
| + | # echo " | ||
| + | |||
| + | **Bei meinen Tests hat es noch nie funktioniert, | ||
| + | |||
| + | weitere Tips: | ||
| + | * [[http:// | ||
| + | * [[http:// | ||
| + | * [[http:// | ||
| + | |||
| + | |||
| + | === die drei Knoten nacheinander hochfahren === | ||
| + | |||
| + | * [[http:// | ||
| + | |||
| + | Kurzfassung der Arbeitsschritte: | ||
| + | - __auf Knoten 1__ MySQL hochfahren | ||
| + | - __auf Knoten 2__ MySQL hochfahren | ||
| + | - __auf Knoten 1__ den 2. Knoten zur MySQL-CFG hinzufühgen | ||
| + | - __auf Knoten 1__ Cluster-Reload ausführen: '' | ||
| + | - __auf Knoten 3__ MySQL hochfahren | ||
| + | - __auf Knoten 1__ den 3. Knoten zur MySQL-CFG hinzufühgen | ||
| + | - __auf Knoten 1__ Cluster-Reload ausführen: '' | ||
| + | - __auf Knoten 2__ den 3. Knoten zur MySQL-CFG hinzufühgen | ||
| + | - __auf Knoten 2__ Cluster-Reload ausführen: '' | ||
| + | |||
| + | |||
| + | == Knoten 1 hochfahren == | ||
| + | |||
| + | > vi / | ||
| + | ... | ||
| + | wsrep_cluster_address | ||
| + | ... | ||
| + | |||
| + | MySQL starten: | ||
| + | > service mysql start | ||
| + | * Stopping MySQL (Percona XtraDB Cluster) mysqld | ||
| + | * Starting MySQL (Percona XtraDB Cluster) database server mysqld | ||
| + | |||
| + | |||
| + | == Knoten 2 hochfahren == | ||
| + | |||
| + | > vi / | ||
| + | ... | ||
| + | wsrep_cluster_address | ||
| + | ... | ||
| + | |||
| + | MySQL starten: | ||
| + | > service mysql start | ||
| + | * Stopping MySQL (Percona XtraDB Cluster) mysqld | ||
| + | * Starting MySQL (Percona XtraDB Cluster) database server mysqld | ||
| + | * SST in progress, setting sleep higher mysqld | ||
| + | |||
| + | __Wenn in der DB von //Knoten 1// viele Daten drin sind, dann wird es länger dauern, bis der Startvorgang durchgeführt ist, weil in diesem Schritt automatisch eine Syncronisation inbegriffen ist!__ | ||
| + | |||
| + | |||
| + | == Knoten 1 bootstrap-pxc == | ||
| + | |||
| + | damit der erste Knoten starten kann, muss "'' | ||
| + | > vi / | ||
| + | ... | ||
| + | safe_to_bootstrap: | ||
| + | |||
| + | > vi / | ||
| + | ... | ||
| + | wsrep_cluster_address | ||
| + | ... | ||
| + | |||
| + | Cluster-Reload ausführen: | ||
| + | > service mysql bootstrap-pxc | ||
| + | |||
| + | |||
| + | == Knoten 3 hochfahren == | ||
| + | |||
| + | > vi / | ||
| + | ... | ||
| + | wsrep_cluster_address | ||
| + | ... | ||
| + | |||
| + | MySQL starten: | ||
| + | > service mysql start | ||
| + | * Stopping MySQL (Percona XtraDB Cluster) mysqld | ||
| + | * Starting MySQL (Percona XtraDB Cluster) database server mysqld | ||
| + | * SST in progress, setting sleep higher mysqld | ||
| + | |||
| + | __Wenn in der DB von //Knoten 1// viele Daten drin sind, dann wird es länger dauern, bis der Startvorgang durchgeführt ist, weil in diesem Schritt automatisch eine Syncronisation inbegriffen ist!__ | ||
| + | |||
| + | |||
| + | == Knoten 1 bootstrap-pxc == | ||
| + | |||
| + | vi / | ||
| + | ... | ||
| + | wsrep_cluster_address | ||
| + | ... | ||
| + | |||
| + | Cluster-Reload ausführen: | ||
| + | > service mysql bootstrap-pxc | ||
| + | |||
| + | |||
| + | == Knoten 2 bootstrap-pxc == | ||
| + | |||
| + | vi / | ||
| + | ... | ||
| + | wsrep_cluster_address | ||
| + | ... | ||
| + | |||
| + | Cluster-Reload ausführen: | ||
| + | > service mysql bootstrap-pxc | ||
| + | |||
| + | |||
| + | ===== MySQL-Fehlermeldungen im Galera-Cluster ===== | ||
| + | |||
| + | |||
| + | === Fehlermeldung " | ||
| + | |||
| + | ERROR 1045 (28000): Access denied for user ' | ||
| + | |||
| + | Dieser Fehler besagt, dass das Passwort in der Datei "/ | ||
| + | Diese Datei muss auf allen Knoten des Clusters identisch sein. | ||
| + | Um das Problem zu lösen, sucht man sich einen Knoten, auf dem diesen Kommando fehlerfrei ausgeführt werden kann und übernimmt von ihm diese Datei: | ||
| + | > mysqlshow -u$(awk '/ | ||
| + | +--------------------+ | ||
| + | | | ||
| + | +--------------------+ | ||
| + | | information_schema | | ||
| + | | mysql | | ||
| + | | performance_schema | | ||
| + | +--------------------+ | ||
| + | |||
| + | |||
| + | === Fehlermeldung " | ||
| + | |||
| + | ERROR 1047 (08S01) at line 1: Unknown command | ||
| + | |||
| + | Diese Fehlermeldung besagt, dass dieser Knoten nicht mit den anderen Knoten synchron ist. | ||
| + | Das kann verschiedene Ursachen haben: | ||
| + | - Verbindungsprobleme (Abrisse bzw. Unterbrechungen); | ||
| + | - in einen anderen Knoten wird so intensiev reingeschrieben, | ||
| + | |||
| + | Ob eine Verbindung zwischen den Knoten besteht, kann mit diesem Kommando erkannt werden: | ||
| + | > echo "SHOW STATUS LIKE ' | ||
| + | |||
| + | |||
| + | === Fehlermeldung " | ||
| + | |||
| + | ERROR 1548 (HY000) at line 1: Cannot load from mysql.proc. The table is probably corrupted | ||
| + | |||
| + | Diese Fehlermeldung deutet auf eine veraltete Tabellen-Struktur hin und konnte bei mir durch dieses Kommando beseitigt werden: | ||
| + | > mysql_upgrade --force | ||
| + | |||
| + | Es kann aber auch an einer defekten Tabelle liegen, dann sollte man dieses Kommado ausprobieren: | ||
| + | > mysqlcheck -Ag --auto-repair | ||
| + | |||
| + | |||
| + | ===== ein paar Kontrollkommandos ===== | ||
| + | |||
| + | < | ||
| + | #!/bin/bash | ||
| + | |||
| + | P=" | ||
| + | # | ||
| + | |||
| + | #echo "SHOW STATUS like ' | ||
| + | |||
| + | echo " | ||
| + | SHOW STATUS LIKE ' | ||
| + | SHOW STATUS LIKE ' | ||
| + | SHOW STATUS LIKE ' | ||
| + | SHOW STATUS LIKE ' | ||
| + | SHOW STATUS LIKE ' | ||
| + | SHOW VARIABLES LIKE ' | ||
| + | SHOW FULL PROCESSLIST; | ||
| + | " | mysql -${P} | ||
| + | </ | ||
| + | |||
| + | > echo "SHOW STATUS LIKE ' | ||
| + | +--------------------+-------+ | ||
| + | | Variable_name | ||
| + | +--------------------+-------+ | ||
| + | | wsrep_cluster_size | 3 | | ||
| + | +--------------------+-------+ | ||
| + | +--------------------------+----------------------------------------------------+ | ||
| + | | Variable_name | ||
| + | +--------------------------+----------------------------------------------------+ | ||
| + | | wsrep_incoming_addresses | 10.30.3.153: | ||
| + | +--------------------------+----------------------------------------------------+ | ||
| + | +-----------------+-------+ | ||
| + | | Variable_name | ||
| + | +-----------------+-------+ | ||
| + | | wsrep_connected | ON | | ||
| + | +-----------------+-------+ | ||
| + | +----------------------+-------+ | ||
| + | | Variable_name | ||
| + | +----------------------+-------+ | ||
| + | | wsrep_last_committed | 8628 | | ||
| + | +----------------------+-------+ | ||
| + | +---------------------------+--------+ | ||
| + | | Variable_name | ||
| + | +---------------------------+--------+ | ||
| + | | wsrep_local_state_comment | Synced | | ||
| + | +---------------------------+--------+ | ||
| + | |||
| + | Anzahl der Spalten und der Zeilen jeder einzelnen Tabelle ausgeben: | ||
| + | > mysqlshow --count Datenbank_X | ||
| + | Database: Datenbank_X | ||
| + | +---------------------+----------+------------+ | ||
| + | | | ||
| + | +---------------------+----------+------------+ | ||
| + | |||
| + | weitere Infos über die einzelnen Tabellen aus der DB ausgeben: | ||
| + | > mysqlshow -i Datenbank_X | ||
| + | Database: Datenbank_X | ||
| + | +---------------------+--------+---------+------------+---------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-------------------+----------+----------------+--------------------------------+ | ||
| + | | Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | ||
| + | +---------------------+--------+---------+------------+---------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-------------------+----------+----------------+--------------------------------+ | ||
| + | |||
| + | |||
| + | ===== DB komplett neu initialisieren ===== | ||
| + | |||
| + | Um ein unerwünschtes DB-System komplett neu zu initialisieren, | ||
| + | Es müssen nur die beiden eigenen CNF-Dateien bereitgelegt werden: | ||
| + | > vi / | ||
| + | > vi / | ||
| + | |||
| + | Dann muss man nur noch wissen, welches " | ||
| + | |||
| + | < | ||
| + | #!/bin/bash | ||
| + | |||
| + | # | ||
| + | # ein Percona-XTRADB-Cluster-Knoten wird komplett neu reinitialisiert | ||
| + | # alle Daten von diesem Knoten werden komplett gelöscht | ||
| + | # und sollten sich nach Abschluss der Prozedur aus dem Cluster wieder | ||
| + | # replizieren | ||
| + | # | ||
| + | |||
| + | PERCONAXTRADBCLUSTERSERVER=" | ||
| + | if [ -z " | ||
| + | echo "hier ist kein Percona-XTRADB-Cluster installiert" | ||
| + | exit 0 | ||
| + | fi | ||
| + | |||
| + | service mysql stop | ||
| + | sleep 1 | ||
| + | killall mysqld 2>/ | ||
| + | sleep 1 | ||
| + | killall -9 mysqld 2>/ | ||
| + | sleep 1 | ||
| + | |||
| + | tar czf / | ||
| + | dpkg -P " | ||
| + | rm -fr /etc/mysql/ / | ||
| + | tar xzf / | ||
| + | mv -v / | ||
| + | aptitude install " | ||
| + | # | ||
| + | |||
| + | # | ||
| + | # | ||
| + | #echo " | ||
| + | #echo " | ||
| + | #echo "GRANT RELOAD, LOCK TABLES, REPLICATION CLIENT ON *.* TO ' | ||
| + | echo " | ||
| + | |||
| + | mv -v / | ||
| + | service mysql stop | ||
| + | sleep 1 | ||
| + | killall mysqld 2>/ | ||
| + | sleep 1 | ||
| + | killall -9 mysqld 2>/ | ||
| + | sleep 2 | ||
| + | service mysql start | ||
| + | |||
| + | echo "SHOW STATUS like ' | ||
| + | echo " | ||
| + | </ | ||
| + | |||
