github.com/percona/percona-xtradb-cluster-operator@v1.14.0/build/unsafe-bootstrap.sh (about) 1 #!/bin/bash 2 3 set -o errexit 4 set -o xtrace 5 6 function get_synced_count() { 7 /var/lib/mysql/peer-list -on-start=/usr/bin/get-pxc-state -service="$PXC_SERVICE" 2>&1 \ 8 | grep -c wsrep_ready:ON:wsrep_connected:ON:wsrep_local_state_comment:Synced:wsrep_cluster_status:Primary 9 } 10 11 GRA=/var/lib/mysql/grastate.dat 12 if hostname -s | grep -- '-pxc-0$'; then 13 if grep 'safe_to_bootstrap: 0' "${GRA}"; then 14 if [[ $(get_synced_count) = 0 ]]; then 15 mysqld --wsrep_recover 16 sed "s^safe_to_bootstrap: 0^safe_to_bootstrap: 1^" ${GRA} 1<> ${GRA} 17 fi 18 fi 19 fi