galera_new_cluster bootstraps a new cluster. However, when this happens, the cluster keeps its old state. For example:
[ec2-user@ip-172-30-0-249 ~]$ sudo galera_new_cluster
|
[ec2-user@ip-172-30-0-249 ~]$ sudo mysql -u root
|
Welcome to the MariaDB monitor. Commands end with ; or \g.
|
Your MariaDB connection id is 8
|
Server version: 10.1.38-MariaDB MariaDB Server
|
|
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
|
|
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
|
|
MariaDB [(none)]> SHOW GLOBAL VARIABLES WHERE Variable_name IN('wsrep_start_position');
|
+----------------------+----------------------------------------+
|
| Variable_name | Value |
|
+----------------------+----------------------------------------+
|
| wsrep_start_position | 0d1774c1-2ce4-11e9-9071-fe16986f98a1:6 |
|
+----------------------+----------------------------------------+
|
1 row in set (0.00 sec)
|
|
MariaDB [(none)]> SHOW GLOBAL STATUS WHERE Variable_name IN('wsrep_cluster_state_uuid', 'wsrep_last_committed');
|
+--------------------------+--------------------------------------+
|
| Variable_name | Value |
|
+--------------------------+--------------------------------------+
|
| wsrep_cluster_state_uuid | 0d1774c1-2ce4-11e9-9071-fe16986f98a1 |
|
| wsrep_last_committed | 6 |
|
+--------------------------+--------------------------------------+
|
2 rows in set (0.00 sec)
|
|
MariaDB [(none)]> \q
|
Bye
|
[ec2-user@ip-172-30-0-249 ~]$ sudo systemctl stop mariadb
|
[ec2-user@ip-172-30-0-249 ~]$ sudo galera_new_cluster
|
[ec2-user@ip-172-30-0-249 ~]$ sudo mysql -u root
|
Welcome to the MariaDB monitor. Commands end with ; or \g.
|
Your MariaDB connection id is 8
|
Server version: 10.1.38-MariaDB MariaDB Server
|
|
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
|
|
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
|
|
MariaDB [(none)]> SHOW GLOBAL VARIABLES WHERE Variable_name IN('wsrep_start_position');
|
+----------------------+----------------------------------------+
|
| Variable_name | Value |
|
+----------------------+----------------------------------------+
|
| wsrep_start_position | 0d1774c1-2ce4-11e9-9071-fe16986f98a1:6 |
|
+----------------------+----------------------------------------+
|
1 row in set (0.00 sec)
|
|
MariaDB [(none)]> SHOW GLOBAL STATUS WHERE Variable_name IN('wsrep_cluster_state_uuid', 'wsrep_last_committed');
|
+--------------------------+--------------------------------------+
|
| Variable_name | Value |
|
+--------------------------+--------------------------------------+
|
| wsrep_cluster_state_uuid | 0d1774c1-2ce4-11e9-9071-fe16986f98a1 |
|
| wsrep_last_committed | 6 |
|
+--------------------------+--------------------------------------+
|
2 rows in set (0.00 sec)
|
|
MariaDB [(none)]> \q
|
Bye
|
If it's a "new" cluster, wouldn't it make sense to start with a new UUID and seqno?
galera_new_cluster starts "mysqld --wsrep-new-cluster" using systemd under the hood. I don't believe that this is a systemd or galera_new_cluster problem, because this still happens if you bypass systemd and start "mysqld --wsrep-new-cluster" directly. For example:
[ec2-user@ip-172-30-0-249 ~]$ sudo mysqld --user=mysql --wsrep-new-cluster &
|
[1] 4753
|
2019-05-02 17:16:42 140682328529088 [Note] mysqld (mysqld 10.1.39-MariaDB) starting as process 4754 ...
|
[ec2-user@ip-172-30-0-249 ~]$ sudo mysql -u root
|
Welcome to the MariaDB monitor. Commands end with ; or \g.
|
Your MariaDB connection id is 8
|
Server version: 10.1.39-MariaDB MariaDB Server
|
|
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
|
|
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
|
|
MariaDB [(none)]> SHOW GLOBAL VARIABLES WHERE Variable_name IN('wsrep_start_position');
|
+----------------------+-----------------------------------------+
|
| Variable_name | Value |
|
+----------------------+-----------------------------------------+
|
| wsrep_start_position | 00000000-0000-0000-0000-000000000000:-1 |
|
+----------------------+-----------------------------------------+
|
1 row in set (0.00 sec)
|
|
MariaDB [(none)]> SHOW GLOBAL STATUS WHERE Variable_name IN('wsrep_cluster_state_uuid', 'wsrep_last_committed');
|
+--------------------------+--------------------------------------+
|
| Variable_name | Value |
|
+--------------------------+--------------------------------------+
|
| wsrep_cluster_state_uuid | 22f991fd-6d1f-11e9-ac6a-b392983e8673 |
|
| wsrep_last_committed | 0 |
|
+--------------------------+--------------------------------------+
|
2 rows in set (0.01 sec)
|
|
MariaDB [(none)]> \q
|
Bye
|
[ec2-user@ip-172-30-0-249 ~]$ sudo mysqladmin -u root shutdown
|
[1]+ Done sudo mysqld -u mysql --wsrep-new-cluster
|
[ec2-user@ip-172-30-0-249 ~]$ sudo mysqld --user=mysql --wsrep-new-cluster &
|
[1] 4799
|
2019-05-02 17:18:15 140331403352256 [Note] mysqld (mysqld 10.1.39-MariaDB) starting as process 4800 ...
|
[ec2-user@ip-172-30-0-249 ~]$ sudo mysql -u root
|
Welcome to the MariaDB monitor. Commands end with ; or \g.
|
Your MariaDB connection id is 8
|
Server version: 10.1.39-MariaDB MariaDB Server
|
|
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
|
|
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
|
|
MariaDB [(none)]> SHOW GLOBAL VARIABLES WHERE Variable_name IN('wsrep_start_position');
|
+----------------------+-----------------------------------------+
|
| Variable_name | Value |
|
+----------------------+-----------------------------------------+
|
| wsrep_start_position | 00000000-0000-0000-0000-000000000000:-1 |
|
+----------------------+-----------------------------------------+
|
1 row in set (0.00 sec)
|
|
MariaDB [(none)]> SHOW GLOBAL STATUS WHERE Variable_name IN('wsrep_cluster_state_uuid', 'wsrep_last_committed');
|
+--------------------------+--------------------------------------+
|
| Variable_name | Value |
|
+--------------------------+--------------------------------------+
|
| wsrep_cluster_state_uuid | 22f991fd-6d1f-11e9-ac6a-b392983e8673 |
|
| wsrep_last_committed | 0 |
|
+--------------------------+--------------------------------------+
|
2 rows in set (0.01 sec)
|
|
MariaDB [(none)]> \q
|
Bye
|
[ec2-user@ip-172-30-0-249 ~]$ sudo mysqladmin -u root shutdown
|
[1]+ Done sudo mysqld -u mysql --wsrep-new-cluster
|
In order to reset 'wsrep_cluster_state_uuid' and 'wsrep_last_committed', you have to manually delete grastate.dat:
[ec2-user@ip-172-30-0-249 ~]$ sudo galera_new_cluster
|
[ec2-user@ip-172-30-0-249 ~]$ sudo mysql -u root
|
Welcome to the MariaDB monitor. Commands end with ; or \g.
|
Your MariaDB connection id is 9
|
Server version: 10.1.38-MariaDB MariaDB Server
|
|
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
|
|
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
|
|
MariaDB [(none)]> SHOW GLOBAL VARIABLES WHERE Variable_name IN('wsrep_start_position');
|
+----------------------+----------------------------------------+
|
| Variable_name | Value |
|
+----------------------+----------------------------------------+
|
| wsrep_start_position | 0d1774c1-2ce4-11e9-9071-fe16986f98a1:6 |
|
+----------------------+----------------------------------------+
|
1 row in set (0.00 sec)
|
|
MariaDB [(none)]> SHOW GLOBAL STATUS WHERE Variable_name IN('wsrep_cluster_state_uuid', 'wsrep_last_committed');
|
+--------------------------+--------------------------------------+
|
| Variable_name | Value |
|
+--------------------------+--------------------------------------+
|
| wsrep_cluster_state_uuid | 0d1774c1-2ce4-11e9-9071-fe16986f98a1 |
|
| wsrep_last_committed | 6 |
|
+--------------------------+--------------------------------------+
|
2 rows in set (0.00 sec)
|
|
MariaDB [(none)]> \q
|
Bye
|
[ec2-user@ip-172-30-0-249 ~]$ sudo systemctl stop mariadb
|
[ec2-user@ip-172-30-0-249 ~]$ sudo rm /var/lib/mysql/grastate.dat
|
[ec2-user@ip-172-30-0-249 ~]$ sudo galera_new_cluster
|
[ec2-user@ip-172-30-0-249 ~]$ sudo mysql -u root
|
Welcome to the MariaDB monitor. Commands end with ; or \g.
|
Your MariaDB connection id is 8
|
Server version: 10.1.38-MariaDB MariaDB Server
|
|
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
|
|
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
|
|
MariaDB [(none)]> SHOW GLOBAL VARIABLES WHERE Variable_name IN('wsrep_start_position');
|
+----------------------+----------------------------------------+
|
| Variable_name | Value |
|
+----------------------+----------------------------------------+
|
| wsrep_start_position | 0d1774c1-2ce4-11e9-9071-fe16986f98a1:6 |
|
+----------------------+----------------------------------------+
|
1 row in set (0.00 sec)
|
|
MariaDB [(none)]> SHOW GLOBAL STATUS WHERE Variable_name IN('wsrep_cluster_state_uuid', 'wsrep_last_committed');
|
+--------------------------+--------------------------------------+
|
| Variable_name | Value |
|
+--------------------------+--------------------------------------+
|
| wsrep_cluster_state_uuid | 1ff475b4-57d2-11e9-80ac-077936e51cdd |
|
| wsrep_last_committed | 0 |
|
+--------------------------+--------------------------------------+
|
2 rows in set (0.00 sec)
|
|
MariaDB [(none)]> \q
|
Bye
|
You can see from above that wsrep_start_position is still not reset when mysqld is started with systemd. This is because MariaDB's systemd unit file has an ExecStartPre option defined that recovers this position using the galera_recovery wrapper script:
https://github.com/MariaDB/server/blob/mariadb-10.1.39/support-files/mariadb.service.in#L72
https://github.com/MariaDB/server/blob/mariadb-10.1.39/scripts/galera_recovery.sh
- relates to
-
MDEV-17458
Unable to Start Galera Node
-
-
Closed
{"report":{"fcp":891,"ttfb":245.69999980926514,"pageVisibility":"visible","entityId":75237,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"3f0f132b-5703-44cd-89d4-b61818753eba","navigationType":0,"readyForUser":1071.5,"redirectCount":0,"resourceLoadedEnd":873.1999998092651,"resourceLoadedStart":258.3999996185303,"resourceTiming":[{"duration":204.80000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bsh/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":258.3999996185303,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":258.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":463.19999980926514,"responseStart":0,"secureConnectionStart":0},{"duration":204.39999961853027,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bsh/820016/12ta74/eb142f92e4bd16bd1ef8b08c1b9d5d56/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":258.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":258.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":463.19999980926514,"responseStart":0,"secureConnectionStart":0},{"duration":213.69999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/c54b129276d75dc2a3460e1d78f37913-CDN/lu2bsh/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":258.8999996185303,"connectEnd":258.8999996185303,"connectStart":258.8999996185303,"domainLookupEnd":258.8999996185303,"domainLookupStart":258.8999996185303,"fetchStart":258.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":258.8999996185303,"responseEnd":472.5999994277954,"responseStart":472.5999994277954,"secureConnectionStart":258.8999996185303},{"duration":261.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/f867843cd2fdb209d4d1d4f760f86346-CDN/lu2bsh/820016/12ta74/eb142f92e4bd16bd1ef8b08c1b9d5d56/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":259.30000019073486,"connectEnd":259.30000019073486,"connectStart":259.30000019073486,"domainLookupEnd":259.30000019073486,"domainLookupStart":259.30000019073486,"fetchStart":259.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":259.30000019073486,"responseEnd":520.5,"responseStart":520.5,"secureConnectionStart":259.30000019073486},{"duration":265.0999994277954,"initiatorType":"script","name":"https://jira.mariadb.org/s/ffdb17665775c5b4d6f097f3974ee359-CDN/lu2bsh/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":259.5,"connectEnd":259.5,"connectStart":259.5,"domainLookupEnd":259.5,"domainLookupStart":259.5,"fetchStart":259.5,"redirectEnd":0,"redirectStart":0,"requestStart":259.5,"responseEnd":524.5999994277954,"responseStart":524.5999994277954,"secureConnectionStart":259.5},{"duration":265.6000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bsh/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":259.5999994277954,"connectEnd":259.5999994277954,"connectStart":259.5999994277954,"domainLookupEnd":259.5999994277954,"domainLookupStart":259.5999994277954,"fetchStart":259.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":259.5999994277954,"responseEnd":525.1999998092651,"responseStart":525.1999998092651,"secureConnectionStart":259.5999994277954},{"duration":266,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bsh/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":259.5999994277954,"connectEnd":259.5999994277954,"connectStart":259.5999994277954,"domainLookupEnd":259.5999994277954,"domainLookupStart":259.5999994277954,"fetchStart":259.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":259.5999994277954,"responseEnd":525.5999994277954,"responseStart":525.5999994277954,"secureConnectionStart":259.5999994277954},{"duration":266.30000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bsh/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":259.69999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":259.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":526,"responseStart":0,"secureConnectionStart":0},{"duration":266.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":259.80000019073486,"connectEnd":259.80000019073486,"connectStart":259.80000019073486,"domainLookupEnd":259.80000019073486,"domainLookupStart":259.80000019073486,"fetchStart":259.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":259.80000019073486,"responseEnd":526,"responseStart":526,"secureConnectionStart":259.80000019073486},{"duration":266.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bsh/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":260,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":260,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":526.5,"responseStart":0,"secureConnectionStart":0},{"duration":266.6000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/81b5d7c27af3ebc078cc4a36383678ba-CDN/lu2bsh/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":260.0999994277954,"connectEnd":260.0999994277954,"connectStart":260.0999994277954,"domainLookupEnd":260.0999994277954,"domainLookupStart":260.0999994277954,"fetchStart":260.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":260.0999994277954,"responseEnd":526.6999998092651,"responseStart":526.6999998092651,"secureConnectionStart":260.0999994277954},{"duration":557,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bsh/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":290.80000019073486,"connectEnd":290.80000019073486,"connectStart":290.80000019073486,"domainLookupEnd":290.80000019073486,"domainLookupStart":290.80000019073486,"fetchStart":290.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":290.80000019073486,"responseEnd":847.8000001907349,"responseStart":847.8000001907349,"secureConnectionStart":290.80000019073486},{"duration":576.1000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bsh/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":297.0999994277954,"connectEnd":297.0999994277954,"connectStart":297.0999994277954,"domainLookupEnd":297.0999994277954,"domainLookupStart":297.0999994277954,"fetchStart":297.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":297.0999994277954,"responseEnd":873.1999998092651,"responseStart":873.1999998092651,"secureConnectionStart":297.0999994277954},{"duration":183.19999980926514,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":689.5,"connectEnd":689.5,"connectStart":689.5,"domainLookupEnd":689.5,"domainLookupStart":689.5,"fetchStart":689.5,"redirectEnd":0,"redirectStart":0,"requestStart":689.5,"responseEnd":872.6999998092651,"responseStart":872.6999998092651,"secureConnectionStart":689.5},{"duration":57.10000038146973,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":867.5999994277954,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":867.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":924.6999998092651,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":67,"responseStart":246,"responseEnd":297,"domLoading":249,"domInteractive":1127,"domContentLoadedEventStart":1127,"domContentLoadedEventEnd":1169,"domComplete":1570,"loadEventStart":1570,"loadEventEnd":1570,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1096.6999998092651},{"name":"bigPipe.sidebar-id.end","time":1097.3999996185303},{"name":"bigPipe.activity-panel-pipe-id.start","time":1097.5},{"name":"bigPipe.activity-panel-pipe-id.end","time":1099.5},{"name":"activityTabFullyLoaded","time":1185.3000001907349}],"measures":[],"correlationId":"f56f711e7b6293","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":94,"dbReadsTimeInMs":28,"dbConnsTimeInMs":35,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}