Pro02
主节点故障OOM后 不选新主
主节点日志 Defaulted container "mysql" out of: mysql, metrics mysql 06:00:45.69 mysql 06:00:45.70 Welcome to the Drycc mysql container mysql 06:00:45.71 Subscribe to project updates by watching https://github.com/drycc/containers mysql 06:00:45.71 Submit issues and feature requests at https://github.com/drycc/containers/issues mysql 06:00:45.72 mysql 06:00:45.73 INFO ==> ** Starting MySQL setup ** mysql 06:00:45.75 INFO ==> Validating settings in MYSQL_/MARIADB_ env vars mysql 06:00:45.77 INFO ==> Initializing mysql database mysql 06:00:45.80 WARN ==> The mysql configuration file '/opt/drycc/mysql/conf/my.cnf' is not writable. Configurations based on environment variables will not be applied for this file. mysql 06:00:45.80 INFO ==> Using persisted data mysql 06:00:45.81 INFO ==> Running mysql_upgrade mysql 06:00:45.83 INFO ==> Starting mysql in background 2026-04-15T06:00:45.856726-00:00 0 [Warning] [MY-010140] [Server] Could not increase number of max_open_files to more than 1048576 (request: 2000000) 2026-04-15T06:00:46.095043-00:00 0 [System] [MY-010116] [Server] /opt/drycc/mysql/bin/mysqld (mysqld 8.0.34) starting as process 41 2026-04-15T06:00:46.101710-00:00 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2026-04-15T06:00:48.217137-00:00 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2026-04-15T06:00:48.393619-00:00 0 [System] [MY-013587] [Repl] Plugin group_replication reported: 'Plugin 'group_replication' is starting.' 2026-04-15T06:00:48.394009-00:00 0 [System] [MY-014010] [Repl] Plugin group_replication reported: 'Plugin 'group_replication' has been started.' 2026-04-15T06:00:50.643823-00:00 0 [System] [MY-010229] [Server] Starting XA crash recovery... 2026-04-15T06:00:50.656791-00:00 0 [System] [MY-010232] [Server] XA crash recovery finished. 2026-04-15T06:00:52.112842-00:00 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2026-04-15T06:00:52.112875-00:00 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. 2026-04-15T06:00:52.694753-00:00 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /tmp/mysqlx.sock 2026-04-15T06:00:52.694866-00:00 0 [System] [MY-010931] [Server] /opt/drycc/mysql/bin/mysqld: ready for connections. Version: '8.0.34' socket: '/opt/drycc/mysql/tmp/mysql.sock' port: 3306 Source distribution. 2026-04-15T06:00:52.695831-00:00 4 [System] [MY-011565] [Repl] Plugin group_replication reported: 'Setting super_read_only=ON.' 2026-04-15T06:00:52.712312-00:00 12 [System] [MY-010597] [Server] 'CHANGE REPLICATION SOURCE TO FOR CHANNEL 'group_replication_applier' executed'. Previous state source_host='
mysql 06:01:54.24 INFO ==> ** Starting MySQL ** 2026-04-15T06:01:54.281127-00:00 0 [Warning] [MY-010140] [Server] Could not increase number of max_open_files to more than 1048576 (request: 2000000) 2026-04-15T06:01:54.514314-00:00 0 [System] [MY-010116] [Server] /opt/drycc/mysql/bin/mysqld (mysqld 8.0.34) starting as process 1 2026-04-15T06:01:54.520535-00:00 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2026-04-15T06:01:54.851720-00:00 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2026-04-15T06:01:54.954502-00:00 0 [System] [MY-013587] [Repl] Plugin group_replication reported: 'Plugin 'group_replication' is starting.' 2026-04-15T06:01:54.954775-00:00 0 [System] [MY-014010] [Repl] Plugin group_replication reported: 'Plugin 'group_replication' has been started.' 2026-04-15T06:01:54.999556-00:00 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2026-04-15T06:01:54.999582-00:00 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. 2026-04-15T06:01:55.293583-00:00 0 [System] [MY-010931] [Server] /opt/drycc/mysql/bin/mysqld: ready for connections. Version: '8.0.34' socket: '/opt/drycc/mysql/tmp/mysql.sock' port: 3306 Source distribution. 2026-04-15T06:01:55.293590-00:00 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /tmp/mysqlx.sock 2026-04-15T06:01:55.294250-00:00 4 [System] [MY-011565] [Repl] Plugin group_replication reported: 'Setting super_read_only=ON.' 2026-04-15T06:01:55.313776-00:00 12 [System] [MY-010597] [Server] 'CHANGE REPLICATION SOURCE TO FOR CHANNEL 'group_replication_applier' executed'. Previous state source_host='
登录1节点查看 MySQL helmbroker-mysql-1:33060+ ssl JS > dba.getCluster().status(); WARNING: Error connecting to Cluster: MYSQLSH 51004: Unable to find a primary member in the Cluster Retrying getCluster() using a secondary member WARNING: You are connected to an instance in state 'Read Only' Write operations on the InnoDB cluster will not be allowed.
{ "clusterName": "MXMGR", "defaultReplicaSet": { "name": "default", "primary": "helmbroker-mysql-0:3306", "ssl": "REQUIRED", "status": "OK_NO_TOLERANCE_PARTIAL", "statusText": "Cluster is NOT tolerant to any failures. 1 member is not active.", "topology": { "helmbroker-mysql-0:3306": { "address": "helmbroker-mysql-0:3306", "instanceErrors": [ "NOTE: group_replication is stopped." ], "memberRole": "PRIMARY", "memberState": "OFFLINE", "mode": "n/a", "readReplicas": {}, "role": "HA", "status": "UNREACHABLE", "version": "8.0.34" }, "helmbroker-mysql-1:3306": { "address": "helmbroker-mysql-1:3306", "memberRole": "SECONDARY", "mode": "R/O", "readReplicas": {}, "replicationLag": "applier_queue_applied", "role": "HA", "status": "ONLINE", "version": "8.0.34" }, "helmbroker-mysql-2:3306": { "address": "helmbroker-mysql-2:3306", "memberRole": "SECONDARY", "mode": "R/O", "readReplicas": {}, "replicationLag": "applier_queue_applied", "role": "HA", "status": "ONLINE", "version": "8.0.34" } }, "topologyMode": "Single-Primary" }, "groupInformationSourceMember": "helmbroker-mysql-1:3306" } dba.getCluster(); WARNING: Error connecting to Cluster: MYSQLSH 51004: Unable to find a primary member in the Cluster Retrying getCluster() using a secondary member WARNING: You are connected to an instance in state 'Read Only' Write operations on the InnoDB cluster will not be allowed.
{ "clusterName": "MXMGR", "defaultReplicaSet": { "name": "default", "primary": "helmbroker-mysql-0:3306", "ssl": "REQUIRED", "status": "OK_NO_TOLERANCE_PARTIAL", "statusText": "Cluster is NOT tolerant to any failures. 1 member is not active.", "topology": { "helmbroker-mysql-0:3306": { "address": "helmbroker-mysql-0:3306", "instanceErrors": [ "NOTE: group_replication is stopped." ], "memberRole": "PRIMARY", "memberState": "OFFLINE", "mode": "n/a", "readReplicas": {}, "role": "HA", "status": "UNREACHABLE", "version": "8.0.34" }, "helmbroker-mysql-1:3306": { "address": "helmbroker-mysql-1:3306", "memberRole": "SECONDARY", "mode": "R/O", "readReplicas": {}, "replicationLag": "applier_queue_applied", "role": "HA", "status": "ONLINE", "version": "8.0.34" }, "helmbroker-mysql-2:3306": { "address": "helmbroker-mysql-2:3306", "memberRole": "SECONDARY", "mode": "R/O", "readReplicas": {}, "replicationLag": "applier_queue_applied", "role": "HA", "status": "ONLINE", "version": "8.0.34" } }, "topologyMode": "Single-Primary" }, "groupInformationSourceMember": "helmbroker-mysql-1:3306" } 重启所有节点后,重启集群查看,主节点变成了2 dba.getCluster(); Dba.getCluster: This function is not available through a session to a standalone instance (metadata exists, instance belongs to that metadata, but GR is not active) (MYSQLSH 51314) MySQL helmbroker-mysql-0:33060+ ssl JS >
dba.getCluster().status(); { "clusterName": "MXMGR", "defaultReplicaSet": { "name": "default", "primary": "helmbroker-mysql-2:3306", "ssl": "REQUIRED", "status": "OK", "statusText": "Cluster is ONLINE and can tolerate up to ONE failure.", "topology": { "helmbroker-mysql-0:3306": { "address": "helmbroker-mysql-0:3306", "memberRole": "SECONDARY", "mode": "R/O", "readReplicas": {}, "replicationLag": "applier_queue_applied", "role": "HA", "status": "ONLINE", "version": "8.0.34" }, "helmbroker-mysql-1:3306": { "address": "helmbroker-mysql-1:3306", "memberRole": "SECONDARY", "mode": "R/O", "readReplicas": {}, "replicationLag": "applier_queue_applied", "role": "HA", "status": "ONLINE", "version": "8.0.34" }, "helmbroker-mysql-2:3306": { "address": "helmbroker-mysql-2:3306", "memberRole": "PRIMARY", "mode": "R/W", "readReplicas": {}, "replicationLag": "applier_queue_applied", "role": "HA", "status": "ONLINE", "version": "8.0.34" } }, "topologyMode": "Single-Primary" }, "groupInformationSourceMember": "helmbroker-mysql-2:3306"