コンテンツにスキップ

グループレプリケーションとトラブルシューティング

このページでは、MySQL のグループレプリケーションを使用する Porta On Prem のインストール情報を提供します。

  • メインマシンのデータベースはコンテナ名 porta-db を持ちます。
    • MySQL ポート 3306
    • レプリケーションポート 33061
  • バックアップマシンのデータベースはコンテナ名 porta-db-2 を持ちます。
    • MySQL ポート 3307
    • レプリケーションポート 33062
  • arbiter マシンのデータベースはコンテナ名 porta-db-3 を持ちます。
    • MySQL ポート 3308
    • レプリケーションポート 33063

これらのログには、レプリケーションに関する情報やその他の MySQL ログが含まれます。

  • ヘルパー: porta-onprem-bundle\porta-helpers\porta-database\view-database-log.bat

このマシンが報告するデータベースレプリケーショングループのメンバーを表示する

Section titled “このマシンが報告するデータベースレプリケーショングループのメンバーを表示する”
  • ヘルパー: porta-onprem-bundle\porta-helpers\porta-database\view-group-repl-status.bat

各マシンが報告するデータベースレプリケーショングループのメンバーを表示する

Section titled “各マシンが報告するデータベースレプリケーショングループのメンバーを表示する”
  • ヘルパー: porta-onprem-bundle\porta-helpers\porta-database\view-ALL-group-repl-status.bat

グループレプリケーションの開始

Section titled “グループレプリケーションの開始”
  • ヘルパー: porta-onprem-bundle\porta-helpers\porta-database\actions\START-repl.bat

グループレプリケーションの停止

Section titled “グループレプリケーションの停止”
  • ヘルパー: porta-onprem-bundle\porta-helpers\porta-database\actions\STOP-repl.bat

データベースのバックアップの作成

Section titled “データベースのバックアップの作成”

参照: Disaster Backup and Restoration

データベースのバックアップからの復元

Section titled “データベースのバックアップからの復元”

参照: Disaster Backup and Restoration

データベースコンテナのリセット

Section titled “データベースコンテナのリセット”

Replication Group Member Recovery の「! Reset Database !」セクションを参照してください。

非プライマリメンバーの成功時のログメッセージの例:

Terminal window
# The database has found the group to join and it has a primary member
2024-01-24T14:44:29.647313Z 16 [System] [MY-011511] [Repl] Plugin group_replication reported: 'This server is working as secondary member with primary member address 10.100.100.176:3306.'
# If there are changes to be applied, the database will begin applying them
2024-01-29T14:42:36.696980Z 0 [System] [MY-013471] [Repl] Plugin group_replication reported: 'Distributed recovery will transfer data using: Incremental recovery from a group donor'
# The database has joined the group and began replicating
2024-01-24T14:44:29.647977Z 0 [System] [MY-011503] [Repl] Plugin group_replication reported: 'Group membership changed to 10.100.100.176:3306, 10.100.100.177:3307 on view 17061069903020065:2.'
# The database has officially successfully joined the group and its data is in sync with the other databases
2024-01-24T14:44:39.153344Z 0 [System] [MY-011490] [Repl] Plugin group_replication reported: 'This server was declared online within the replication group.'

プライマリメンバーの成功時のログメッセージの例:

Terminal window
# The replication group lost its primary member and has elected a new one
2024-01-29T15:13:13.328189Z 0 [System] [MY-011507] [Repl] Plugin group_replication reported: 'A new primary with address 192.168.50.42:3308 was elected. The new primary will execute all previous group transactions before allowing writes.'
# This database has been elected as the new primary
2024-01-29T15:13:13.634688Z 22 [System] [MY-011510] [Repl] Plugin group_replication reported: 'This server is working as primary member.'

トラブルシューティングエラー

Section titled “トラブルシューティングエラー”

ERROR 3092 (HY000) at line 1: The server is not configured properly to be an active member of the group.

Section titled “ERROR 3092 (HY000) at line 1: The server is not configured properly to be an active member of the group.”

このエラーの原因は、このマシン(およびしばしば他のマシン)のエラーログの詳細に本当に依存します。このマシンのエラーログを確認し、それらのエラーをこのドキュメントで探してください。同じタイムスタンプ周辺のエラーについて、グループ内の他のマシンのログを確認することも役立つ場合があります。

各マシンが自分自身しか認識しない

Section titled “各マシンが自分自身しか認識しない”

各マシンがレプリケーショングループ内で自分自身しか認識しない場合、参加できる既存のグループがなかったことを意味する可能性が高いです。これは、マシン同士が通信できない場合や、どのマシンでもグループレプリケーションプロセスがブートストラップされなかった場合に発生することがあります。

各マシンでレプリケーショングループのステータスを表示した後の例(各マシンに次のような OFFLINE エントリが 1 つ表示されます):

+---------------------------+--------------------------------------+----------------+-------------+--------------+-------------+----------------+----------------------------+
| CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION | MEMBER_COMMUNICATION_STACK |
+---------------------------+--------------------------------------+----------------+-------------+--------------+-------------+----------------+----------------------------+
| group_replication_applier | 3059e925-bc43-11ee-a26c-0242ac120002 | 10.100.100.177 | 3307 | OFFLINE | | | XCom |
+---------------------------+--------------------------------------+----------------+-------------+--------------+-------------+----------------+----------------------------+

これを修正するには、各マシンで グループレプリケーションを再起動する必要があります。リカバリーガイドの Bootstrap the Replication Group を参照してください。

参加メンバーが既存のグループに参加せず独自のグループを作成する

Section titled “参加メンバーが既存のグループに参加せず独自のグループを作成する”

参加メンバーが独自のグループを作成する場合、その参加メンバーで group_replication_bootstrap_group 設定が ON になっている可能性が高いです。

  1. porta-helpers/porta-database/actions/cautionset-bootstrap-OFF.bat ヘルパーを実行して、これをオフにします。
  2. porta-helpers/porta-database/actionsrestart-repl.bat ヘルパーを実行して、マシンのレプリケーションを再起動します。

既存のグループへの参加エラー

Section titled “既存のグループへの参加エラー”

Timeout while waiting for the group communication engine to be ready / Error connecting to all peers

Section titled “Timeout while waiting for the group communication engine to be ready / Error connecting to all peers”

別のメンバーのログに Old incarnation found while trying to add node が表示されることもあります。

エラーログの例(参加に失敗しているメンバーの場合):

Terminal window
[ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] Timeout while waiting for the group communication engine to be ready!'
[ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] The group communication engine is not ready for the member to join. Local port: 33062'
[ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] The member was unable to join the group. Local port: 33062'
[ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] Error on opening a connection to peer node porta-db-3:33063 when joining a group. My local port is: 33062.'
[ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] Error on opening a connection to peer node porta-db-3:33063 when joining a group. My local port is: 33062.'
[ERROR] [MY-011640] [Repl] Plugin group_replication reported: 'Timeout on wait for view after joining group'
[ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] The member is already leaving or joining a group.'
[ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] Error connecting to all peers. Member join failed. Local port: 33062'
[ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] The member was unable to join the group. Local port: 33062'

初回参加時にエラーが発生する場合

Section titled “初回参加時にエラーが発生する場合”

次を試してください。

  • ping
    • ping <MACHINE_IP>)
  • telnet(PowerShell から)
    • telnet <MACHINE_IP> <DATABASE_PORT>
  • リモート MySQL アクセス
    • porta-helpers\porta-run\sysadmin\CLI\access-mysql.bat

これらがすべて機能する場合は、hosts ファイルを確認 し、両方のマシンで IP からコンテナ名へのマッピングが正しいことを確認してください。(これは、セットアップ中にこのエラーが最後に見られたときの問題でした。)

再参加時にエラーが発生する場合

Section titled “再参加時にエラーが発生する場合”

このエラーは、ブートストラップされたメンバーがない場合によく発生します。次のチェックを実行して、クラスタの状態を把握してください: View Database Replication Group Members as reported by each machine

  • 各マシンが OFFLINE で自分自身しか認識しない場合は、いずれかのマシンでグループレプリケーションプロセスをブートストラップする必要があります。リカバリーガイドの Bootstrap the Replication Group を参照してください。
  • マシンが UNREACHABLE と表示される場合は、そのログの詳細を確認し、Old incarnation found while trying to add node セクションを参照してください。

Old incarnation found while trying to add node

Section titled “Old incarnation found while trying to add node”

別のメンバー、たとえば porta-db-3 がすでにグループへの参加を試みて失敗し、OFFLINE と表示されている場合、再度 START GROUP_REPLICATION を試みると、既存のメンバーにこのエラーが表示されることがあります。

既存のグループのプライマリメンバーでこのログエントリがどのように表示されるかの例:

Terminal window
[Warning] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] Old incarnation found while trying to add node porta-db-3:33063 17339258949477546. Please stop the old node or wait for it to leave the group.'

既存のグループに参加できないメンバーでこのログエントリがどのように表示されるかの例:

Terminal window
[ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] The member was unable to join the group. Local port: 33063'
[ERROR] [MY-011640] [Repl] Plugin group_replication reported: 'Timeout on wait for view after joining group'
[ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] The member is leaving a group without being on one.'

各マシンで次のチェックを実行して、クラスタの状態を把握してください: View Database Replication Group Members as reported by each machine

UNREACHABLE のプライマリメンバーがある場合

Section titled “UNREACHABLE のプライマリメンバーがある場合”

いずれかのマシンで、メンバーの 1 つの MEMBER_STATEUNREACHABLE と表示されることがあります。

+---------------------------+--------------------------------------+----------------+-------------+--------------+-------------+----------------+----------------------------+
| CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION | MEMBER_COMMUNICATION_STACK |
+---------------------------+--------------------------------------+----------------+-------------+--------------+-------------+----------------+----------------------------+
| group_replication_applier | e0ff1ffa-bac5-11ee-9fc8-0242ac120002 | 10.100.100.176 | 3306 | UNREACHABLE | PRIMARY | 8.0.32 | XCom |
| group_replication_applier | faa25e2f-bac6-11ee-a05b-0242ac120005 | 10.100.100.177 | 3307 | ONLINE | SECONDARY | 8.0.32 | XCom |
| group_replication_applier | faa25e2f-bac6-11ee-a05b-0242ac120003 | 10.100.100.178 | 3308 | ONLINE | SECONDARY | 8.0.32 | XCom |
+---------------------------+--------------------------------------+----------------+-------------+--------------+-------------+----------------+----------------------------+

注: UNREACHABLE のメンバーが MEMBER_ROLEPRIMARY の場合、到達不能なメンバーが追い出されるまで、新しいプライマリは選出されません。 残りのメンバーが過半数であれば、タイムアウト期間の後にそのメンバーは自動的に追い出されるはずです。

メンバーを投票で追い出すための過半数が残っていない場合、またはメンバーを早急に削除したい場合は、各マシンで グループレプリケーションを再起動する必要があります。リカバリーガイドの Bootstrap the Replication Group を参照してください。

UNREACHABLE のプライマリメンバーがない場合

Section titled “UNREACHABLE のプライマリメンバーがない場合”

UNREACHABLE のプライマリメンバーがない場合、トランザクションに問題がある可能性があります。詳細については、マシンのデータベースログ(View database logs セクションを参照)を確認してください。ログに “This member has more executed transactions than those present in the group” が含まれている場合は、This member has more executed transactions than those present in the group セクションを参照してください。

This member has more executed transactions than those present in the group

Section titled “This member has more executed transactions than those present in the group”

これは、メンバーがすでに参加しているグループに参加しようとしたときに発生することがあります。失敗した参加者からグループメンバーを確認して、それがすでにグループのメンバーでないことを確認してください: View Database Replication Group Members as reported by each machine。結果にすべてのメンバーが存在する場合、そのメンバーはすでにグループの一部です。

メンバーがグループの一部でない場合、このエラーは、メンバーが既存のメンバーよりも高い gtid_executed 値を持っている場合にも発生することがあります。これは、メンバーが以前にグループの一部であった場合や、独自のグループのプライマリであった場合に、別のグループに追加されると発生することがあります。

ほとんどの場合、復旧は “Single Database Failing to Rejoin Group” の手順と同様に行えますが、理想的には業務時間外に、Disguise エンジニアまたはサポートチームのメンバーが支援できるまで行わないでください。