差分
このページの2つのバージョン間の差分を表示します。
次のリビジョン | 前のリビジョン | ||
ja:quickguides:ha_percona_xtradb [2022/05/30 05:20] – 作成 junichi | ja:quickguides:ha_percona_xtradb [2023/09/27 04:25] (現在) – [以前のデータがある環境における変更の適用] junichi | ||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== | + | ====== Percona XtraDB Cluster |
{{indexmenu_n> | {{indexmenu_n> | ||
- | [[:en: | + | [[:ja: |
- | ===== Introduction | + | |
+ | ===== はじめに | ||
Pandora FMS is based on a MySQL database to configure and store data. We know that in order to scale (grow) " | Pandora FMS is based on a MySQL database to configure and store data. We know that in order to scale (grow) " | ||
+ | |||
+ | Pandora FMS は、設定およびデータを保存するために MySQL データベースを利用しています。" | ||
To solve this problem we rely on Percona XtraDB Cluster, which offers the possibility of using in multimaster mode (several main servers) for the read and write tasks of these servers. In this way, the load is distributed among the different servers where this cluster is hosted, giving more processing capacity to the database than a standalone node can offer. **This way, the number of metrics to monitor in a single Pandora FMS node can be increased.** | To solve this problem we rely on Percona XtraDB Cluster, which offers the possibility of using in multimaster mode (several main servers) for the read and write tasks of these servers. In this way, the load is distributed among the different servers where this cluster is hosted, giving more processing capacity to the database than a standalone node can offer. **This way, the number of metrics to monitor in a single Pandora FMS node can be increased.** | ||
+ | |||
+ | この問題を解決するために、Percona XtraDB Cluster を使用します。これは、複数のサーバからの読み取りおよび書き込みタスクに対して、マルチマスターモード(複数のメインサーバ)で使用できるようにする環境を提供します。 このようにして、負荷はこのクラスターが実装されている複数のサーバに分散され、スタンドアロンノードが対応できるよりも多くの処理能力をデータベースに提供します。 **このようにして、単一の Pandora FMS ノードで監視するメトリックの数を増やすことができます。** | ||
{{ : | {{ : | ||
The representation of this scheme offers the possibility of installing in the same server, a **Percona XtraDB Cluster** replication node together with the **Pandora FMS** server and the Web Console //or separate the installation of them//. It will be enough to point each one of the Pandora FMS servers or Pandora FMS Web Console to the node where it is needed to write or read, being able to distribute the load of the environment as it is more convenient in each environment. | The representation of this scheme offers the possibility of installing in the same server, a **Percona XtraDB Cluster** replication node together with the **Pandora FMS** server and the Web Console //or separate the installation of them//. It will be enough to point each one of the Pandora FMS servers or Pandora FMS Web Console to the node where it is needed to write or read, being able to distribute the load of the environment as it is more convenient in each environment. | ||
+ | |||
+ | このスキームでは、**Percona XtraDB Cluster** のレプリケーションノードと同じサーバに **Pandora FMS** サーバおよび Web コンソールを一緒にインストールすることができます。// | ||
<WRAP center round info 60%>\\ | <WRAP center round info 60%>\\ | ||
行 20: | 行 27: | ||
</ | </ | ||
+ | <WRAP center round info 60%>\\ | ||
+ | クラスタが機能するためのノードの最小数は 3ノードであり、データベースが機能するためには常に 2つのノードがアクティブである必要があります。\\ | ||
+ | </ | ||
- | ===== Percona XtraDB Cluster | + | ===== Percona XtraDB Cluster |
To perform a correct installation of Percona XtraDB Cluster, first the Percona XtraDB Cluster server and client must be installed in all the nodes. | To perform a correct installation of Percona XtraDB Cluster, first the Percona XtraDB Cluster server and client must be installed in all the nodes. | ||
+ | |||
+ | Percona XtraDB Cluster を正しくインストールするには、最初に Percona XtraDB Cluster サーバとクライアントをすべてのノードにインストールする必要があります。 | ||
The data of the nodes to be used in the example will be the following: | The data of the nodes to be used in the example will be the following: | ||
+ | |||
+ | 例で使用するノードの情報は次の通りです。 | ||
**NODE 1**: | **NODE 1**: | ||
+ | |||
+ | **ノード1**: | ||
< | < | ||
pandora001 | pandora001 | ||
行 35: | 行 51: | ||
**NODE 2**: | **NODE 2**: | ||
+ | |||
+ | **ノード2**: | ||
< | < | ||
pandora002 | pandora002 | ||
行 42: | 行 60: | ||
**NODE 3**: | **NODE 3**: | ||
+ | |||
+ | **ノード3**: | ||
< | < | ||
pandora003 | pandora003 | ||
行 49: | 行 69: | ||
- | ==== Running on all nodes ==== | + | ==== 全ノードでの実行 |
< | < | ||
行 57: | 行 77: | ||
Once installed on all nodes, start the service on each node and set up a password that is common for the **root** user, as well as a user (in this case '' | Once installed on all nodes, start the service on each node and set up a password that is common for the **root** user, as well as a user (in this case '' | ||
+ | |||
+ | すべてのノードにインストールしたら、各ノードでサービスを開始し、**root** ユーザと、全ノード間のレプリケーションに使用されるユーザ(この場合は '' | ||
+ | |||
< | < | ||
# systemctl start mysqld | # systemctl start mysqld | ||
行 63: | 行 86: | ||
Get a temporary password for **root** and login with it to the MySQL server (remember to run on all nodes): | Get a temporary password for **root** and login with it to the MySQL server (remember to run on all nodes): | ||
+ | |||
+ | **root** の一時パスワードを取得し、それを使用して MySQL サーバにログインします(すべてのノードで実行することを忘れないでください)。 | ||
+ | |||
< | < | ||
# mysql -uroot -p$(grep " | # mysql -uroot -p$(grep " | ||
行 71: | 行 97: | ||
Now proceed to create the user '' | Now proceed to create the user '' | ||
+ | |||
+ | 続いて、ユーザ '' | ||
+ | |||
< | < | ||
行 80: | 行 109: | ||
Stop the '' | Stop the '' | ||
+ | |||
+ | ここまでの設定が終わったら、**全ノードで** '' | ||
+ | |||
< | < | ||
# systemctl stop mysqld | # systemctl stop mysqld | ||
行 86: | 行 118: | ||
Once you have stopped all servers, you must start one of them in bootstrap mode, so that it acts as the main server to perform replication between the other two nodes. | Once you have stopped all servers, you must start one of them in bootstrap mode, so that it acts as the main server to perform replication between the other two nodes. | ||
+ | |||
+ | すべてのサーバを停止したら、そのうちの 1つをブートストラップモードで起動して、他の 2つのノード間でレプリケーションを実行するメインサーバとして機能するようにする必要があります。 | ||
To do this you have to add a specific configuration in the node that you choose as the main one, in this case the '' | To do this you have to add a specific configuration in the node that you choose as the main one, in this case the '' | ||
+ | |||
+ | これを行うには、メインとして選択したノード(この場合は '' | ||
Modify the ''/ | Modify the ''/ | ||
+ | |||
+ | '' | ||
+ | |||
< | < | ||
[mysqld] | [mysqld] | ||
行 145: | 行 184: | ||
Start with this configuration the mysql service in the '' | Start with this configuration the mysql service in the '' | ||
+ | |||
+ | '' | ||
+ | |||
< | < | ||
# systemctl start mysql@bootstrap | # systemctl start mysql@bootstrap | ||
行 151: | 行 193: | ||
In the nodes '' | In the nodes '' | ||
+ | |||
+ | '' | ||
* Node '' | * Node '' | ||
+ | |||
+ | * ノード '' | ||
< | < | ||
行 207: | 行 253: | ||
* Node '' | * Node '' | ||
+ | |||
+ | * ノード '' | ||
< | < | ||
行 261: | 行 309: | ||
Start in the nodes '' | Start in the nodes '' | ||
+ | |||
+ | '' | ||
< | < | ||
行 268: | 行 318: | ||
<WRAP center round box 60%> At this point you can perform the installation of the Pandora FMS database on node 1 and observe how it replicates correctly between the other two servers. </ | <WRAP center round box 60%> At this point you can perform the installation of the Pandora FMS database on node 1 and observe how it replicates correctly between the other two servers. </ | ||
+ | |||
+ | <WRAP center round box 60%> この時点で、ノード1 に Pandora FMS データベースのインストールを実行し、他の 2つのサーバ間でデータベースがどのように正しく複製されるかを観察できます。</ | ||
Once you have verified the correct operation of the replication, | Once you have verified the correct operation of the replication, | ||
+ | |||
+ | レプリケーションの正しい動作を確認したら、bootstrap モードで開始したノード(この場合は '' | ||
< | < | ||
行 277: | 行 331: | ||
Change inside the '' | Change inside the '' | ||
+ | |||
+ | ノード1 の '' | ||
< | < | ||
行 284: | 行 340: | ||
Start again the '' | Start again the '' | ||
+ | |||
+ | ノード '' | ||
< | < | ||
行 291: | 行 349: | ||
- | ===== Changes to the Pandora FMS schema for its correct operation | + | ===== 正しい動作のための |
<WRAP center round important 60%> To avoid problems with deadlocks due to the constant writings and readings that are produced in parallel, it is necessary to modify the following Pandora FMS tables with the following modifications: | <WRAP center round important 60%> To avoid problems with deadlocks due to the constant writings and readings that are produced in parallel, it is necessary to modify the following Pandora FMS tables with the following modifications: | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> 並行して行われる書き込みと読み取りによるデッドロックの問題を回避するために、以下に示す内容で Pandora FMS の該当テーブルを変更する必要があります。\\ | ||
</ | </ | ||
行 319: | 行 380: | ||
For its correct operation, these changes should be applied with the database without data, only with the schema. | For its correct operation, these changes should be applied with the database without data, only with the schema. | ||
+ | 正しく動作させるには、これらの変更をスキーマのみのデータが入っていないデータベースに適用する必要があります。 | ||
- | ===== Applying changes in an environment with previous data ===== | + | ===== 以前のデータがある環境における変更の適用 |
In this scenario, it is necessary to rebuild the tables where the necessary modifications have been added to avoid deadlocks in the environment. The process would be as follows: | In this scenario, it is necessary to rebuild the tables where the necessary modifications have been added to avoid deadlocks in the environment. The process would be as follows: | ||
+ | |||
+ | このシナリオは、デッドロックを回避するために、すでにデータが入っているテーブルに対して変更を適用して再構築する場合の例です。処理は次のようになります。 | ||
1.- '' | 1.- '' | ||
+ | |||
+ | 1.- DROP および create TABLE フィールドを除く、個別に関係するすべてのテーブルを'' | ||
+ | |||
< | < | ||
#mysqldump -u root -p pandora tagent_access --skip-add-drop-table --complete-insert --no-create-info> | #mysqldump -u root -p pandora tagent_access --skip-add-drop-table --complete-insert --no-create-info> | ||
行 335: | 行 402: | ||
2.- Delete the affected tables: | 2.- Delete the affected tables: | ||
+ | |||
+ | 2.- 影響のあるテーブルを削除します。 | ||
< | < | ||
行 346: | 行 415: | ||
3.- Create again all the tables with all the '' | 3.- Create again all the tables with all the '' | ||
+ | |||
+ | 3.- 環境が問題なく動作するように、新しい列を含むすべてのテーブルを '' | ||
4.- Incorporate with **source** all the '' | 4.- Incorporate with **source** all the '' | ||
+ | |||
+ | 4.- 手順1 で作成したすべての '' | ||
+ | |||
< | < | ||
#mysql -u root -p pandora | #mysql -u root -p pandora | ||
行 358: | 行 432: | ||
</ | </ | ||
- | At the end of the process, all the tables will have the incremental | + | At the end of the process, all the tables will have the incremental |
- | [[: | + | 処理が終わると、すべてのテーブルに、最初から作成されたインクリメンタル ID が含まれます。 |
+ | [[: | ||