差分
このページの2つのバージョン間の差分を表示します。
| 両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
| ja:documentation:pandorafms:complex_environments_and_optimization:06_ha [2026/06/19 23:22] – [マスターノード設定] junichi | ja:documentation:pandorafms:complex_environments_and_optimization:06_ha [2026/06/19 23:35] (現在) – [冗長化構成(HA)] junichi | ||
|---|---|---|---|
| 行 3: | 行 3: | ||
| {{indexmenu_n> | {{indexmenu_n> | ||
| - | [[ja: | + | [[ja: |
| - | + | ||
| ===== 概要 ===== | ===== 概要 ===== | ||
| 行 1392: | 行 1390: | ||
| <wrap #ks6_3 /> | <wrap #ks6_3 /> | ||
| + | ==== 手動 DB 再同期 ==== | ||
| + | Using the synchronization //script//: With the Pandora FMS server, a //script// is implemented that allows you to synchronize the **SLAVE** database in case it is desynchronized. | ||
| + | 同期スクリプトの使用: | ||
| - | === データベースの複製 === | + | The manual execution of this //script// is as follows: |
| - | The next step is to make a clone of the master database (**MASTER**) in the slave node (**SLAVE**). To do so, follow the steps below: | + | このスクリプトの手動実行方法は以下のとおりです。 |
| - | 次のステップは、スレーブノード (**SLAVE**) でマスターデータベース (**MASTER**) の複製を作成することです。これを行うには次の手順に従います。 | + | < |
| - | + | ||
| - | **1.-** Make a complete download (dump) of the **MASTER** database: | + | |
| - | + | ||
| - | **1.-** **MASTER** データベースの完全な複製(dump)を作成します: | + | |
| - | + | ||
| - | **MASTER** # '' | + | |
| - | + | ||
| - | **MASTER** # '' | + | |
| - | + | ||
| - | **2.-** Get the position of the backup binary log: | + | |
| - | + | ||
| - | **2.-** バックアップバイナリログのポジションを取得します: | + | |
| - | + | ||
| - | **MASTER** # '' | + | |
| - | + | ||
| - | It will return something like the following: | + | |
| - | + | ||
| - | 次のような出力があります: | + | |
| - | + | ||
| - | < | + | |
| - | binlog.000003 157 | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | //Take note of these two values as they are needed for point number 6.// | + | |
| - | + | ||
| - | //6 番目の手順で必要となるため、この 2つの値をメモしておきます。// | + | |
| - | + | ||
| - | **3.-** Make a copy using rsync with the **SLAVE** server to send the backup: | + | |
| - | + | ||
| - | **3.-** rsync を使って **SLAVE** サーバにバックアップのコピーを送ります: | + | |
| - | + | ||
| - | **MASTER** # '' | + | |
| - | + | ||
| - | **4.-** On the **SLAVE** server, configure the permissions so that the MySQL server can access the files sent without any problem: | + | |
| - | + | ||
| - | **4.-** **SLAVE** サーバで、問題なく MySQL サーバがファイルにアクセスできるようにパーミッションを設定します: | + | |
| - | + | ||
| - | **SLAVE** # '' | + | |
| - | + | ||
| - | **SLAVE** # '' | + | |
| - | + | ||
| - | **5.-** Start the '' | + | |
| - | + | ||
| - | **5.-** **SLAVE** サーバで、'' | + | |
| - | + | ||
| - | < | + | |
| - | systemctl start mysqld | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | **6.-** Start the SLAVE mode on this server (use the data noted in point 2): | + | |
| - | + | ||
| - | **6.-** このサーバで SLAVE モードを開始します(手順 2 で確認したデータを利用します): | + | |
| - | + | ||
| - | **SLAVE** # '' | + | |
| - | + | ||
| - | **SLAVE** # **mysql >** '' | + | |
| - | + | ||
| - | **SLAVE** # **mysql >** | + | |
| - | < | + | |
| - | CHANGE MASTER TO MASTER_HOST=' | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | **SLAVE** # **mysql >** '' | + | |
| - | + | ||
| - | **SLAVE** # **mysql >** '' | + | |
| - | + | ||
| - | Once you are done with all these steps, if you run the '' | + | |
| - | + | ||
| - | これらのすべての手順が完了したら、MySQL シェル内で '' | + | |
| - | + | ||
| - | < | + | |
| - | *************************** 1. row *************************** | + | |
| - | Slave_IO_State: | + | |
| - | Master_Host: | + | |
| - | Master_User: | + | |
| - | Master_Port: | + | |
| - | Connect_Retry: | + | |
| - | Master_Log_File: | + | |
| - | Read_Master_Log_Pos: | + | |
| - | Relay_Log_File: | + | |
| - | Relay_Log_Pos: | + | |
| - | Relay_Master_Log_File: | + | |
| - | Slave_IO_Running: | + | |
| - | Slave_SQL_Running: | + | |
| - | Replicate_Do_DB: | + | |
| - | Replicate_Ignore_DB: | + | |
| - | Replicate_Do_Table: | + | |
| - | Replicate_Ignore_Table: | + | |
| - | Replicate_Wild_Do_Table: | + | |
| - | Replicate_Wild_Ignore_Table: | + | |
| - | Last_Errno: 0 | + | |
| - | Last_Error: | + | |
| - | Skip_Counter: | + | |
| - | Exec_Master_Log_Pos: | + | |
| - | Relay_Log_Space: | + | |
| - | Until_Condition: | + | |
| - | Until_Log_File: | + | |
| - | Until_Log_Pos: | + | |
| - | Master_SSL_Allowed: | + | |
| - | Master_SSL_CA_File: | + | |
| - | Master_SSL_CA_Path: | + | |
| - | Master_SSL_Cert: | + | |
| - | Master_SSL_Cipher: | + | |
| - | Master_SSL_Key: | + | |
| - | Seconds_Behind_Master: | + | |
| - | Master_SSL_Verify_Server_Cert: | + | |
| - | Last_IO_Errno: | + | |
| - | Last_IO_Error: | + | |
| - | Last_SQL_Errno: | + | |
| - | Last_SQL_Error: | + | |
| - | Replicate_Ignore_Server_Ids: | + | |
| - | Master_Server_Id: | + | |
| - | Master_UUID: | + | |
| - | Master_Info_File: | + | |
| - | SQL_Delay: 0 | + | |
| - | SQL_Remaining_Delay: | + | |
| - | Slave_SQL_Running_State: | + | |
| - | updates | + | |
| - | Master_Retry_Count: | + | |
| - | Master_Bind: | + | |
| - | Last_IO_Error_Timestamp: | + | |
| - | Last_SQL_Error_Timestamp: | + | |
| - | Master_SSL_Crl: | + | |
| - | Master_SSL_Crlpath: | + | |
| - | Retrieved_Gtid_Set: | + | |
| - | Executed_Gtid_Set: | + | |
| - | Auto_Position: | + | |
| - | Replicate_Rewrite_DB: | + | |
| - | Channel_Name: | + | |
| - | Master_TLS_Version: | + | |
| - | Master_public_key_path: | + | |
| - | Get_master_public_key: | + | |
| - | Network_Namespace: | + | |
| - | 1 row in set, 1 warning (0,00 sec) | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | At this point you can be sure that you have binary replication enabled and working correctly. | + | |
| - | + | ||
| - | この時点で、バイナリレプリケーションが有効になり、正しく動作していることを確認できます。 | + | |
| - | + | ||
| - | ==== pandora_server 設定 ==== | + | |
| - | + | ||
| - | <WRAP center round info 60%> | + | |
| - | + | ||
| - | Version 770 or later. | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | <WRAP center round info 60%> | + | |
| - | + | ||
| - | バージョン 770 以降 | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | It is necessary to configure inside [[: | + | |
| - | + | ||
| - | [[: | + | |
| - | + | ||
| - | The parameters to be added are the following: | + | |
| - | + | ||
| - | 追加するパラメータは次の通りです。 | + | |
| - | + | ||
| - | * **ha_hosts < | + | |
| - | Configure the '' | + | |
| - | + | ||
| - | * **ha_hosts < | + | |
| - | HA 環境を構成する MySQL サーバの IP アドレスまたは FQDN を指定する '' | + | |
| - | + | ||
| - | < | + | |
| - | ha_hosts 192.168.80.170, | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | * **ha_dbuser** | + | |
| - | These are the parameters where you must indicate the user and password of **root** | + | |
| - | + | ||
| - | * **ha_dbuser** | + | |
| - | これらは、**root** ユーザのユーザとパスワードを指定する必要があるパラメータです。root 以外の場合は、各ノードで // | + | |
| - | + | ||
| - | < | + | |
| - | ha_dbuser root | + | |
| - | ha_dbpass pandora | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | * **repl_dbuser** | + | |
| - | Parameters to define the replication user that will use the **SLAVE** | + | |
| - | + | ||
| - | * **repl_dbuser** | + | |
| - | **SLAVE** から **MASTER** に接続するレプリケーションユーザを定義するパラメータです。 例: | + | |
| - | + | ||
| - | < | + | |
| - | repl_dbuser slaveuser | + | |
| - | repl_dbpass pandora | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | * **ha_sshuser** | + | |
| - | Parameters to define the user/port with which it is connected by **ssh** | + | |
| - | + | ||
| - | * **ha_sshuser** および **ha_sshport** | + | |
| - | リカバリ操作を実行するために **ssh** によって Percona/ | + | |
| - | + | ||
| - | < | + | |
| - | ha_sshuser root | + | |
| - | ha_sshport 22 | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | * **ha_resync**'' | + | |
| - | By default the script to perform the resynchronization of the nodes, this is located at: | + | |
| - | + | ||
| - | * **ha_resync**'' | + | |
| - | デフォルトでは、ノードの再同期を実行するスクリプトは次の場所にありますP | + | |
| - | + | ||
| - | < | + | |
| - | / | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | In the case of having a customized installation of the script, indicate in this parameter its location to perform the automatic or manual synchronization of the **SLAVE** | + | |
| - | + | ||
| - | スクリプトをカスタマイズしてインストールする場合は、必要に応じて **SLAVE** ノードの自動または手動同期を実行するスクリプトの場所をこのパラメータで指定します。 | + | |
| - | + | ||
| - | < | + | |
| - | ha_resync / | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | * **ha_resync_log** | + | |
| - | Log path where all the information related to the executions performed by the synchronization script configured in the previous token will be stored. Example: | + | |
| - | + | ||
| - | * **ha_resync_log** | + | |
| - | 前のトークンで設定された同期スクリプトの実行に関するすべての情報が格納されるログのパスです。 例: | + | |
| - | + | ||
| - | < | + | |
| - | ha_resync_log / | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | * **ha_connect_retries** | + | |
| - | Number of attempts it will perform on each check with each of the servers in the HA environment before making any changes to the environment. Example: | + | |
| - | + | ||
| - | * **ha_connect_retries** | + | |
| - | 環境に変更を加える前に、HA 環境内の各サーバで各チェックを試行する回数です。 例: | + | |
| - | + | ||
| - | < | + | |
| - | ha_connect_retries 2 | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | Once all these parameters are configured, you could start Pandora FMS server with the '' | + | |
| - | + | ||
| - | これらのパラメータをすべて設定したら、'' | + | |
| - | + | ||
| - | When it knows it, it will create the '' | + | |
| - | + | ||
| - | それを認識すると、''/ | + | |
| - | + | ||
| - | In case the '' | + | |
| - | + | ||
| - | '' | + | |
| - | + | ||
| - | This file will be used as an interchange with the Pandora FMS Console to know at any time the IP address of the Percona/ | + | |
| - | + | ||
| - | このファイルは、**MASTER** の役割を持つ Percona/ | + | |
| - | + | ||
| - | * **restart** | + | |
| - | It will be indicated with a value of '' | + | |
| - | + | ||
| - | **pandora_ha** デーモンは、競合を回避しながら障害時のサービスの再起動を行うため、通常は値は '' | + | |
| - | + | ||
| - | < | + | |
| - | # Pandora FMS will restart after restart_delay seconds on critical errors. | + | |
| - | restart 0 | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | * **ha_backup_source_dir**: | + | |
| - | + | ||
| - | Directory that will contain the HA backup data. Default value: ''/ | + | |
| - | + | ||
| - | HA バックアップデータを保存するディレクトリ。デフォルト値: | + | |
| - | + | ||
| - | * **ha_mysql_source_dir**: | + | |
| - | + | ||
| - | Directory that will contain the MySQL data. Default value: ''/ | + | |
| - | + | ||
| - | MySQLデータを保存するディレクトリ。デフォルト値: | + | |
| - | + | ||
| - | <wrap #ks6_3_1 /> | + | |
| - | + | ||
| - | === サーバ間の SSH 鍵共有 === | + | |
| - | + | ||
| - | An OpenSSH server must be installed and running on each host. Suppress the welcome message or banner that displays OpenSSH, run on **all** devices: | + | |
| - | + | ||
| - | OpenSSH サーバがインストールされ、各ホストで動作している必要があります。OpenSSH を表示するウェルカムメッセージまたはバナーを抑制します。**すべて** のデバイスで以下を実行します: | + | |
| - | + | ||
| - | < | + | |
| - | [ -f / | + | |
| - | sed -i -e ' | + | |
| - | systemctl restart sshd | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | Share the SSH keys between '' | + | |
| - | + | ||
| - | '' | + | |
| - | + | ||
| - | < | + | |
| - | printf " | + | |
| - | ssh-copy-id -p22 root@node1 | + | |
| - | ssh-copy-id -p22 root@node2 | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | <WRAP center round important 75%> | + | |
| - | + | ||
| - | * In case you have the installation on Ubuntu Server, enable the **root** | + | |
| - | * Then enable the SSH connection of the root user at least through shared keys " | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | <WRAP center round important 75%> | + | |
| - | + | ||
| - | * Ubuntu Server にインストールしている場合は、**root** ユーザが SSH 経由で接続できるようにします。 これは、'' | + | |
| - | * 次に、'' | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | === 同期スクリプトの利用 === | + | |
| - | + | ||
| - | With Pandora FMS server a script is implemented that allows you to synchronize the **SLAVE** database in case it is out of sync. | + | |
| - | + | ||
| - | Pandora FMS サーバでは、同期が取れていない場合に **SLAVE** データベースを同期できるようにするスクリプトが実装されています。 | + | |
| - | + | ||
| - | The manual execution of this script is the following: | + | |
| - | + | ||
| - | スクリプトの手動実行は次の通りです: | + | |
| - | + | ||
| - | < | + | |
| ./ | ./ | ||
| - | |||
| </ | </ | ||
| - | For example, to make a manual synchronization from node 1 to node 2 the execution would be the following: | + | For example, to manually synchronize |
| - | 例えば、ノード1 | + | たとえば、ノード 1 をノード 2 に手動で同期するには、実行は次のようになります。 |
| - | + | ||
| - | < | + | |
| - | / | + | |
| + | <code bash> | ||
| + | / | ||
| + | / | ||
| + | | ||
| + | | ||
| </ | </ | ||
| - | To configure the automatic recovery of the HA environment when there is any synchronization problem between **MASTER** and **SLAVE**, it is necessary to have the configuration token '' | + | To configure the automatic recovery of the HA environment when there is any synchronization problem between **MASTER** and **SLAVE**, it is necessary to have the '' |
| - | **MASTER** と **SLAVE** | + | **MASTER** と **SLAVE** 間で同期の問題が発生した場合にHA環境の自動復旧を設定するには、サーバ設定ファイル(/ |
| - | So, whenever a [[# | + | Thus, whenever a [[# |
| - | そうすると、[[#スプリットブレイン|スプリットブレイン]] が発生した場合 (両方のサーバがマスターの役割を持っている場合)、または **MASTER** と **SLAVE** | + | したがって、[[#ks6_6|スプリットブレイン]]が発生するたび(両方のサーバがマスターの役割を持っている場合)、または **MASTER**ノードと **SLAVE** |
| - | This process will generate events in the system indicating the start, the end and if any error took place in there. | + | This process will generate events in the system indicating the start, the end and if any error has occurred within it. |
| - | この処理は、開始、終了、およびそこでエラーが発生したかどうかを示すイベントをシステムで生成します。 | + | この処理は、開始、終了、およびエラーが発生したかどうかを示すイベントをシステム内に生成します。 |
| <wrap #ks6_4 /> | <wrap #ks6_4 /> | ||
| - | ==== Pandora FMS コンソールの設定 ==== | ||
| - | |||
| - | <WRAP center round info 60%> | ||
| - | |||
| - | Version 770 or later. | ||
| - | |||
| - | </ | ||
| - | |||
| - | <WRAP center round info 60%> | ||
| - | |||
| - | バージョン 770 以降 | ||
| - | |||
| - | </ | ||
| - | |||
| - | A new parameter has been added to the '' | ||
| - | |||
| - | Pandora FMS が使用するデータ受け取りディレクトリのパス、デフォルトでは ''/ | ||
| - | |||
| - | If it is configured, it will look for the file ''/ | ||
| - | |||
| - | 設定されている場合、''/ | ||
| - | |||
| - | < | ||
| - | $config[" | ||
| - | |||
| - | </ | ||
| - | |||
| - | In Pandora FMS console you could see the cluster status accessing to the Manage HA view. | ||
| - | |||
| - | Pandora FMS コンソールでは、HA 管理画面にアクセスしてクラスタの状態を確認できます。 | ||
| - | |||
| - | < | ||
| - | https:// | ||
| - | |||
| - | </ | ||
| - | |||
| - | {{ : | ||
| - | |||
| - | The data of this view is constantly updated thanks to '' | ||
| - | |||
| - | この画面のデータは、'' | ||
| - | |||
| - | Among the available actions, you may configure a label for each one of the nodes and you can perform the option to synchronize the **SLAVE** node through the icon{{: | ||
| - | |||
| - | 実行可能なアクションとしては、各ノードのラベルを設定することができ、{{: | ||
| - | |||
| - | This icon can have the following states: | ||
| - | |||
| - | このアイコンには次の状態があります。 | ||
| - | |||
| - | * **Green**: Normal, no operation to be performed. | ||
| - | * **Blue**: Pending resynchronization. | ||
| - | * **Yellow**: Resynchronization is in progress. | ||
| - | * **Red**: //Error//, resynchronization failed. | ||
| - | * **緑**: 正常、何の処理も実行されていない。 | ||
| - | * **青**: 同期保留中。 | ||
| - | * **黄**: 同期実行中。 | ||
| - | * **赤**: // | ||
| 行 1881: | 行 1476: | ||
| </ | </ | ||
| - | **mysql** > '' | + | **mysql** > '' |
| - | **mysql** > '' | + | **mysql** > '' |
| **mysql** > '' | **mysql** > '' | ||
| 行 2128: | 行 1723: | ||
| *************************** 1. row *************************** | *************************** 1. row *************************** | ||
| | | ||
| - | Master_Host: | + | Master_Host: |
| Master_User: | Master_User: | ||
| Master_Port: | Master_Port: | ||
| 行 2203: | 行 1798: | ||
| </ | </ | ||
| - | [[ja: | + | [[ja: |
| ===== (OBSOLETE) データベース HA ===== | ===== (OBSOLETE) データベース HA ===== | ||