wsrep_notify_cmd
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
| wsrep_notify_cmd [2017-11-08 10:19:06] – angelegt manfred | wsrep_notify_cmd [2017-11-08 13:27:43] (aktuell) – manfred | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| + | ====== wsrep_notify_cmd ====== | ||
| + | |||
| + | Mit Hilfe dieser Funktionalität, | ||
| + | |||
| + | <file bash / | ||
| + | #!/bin/bash -e | ||
| + | #!/bin/bash -eu | ||
| + | |||
| + | # | ||
| + | # | ||
| + | # http:// | ||
| + | # http:// | ||
| + | # | ||
| + | # / | ||
| + | # | ||
| + | # [mysqld] | ||
| + | # wsrep_notify_cmd = / | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # Warning! | ||
| + | # | ||
| + | # The node will block and wait until the script completes and returns before it | ||
| + | # can proceed. If the script performs any potentially blocking or long-running | ||
| + | # operations, such as network communication, | ||
| + | # operations in the background and have the script return immediately. | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # SET GLOBAL wsrep_notify_cmd='/ | ||
| + | # SHOW VARIABLES LIKE ' | ||
| + | # | ||
| + | # | ||
| + | |||
| + | # | ||
| + | VERSION=" | ||
| + | |||
| + | LOG="/ | ||
| + | # | ||
| + | # | ||
| + | ETC="/ | ||
| + | |||
| + | DATUM_ZEIT=" | ||
| + | echo " | ||
| + | echo "${0} ${@}" >> | ||
| + | |||
| + | # | ||
| + | |||
| + | # | ||
| + | # | ||
| + | #str=$(grep -E " | ||
| + | # | ||
| + | #if [[ ${str} =~ ${regex} ]] ; then | ||
| + | # | ||
| + | #else | ||
| + | # echo " | ||
| + | # exit 1 | ||
| + | #fi | ||
| + | |||
| + | # | ||
| + | |||
| + | while [ " | ||
| + | case " | ||
| + | --status) | ||
| + | # Undefined, Joiner, Donor, Joined, Synced, Error | ||
| + | STATUS=" | ||
| + | shift | ||
| + | ;; | ||
| + | --uuid) | ||
| + | # The cluster state UUID. | ||
| + | CLUSTER_UUID=" | ||
| + | shift | ||
| + | ;; | ||
| + | --primary) | ||
| + | # yes, no | ||
| + | PRIMARY=" | ||
| + | shift | ||
| + | ;; | ||
| + | --index) | ||
| + | # The index of this node in the node list. | ||
| + | INDEX=" | ||
| + | shift | ||
| + | ;; | ||
| + | --members) | ||
| + | # eine durch Komma getrennte Liste mit UUIDs | ||
| + | MEMBERS=" | ||
| + | shift | ||
| + | ;; | ||
| + | esac | ||
| + | shift | ||
| + | done | ||
| + | |||
| + | # | ||
| + | |||
| + | # echo $* >> ${LOG} | ||
| + | echo " | ||
| + | STATUS=${STATUS} | ||
| + | CLUSTER_UUID=${CLUSTER_UUID} | ||
| + | PRIMARY=${PRIMARY} | ||
| + | INDEX=${INDEX} | ||
| + | MEMBERS=${MEMBERS} | ||
| + | " >> | ||
| + | |||
| + | # Undefined means node is shutting down | ||
| + | # Synced means node is ready again | ||
| + | #if [ " | ||
| + | if [ " | ||
| + | # | ||
| + | DB_STAT=" | ||
| + | else | ||
| + | # | ||
| + | DB_STAT=" | ||
| + | fi | ||
| + | |||
| + | echo " | ||
| + | echo " | ||
| + | echo "# | ||
| + | |||
| + | exit 0 | ||
| + | </ | ||
| + | |||
| + | Die Variable '' | ||
| + | > echo "SET GLOBAL wsrep_notify_cmd='/ | ||
| + | |||
| + | Um das //setzen// der Variable '' | ||
| + | <file bash / | ||
| + | #!/bin/bash | ||
| + | |||
| + | # | ||
| + | # | ||
| + | # mit diesem Skript wird die Variable ' | ||
| + | # gesetzt und anschließend der aktuelle Status gesendet | ||
| + | # | ||
| + | # | ||
| + | |||
| + | VERSION=" | ||
| + | |||
| + | WSREP_NOTIFY_CMD="/ | ||
| + | |||
| + | echo " | ||
| + | SHOW STATUS LIKE ' | ||
| + | SHOW STATUS LIKE ' | ||
| + | SHOW VARIABLES LIKE ' | ||
| + | " | mysql -t | ||
| + | |||
| + | echo " | ||
| + | echo "SET GLOBAL wsrep_notify_cmd=' | ||
| + | |||
| + | echo " | ||
| + | SHOW STATUS LIKE ' | ||
| + | SHOW STATUS LIKE ' | ||
| + | SHOW VARIABLES LIKE ' | ||
| + | " | mysql -t | ||
| + | |||
| + | PRIMARY=" | ||
| + | STATUS=" | ||
| + | echo " | ||
| + | su - mysql -s /bin/bash -c " | ||
| + | </ | ||
| + | |||
| + | Dieses Skript kann man in die ''/ | ||
| + | |||
| + | Das kann man mit den folgenden Skripten bzw. Eintragungen erreichen. | ||
| + | <file bash / | ||
| + | PATH="/ | ||
| + | |||
| + | ### wsrep_notify_cmd in Galera setzen | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | Weil das synchronisieren per SST bei großen Galera-Datenbanken sehr lange dauern kann, sind hier 1800 Sekunden (1/2 Stunde) angegeben worden. | ||
| + | <file bash / | ||
| + | # | ||
| + | |||
| + | MYSQL_LOGIN=" | ||
| + | ZAEHLER=" | ||
| + | |||
| + | while [ " | ||
| + | do | ||
| + | ZAEHLER=" | ||
| + | if [ " | ||
| + | ZAEHLER=" | ||
| + | / | ||
| + | fi | ||
| + | sleep 1 | ||
| + | done | ||
| + | </ | ||
| + | |||
| + | damit die Platte nicht voll läuft: | ||
| + | <file bash / | ||
| + | # - damit die Platte nicht voll läuft | ||
| + | / | ||
| + | daily | ||
| + | rotate 7 | ||
| + | missingok | ||
| + | create 640 mysql adm | ||
| + | compress | ||
| + | sharedscripts | ||
| + | } | ||
| + | </ | ||
| + | |||
