差分
このページの2つのバージョン間の差分を表示します。
ja:documentation:05_big_environments:06_ha [2023/04/27 05:45] – [サーバ間の SSH 鍵共有] junichi | ja:documentation:05_big_environments:06_ha [Unknown date] (現在) – 削除 - 外部編集 (Unknown date) 127.0.0.1 | ||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== 冗長化構成(HA) ====== | ||
- | {{indexmenu_n> | ||
- | |||
- | [[ja: | ||
- | |||
- | |||
- | |||
- | ===== 概要 ===== | ||
- | Pandora FMS はとても安定したアプリケーションになっています。(みなさんのテストのおかげで、それぞれのバージョンでは拡張が行われ、数百の不具合が報告され、修正されてきました。) しかし、クリティカルや高負荷な環境では、複数のサーバに処理を分散させることが可能です。Pandora FMS では、いずれかのコンポーネントで障害が発生しても、システム自体はダウンしません。 | ||
- | |||
- | Pandora FMS は、細かいモジュールで設計されています。それぞれのモジュールは、独立して動作することができます。しかし、それぞれはまた、連携して動作することができ、負荷を分配することができます。 | ||
- | |||
- | Pandora FMS の基本設計を以下に示します。 | ||
- | |||
- | {{ : | ||
- | |||
- | もちろん、エージェントは冗長化構成ではありません。エージェントがダウンすると、モジュールの実行ができず、また、複数のエージェントを平行して実行することはできないため、またはシステム自体がダウンしているため、そのエージェントの全てのデータ収集はできなくなります。 | ||
- | 重要なシステムに対する最良の解決策は、Pandora FMS エージェントのある無しに関わらず、冗長化しモニタリングすることです。 | ||
- | |||
- | いくつかの場面において、次のような HA 構成が可能です。 | ||
- | |||
- | * データサーバのバランシングと HA | ||
- | * ネットワーク、WMI、プラグイン、Web および予測サーバのバランシングと HA | ||
- | * データベースのロードバランシング | ||
- | * 自動検出サーバのバランシングと HA | ||
- | * Pandora FMS コンソールのバランシングと HA | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | ===== データサーバの HA ===== | ||
- | 最も簡単な方法は、エージェントに実装されている HA を使用することです(プライマリが応答しない場合は代替サーバーに接続できます)。 ただし、データサーバはポート 41121 をサポートし、標準の TCP ポートであるため、通常の TCP サービスのバランシングまたはクラスタリングを可能にする商用ソリューションを使用することができます。 | ||
- | |||
- | Pandora FMS データサーバでは、(異なるホスト名およびサーバ名で)設定された 2つの Pandora FMS データサーバを利用する必要があります。それぞれに tentacle サーバーを設定する必要があります。 各マシンは異なる IP アドレスを持ちます。 外部バランサを使用する場合、バランサにエージェントからのデータ送信用の接続 IP アドレス(VIP)を割り当てます。 | ||
- | |||
- | 外部バランサを使用していて、いずれかのサーバが故障した場合、アクティブなサーバにのみ接続するようになります。Pandora FMS エージェントは変更に気付くことなく、これまでと同様のアドレスへ接続します。しかし、この場合は、ロードバランサーは障害が発生したサーバにはデータを送信せず、アクティブな方にのみ送信します。 | ||
- | {{ : | ||
- | |||
- | Pandora FMS データサーバの設定を変更する必要はありません。それぞれのサーバに別々の名前を設定してさえいえれば、サーバの状態ビューでいずれかがダウンしていることがわかり便利です。Pandora FMS データモジュールは、いずれかのサーバで処理することができます。事前のサーバ指定は不要です。簡単に HA 構成がとれるように設計されています。 | ||
- | |||
- | エージェントの HA メカニズムを使用する場合は、データの送信にわずかな遅延があります。これは、エージェントの実行ごとにプライマリサーバとの接続を試みるためです。応答しない場合 セカンダリに対してこれを行います(設定されている場合)。これについては、次の " | ||
- | |||
- | 2つのデータサーバーを使用し、ポリシー、コレクション、およびリモート構成を管理する場合は、 [[: | ||
- | |||
- | * ''/ | ||
- | * ''/ | ||
- | * ''/ | ||
- | * ''/ | ||
- | * ''/ | ||
- | |||
- | ===== ソフトウエアエージェントでのバランシング ===== | ||
- | ソフトウエアエージェントで、データサーバのバランシングを行うことができます。データサーバの一方をマスター、もう一方をバックアップとして設定することができます。 | ||
- | |||
- | エージェントの設定ファイル pandora_agent.conf において、次の部分のコメントを外します。 | ||
- | |||
- | < | ||
- | # Secondary server configuration | ||
- | # ============================== | ||
- | # If secondary_mode is set to on_error, data files are copied to the secondary | ||
- | # server only if the primary server fails. If set to always, data files are | ||
- | # always copied to the secondary server | ||
- | secondary_mode on_error | ||
- | secondary_server_ip localhost | ||
- | secondary_server_path / | ||
- | secondary_server_port 41121 | ||
- | secondary_transfer_mode tentacle | ||
- | secondary_server_pwd mypassword | ||
- | secondary_server_ssl no | ||
- | secondary_server_opts | ||
- | </ | ||
- | |||
- | There are the following options (for more information, | ||
- | |||
- | 次に示すオプションがあります。(詳細は、[[: | ||
- | |||
- | * **secondary_mode**: | ||
- | * **on_error**: | ||
- | * **always**: メインサーバに接続できるできないに関わらず、常にセカンダリサーバにもデータを送信します。 | ||
- | * **secondary_server_ip**: | ||
- | * **secondary_server_path**: | ||
- | * **secondary_server_port**: | ||
- | * **secondary_transfer_mode**: | ||
- | * **secondary_server_pwd**: | ||
- | * **secondary_server_ssl**: | ||
- | * **secondary_server_opts**: | ||
- | |||
- | <WRAP center round important 60%> | ||
- | エージェントのリモート設定が有効になっている場合、メインサーバでのみ操作できます。 | ||
- | </ | ||
- | |||
- | ===== ネットワーク、WMI、プラグイン、ウェブ、予測サーバのバランシングと HA ===== | ||
- | これは簡単です。複数のサーバに、ネットワーク、WMI、プラグイン、ウェブ、予測サーバを (モニタしたいシステムを見れるよう同じように) それぞれインストールします。複数のサーバは (ネットワーク遅延が同じになるように) 同一セグメントに置く必要があります。 | ||
- | |||
- | それぞれのサーバはプライマリとして選択できます。それぞれのサーバは、他方がダウンした場合、そのサーバに割り当てられていた全てのモジュールデータの収集を自動的に引き継ぎます。Pandora FMS サーバには、最終接続時間 (サーバの threshold x 2) を確認して、他のサーバがダウンしていることを検知する仕組が実装されています。Pandora FMS サーバが 1台でも稼働していれば、他のサーバのダウンを検出することができます。すべての Pandora FMS サーバがダウンした場合は、検出する手段はありません。 | ||
- | |||
- | 2つのノードのシステムで HA およびロードバランシングを実装する簡単な方法は、それぞれのサーバに 50% ずつモジュールを割り当て、両方のサーバをマスターとして選択します。2つ以上のマスターサーバがあり、3台目がダウンした場合は、1台目のマスターサーバがダウンしたサーバに割り当てられていたモジュールの実行を自分自身に割り当てます。ダウンしたサーバが復旧した場合は、再度モジュールの実行が自動的にプライマリサーバに割り当てられます。 | ||
- | |||
- | |||
- | |||
- | {{ wiki: | ||
- | |||
- | |||
- | |||
- | 異なるサーバ間でのロードバランシングは、エージェント管理(Agent Administration) の設定メニューで実施します。 | ||
- | |||
- | {{ wiki: | ||
- | |||
- | |||
- | " | ||
- | |||
- | ==== サーバの設定 | ||
- | Pandora FMS サーバは、異なる 2つのモードで実行できます。 | ||
- | |||
- | * マスターモード | ||
- | * 非マスターモード | ||
- | |||
- | もしサーバがダウンすると、処理が止まらないように、そのサーバが持っていたモジュールはマスターサーバで実行されます。 | ||
- | |||
- | /// | ||
- | |||
- | master [1..7] | ||
- | |||
- | もし現在のマスターサーバがダウンすると、新たなマスターサーバが選択されます。複数の候補がある場合は、// | ||
- | |||
- | <WRAP center round important 60%> | ||
- | サーバの無効化には注意してください。ネットワークモジュールを持つサーバがダウンした場合、他のマスターサーバでネットワークサーバが無効化されていると、モジュールは実行されません。 | ||
- | </ | ||
- | |||
- | 例えば、// | ||
- | |||
- | pandora_server.conf に以下のパラメータを設定できます。 | ||
- | |||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | |||
- | ===== Pandora FMS コンソールの HA ===== | ||
- | 他のサーバにコンソールをインストールするだけです。それらのいずれからも、異なるユーザによって異なる場所から同時に使用することができます。 コンソールの前段でロードバランサを使用すると、セッションシステムが「クッキー」によって管理され、これがブラウザーに保管されるため、どちらがアクセスされているかを実際に知らなくてもアクセスできます。 | ||
- | |||
- | リモート設定を使用する場合、双方のデータサーバとコンソールは、データ入力ディレクトリ(/ | ||
- | <WRAP center round tip 60%> | ||
- | [[: | ||
- | </ | ||
- | |||
- | サーバのパフォーマンスに影響するため、data_in 以下のサブディレクトリのみ共有し、data_in 自体は共有しないことが重要です。 | ||
- | |||
- | ==== 更新 ==== | ||
- | HA 環境で Pandora FMS コンソールを更新する際に、アップデートマネージャ [[https:// | ||
- | |||
- | Enterprise 版のユーザは、Pandora FMS サポートサイトから OUM パッケージをダウンロードできます。 | ||
- | |||
- | 共有データベースを使用するバランシング環境では、最初のコンソールを更新すると、対応する変更がデータベースに適用されます。 これは、セカンダリのコンソールを更新しようとすると、データベースがすでに更新されているため、Pandora FMS がエラーメッセージを表示することになります。 ただし、コンソールの更新は引き続き実行されます。 | ||
- | |||
- | {{ : | ||
- | |||
- | {{ : | ||
- | |||
- | ===== 高可用性データベース ===== | ||
- | |||
- | <WRAP center round box 75%> | ||
- | |||
- | [[https:// | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round box 75%> | ||
- | |||
- | [[https:// | ||
- | |||
- | </ | ||
- | |||
- | The new Pandora FMS HA solution is integrated into the product (inside the pandora_ha binary). It implements an HA that supports geographically isolated sites, with different IP ranges, which is not possible with Corosync/ | ||
- | |||
- | 新しい Pandora FMS HA ソリューションは、製品 (pandora_ha バイナリ内) に統合されています。 Corosync/ | ||
- | |||
- | In the new HA model, the usual setup is in pairs of two, so the design does not implement a quorum system and simplifies the configuration and the necessary resources. That way the monitoring system will work as long as there is a DB node available and in case there is a DB Split Brain, the system will work in parallel until both nodes are merged again. | ||
- | |||
- | 新しい HA モデルでは、通常のセットアップは 2 つのペアであり、クォーラムシステムを実装しない設計となっており、設定と必要なリソースが簡素化されています。 これにより、監視システムは利用可能な DB ノードがある限り機能し、DB スプリットブレインが発生している場合は、システムは両方のノードが再びマージされるまで並行して機能します。 | ||
- | |||
- | The new proposal seeks to solve the current three problems: | ||
- | |||
- | 新しい仕組では、現在の 3 つの問題を解決しようとしています。 | ||
- | |||
- | - Complexity and maintainability of the current system (up to version NG 770). | ||
- | - Possibility of having an HA environment spread over different geographical locations with non-local network segmentation. | ||
- | - Data recovery procedure in case of split brain and secured system operation in case of communication breakdown between the two geographically separated sites. | ||
- | |||
- | - 現在のシステムの複雑さと保守性 (バージョン NG 770 まで)。 | ||
- | - ローカル以外のネットワークセグメントの利用で、HA 環境が地理的に異なる場所に分散している場合。 | ||
- | - 地理的に離れた 2 つのサイト間で通信障害が発生した場合のスプリットブレインおよび安全なシステム運用のデータ復旧。 | ||
- | |||
- | The new HA system for DB is implemented on Percona8, although in future versions we will detail how to do so also on MySQL/ | ||
- | |||
- | DB 用の新しい HA システムは Percona8 を用いて実装されていますが、将来のバージョンでは MySQL/ | ||
- | |||
- | Pandora FMS is based on a MySQL database to configure and store data, so a failure in the database can temporarily paralyze the monitoring tool. The Pandora FMS high availability database cluster allows to easily deploy a strong and fail-safe architecture. | ||
- | |||
- | Pandora FMS は、MySQL データベースを用いて設定およびデータを保存するため、データベースに障害が発生すると監視ツールが一時的に麻痺する可能性があります。 Pandora FMS の高可用性データベースクラスタにより、強力でフェイルセーフなアーキテクチャを簡単に展開できます。 | ||
- | |||
- | <WRAP center round important 75%> | ||
- | |||
- | This is an advanced feature that requires knowledge in GNU/Linux systems. It is important that all servers have the time synchronized with an NTP server (**chronyd** | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round important 75%> | ||
- | |||
- | これは、GNU/ | ||
- | |||
- | </ | ||
- | |||
- | Binary replication MySQL cluster nodes are managed with the '' | ||
- | |||
- | バイナリレプリケーション MySQL クラスタノードは、バージョン 770 (Enterprise 機能) 以降、'' | ||
- | |||
- | Active/ | ||
- | |||
- | アクティブ/ | ||
- | |||
- | The environment will consist of the following elements: | ||
- | |||
- | 環境は次の要素で構成されます。 | ||
- | |||
- | * MySQL8 servers with binary replication enabled (Active - Passive). | ||
- | * Server with '' | ||
- | |||
- | * バイナリレプリケーションが有効になっている MySQL8 サーバ (アクティブ - スタンバイ)。 | ||
- | * クラスタの正しい動作に必要なスレーブ - マスターおよびマスター - スレーブの継続的な監視の実施および昇格を実行するための、すべての MySQL サーバの設定を持つ '' | ||
- | |||
- | {{ : | ||
- | |||
- | ==== Percona 8 のインストール ==== | ||
- | |||
- | <WRAP center round info 60%> | ||
- | |||
- | Version 770 or later. | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round info 60%> | ||
- | |||
- | バージョン 770 以降 | ||
- | |||
- | </ | ||
- | |||
- | === RHEL 8 および Rocky Linux 8 への Percona 8 のインストール === | ||
- | |||
- | First of all, it is necessary to have the Percona repository installed in all the nodes of the environment in order to be able to install the Percona server packages later on. | ||
- | |||
- | 最初に、後で Percona サーバパッケージをインストールできるように、環境のすべてのノードに Percona リポジトリをインストールする必要があります。 | ||
- | |||
- | <WRAP center round important 75%> | ||
- | |||
- | You must open a terminal window with **root** rights or as **root** user. You are solely responsible for this key. The following instructions indicate whether you should run instructions on all devices, on some devices or on one device in particular, please pay attention to the statements. | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round important 75%> | ||
- | |||
- | **root** 権限で、または **root** ユーザとしてターミナルウィンドウを開く必要があります。各ユーザの責任において実行してください。次の手順には、すべてのデバイスで実行する必要があるもの、一部のデバイスで実行する必要があるもの、特定の 1 つのデバイスで実行する必要があものがあります。注釈に注意してください。 | ||
- | |||
- | </ | ||
- | |||
- | Execute on **all** devices involved: | ||
- | |||
- | 関連する**すべて**のデバイスで実行します: | ||
- | |||
- | < | ||
- | yum install -y https:// | ||
- | |||
- | </ | ||
- | |||
- | Activate version 8 of the Percona repository on **all** devices: | ||
- | |||
- | **すべて**のデバイスで Percona リポジトリのバージョン 8 を有効にします: | ||
- | |||
- | < | ||
- | percona-release setup ps80 | ||
- | |||
- | </ | ||
- | |||
- | Install the Percona server next to the backup tool with which the backups are to be performed for manual synchronization of both environments. Run on **all** devices involved: | ||
- | |||
- | 両方の環境を手動で同期するためのバックアップツールと Percona サーバをインストールします。 関連する **すべて** のデバイスで実行します: | ||
- | |||
- | < | ||
- | yum install percona-server-server percona-xtrabackup-80 | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round tip 75%> | ||
- | |||
- | In case you install the Percona server together with the Web Console and the PFMS server, you will be able to use the deploy indicating the MySQL 8 version by means of the '' | ||
- | < | ||
- | curl -Ls https:// | ||
- | |||
- | </ | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round tip 75%> | ||
- | |||
- | Percona サーバーを Web コンソールおよび Pandora FMS サーバと一緒にインストールする場合、'' | ||
- | |||
- | < | ||
- | curl -Ls https:// | ||
- | |||
- | </ | ||
- | |||
- | </ | ||
- | |||
- | === Percona 8 の Ubuntu Server へのインストール === | ||
- | |||
- | Install Percona repository version 8 on **all** devices: | ||
- | |||
- | **すべて** のデバイスに Percona リポジトリ バージョン 8 をインストールします。 | ||
- | |||
- | < | ||
- | curl -O https:// | ||
- | apt install -y gnupg2 lsb-release ./ | ||
- | |||
- | </ | ||
- | |||
- | Activate Percona repository version 8 on **all** devices: | ||
- | |||
- | **すべて** のデバイスで Percona リポジトリ バージョン 8 を有効化します: | ||
- | |||
- | < | ||
- | percona-release setup ps80 | ||
- | |||
- | </ | ||
- | |||
- | Install the Percona server next to the backup tool with which backups are to be performed for manual synchronization of both environments. On **all** devices run: | ||
- | |||
- | 両方の環境を手動で同期するためのバックアップツールと Percona サーバをインストールします。 **すべて** のデバイスで以下を実行します: | ||
- | |||
- | < | ||
- | apt install -y percona-server-server percona-xtrabackup-80 | ||
- | |||
- | </ | ||
- | |||
- | ==== バイナリレプリケーション設定 ==== | ||
- | |||
- | <WRAP center round info 60%> | ||
- | |||
- | Version 770 or later. | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round info 60%> | ||
- | |||
- | バージョン 770 以降 | ||
- | |||
- | </ | ||
- | |||
- | Once you have installed MySQL server in all the cluster nodes, proceed to configure both environments to have them replicated. | ||
- | |||
- | すべてのクラスタノードに MySQL サーバをインストールしたら、両方の環境をレプリケートするように設定します。 | ||
- | |||
- | First of all, configure the configuration file '' | ||
- | |||
- | まず、設定ファイル '' | ||
- | |||
- | === ノード 1 === | ||
- | |||
- | Node 1 ''/ | ||
- | |||
- | ノード 1 ''/ | ||
- | |||
- | < | ||
- | [mysqld] | ||
- | server_id=1 # It is important that it is different in all nodes. | ||
- | datadir=/ | ||
- | socket=/ | ||
- | log-error=/ | ||
- | pid-file=/ | ||
- | # OPTIMIZATION FOR PANDORA FMS | ||
- | innodb_buffer_pool_size = 4096 | ||
- | innodb_lock_wait_timeout = 90 | ||
- | innodb_file_per_table | ||
- | innodb_flush_method = O_DIRECT | ||
- | innodb_log_file_size = 64M | ||
- | innodb_log_buffer_size = 16M | ||
- | thread_cache_size = 8 | ||
- | max_connections = 200 | ||
- | key_buffer_size=4M | ||
- | read_buffer_size=128K | ||
- | read_rnd_buffer_size=128K | ||
- | sort_buffer_size=128K | ||
- | join_buffer_size=4M | ||
- | sql_mode="" | ||
- | # SPECIFIC PARAMETERS FOR BINARY REPLICATION | ||
- | binlog-do-db=pandora | ||
- | replicate-do-db=pandora | ||
- | max_binlog_size = 100M | ||
- | binlog-format=MIXED | ||
- | binlog_expire_logs_seconds=172800 # 2 DAYS | ||
- | sync_source_info=1 | ||
- | sync_binlog=1 | ||
- | port=3306 | ||
- | report-port=3306 | ||
- | report-host=master | ||
- | gtid-mode=off | ||
- | enforce-gtid-consistency=off | ||
- | master-info-repository=TABLE | ||
- | relay-log-info-repository=TABLE | ||
- | sync_relay_log = 0 | ||
- | replica_compressed_protocol = 1 | ||
- | replica_parallel_workers = 1 | ||
- | innodb_flush_log_at_trx_commit = 2 | ||
- | innodb_flush_log_at_timeout = 1800 | ||
- | |||
- | [client] | ||
- | user=root | ||
- | password=pandora | ||
- | |||
- | </ | ||
- | |||
- | * The tokens after the **OPTIMIZATION FOR PANDORA FMS** comment perform the optimized configuration for Pandora FMS. | ||
- | * After the comment **SPECIFIC PARAMETERS FOR BINARY REPLICATION** | ||
- | * The token called '' | ||
- | * In the '' | ||
- | |||
- | * **OPTIMIZATION FOR PANDORA FMS** というコメントの後の設定は、Pandora FMS 用に最適化された設定です。 | ||
- | * コメント **SPECIFIC PARAMETERS FOR BINARY REPLICATION** の後に、バイナリレプリケーションのための特定のパラメーターを設定しています。 | ||
- | * '' | ||
- | * '' | ||
- | |||
- | <WRAP center round important 75%> | ||
- | |||
- | It is important that the '' | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round important 75%> | ||
- | |||
- | '' | ||
- | |||
- | </ | ||
- | |||
- | === ノード 2 === | ||
- | |||
- | Node 2 ''/ | ||
- | |||
- | ノード 2 ''/ | ||
- | |||
- | < | ||
- | [mysqld] | ||
- | server_id=2 # It is important that it is different in all nodes. | ||
- | datadir=/ | ||
- | socket=/ | ||
- | log-error=/ | ||
- | pid-file=/ | ||
- | # OPTIMIZATION FOR PANDORA FMS | ||
- | innodb_buffer_pool_size = 4096 | ||
- | innodb_lock_wait_timeout = 90 | ||
- | innodb_file_per_table | ||
- | innodb_flush_method = O_DIRECT | ||
- | innodb_log_file_size = 64M | ||
- | innodb_log_buffer_size = 16M | ||
- | thread_cache_size = 8 | ||
- | max_connections = 200 | ||
- | key_buffer_size=4M | ||
- | read_buffer_size=128K | ||
- | read_rnd_buffer_size=128K | ||
- | sort_buffer_size=128K | ||
- | join_buffer_size=4M | ||
- | sql_mode="" | ||
- | # SPECIFIC PARAMETERS FOR BINARY REPLICATION | ||
- | binlog-do-db=pandora | ||
- | replicate-do-db=pandora | ||
- | max_binlog_size = 100M | ||
- | binlog-format=MIXED | ||
- | binlog_expire_logs_seconds=172800 # 2 DAYS | ||
- | sync_source_info=1 | ||
- | sync_binlog=1 | ||
- | port=3306 | ||
- | report-port=3306 | ||
- | report-host=master | ||
- | gtid-mode=off | ||
- | enforce-gtid-consistency=off | ||
- | master-info-repository=TABLE | ||
- | relay-log-info-repository=TABLE | ||
- | sync_relay_log = 0 | ||
- | replica_compressed_protocol = 1 | ||
- | replica_parallel_workers = 1 | ||
- | innodb_flush_log_at_trx_commit = 2 | ||
- | innodb_flush_log_at_timeout = 1800 | ||
- | |||
- | [client] | ||
- | user=root | ||
- | password=pandora | ||
- | |||
- | </ | ||
- | |||
- | * The tokens after the **OPTIMIZATION FOR PANDORA FMS** comment perform the optimized configuration for Pandora FMS. | ||
- | * After the comment **SPECIFIC PARAMETERS FOR BINARY REPLICATION** | ||
- | * The token called '' | ||
- | * In the '' | ||
- | |||
- | * **OPTIMIZATION FOR PANDORA FMS** というコメントの後の設定は、Pandora FMS 用に最適化された設定です。 | ||
- | * コメント **SPECIFIC PARAMETERS FOR BINARY REPLICATION** の後に、バイナリレプリケーションのための特定のパラメーターを設定しています。 | ||
- | * '' | ||
- | * '' | ||
- | |||
- | <WRAP center round important 75%> | ||
- | |||
- | It is important that the '' | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round important 75%> | ||
- | |||
- | '' | ||
- | |||
- | </ | ||
- | |||
- | === マスターノード設定 === | ||
- | |||
- | Once you have the correct configuration on both nodes, start the configuration of the node //that will take the role of master server//. | ||
- | |||
- | 両方のノードで正しい設定ができたら、// | ||
- | |||
- | **1.-** Start the '' | ||
- | |||
- | **1.-** '' | ||
- | |||
- | < | ||
- | systemctl start mysqld | ||
- | |||
- | </ | ||
- | |||
- | **2.-** Access with the temporary **root** password that will have been generated in the log, the file ''/ | ||
- | |||
- | **2.-** ログファイル ''/ | ||
- | |||
- | < | ||
- | grep " | ||
- | |||
- | </ | ||
- | |||
- | With the password that appears, access MySQL server: | ||
- | |||
- | 見つけたパスワードで、MySQL サーバへアクセスします: | ||
- | |||
- | < | ||
- | mysql -u root -p | ||
- | |||
- | </ | ||
- | |||
- | '' | ||
- | |||
- | '' | ||
- | |||
- | **3.-** Change the temporary password to '' | ||
- | |||
- | **3.-** **root** ユーザのテンポラリパスワードを '' | ||
- | |||
- | **mysql >** '' | ||
- | |||
- | **mysql >** '' | ||
- | |||
- | **mysql >** '' | ||
- | |||
- | **4.-** Create the binary replication user and **root** user for remote connections and cluster administration: | ||
- | |||
- | **4.-** バイナリレプリケーションユーザおよび、リモート接続とクラスタ管理のための **root** ユーザを作成します: | ||
- | |||
- | **mysql >** '' | ||
- | |||
- | **mysql >** '' | ||
- | |||
- | **mysql >** '' | ||
- | |||
- | **mysql >** '' | ||
- | |||
- | **5.-** Create Pandora FMS database: | ||
- | |||
- | **5.-** Pandora FMS データベースを作成します: | ||
- | |||
- | **mysql >** '' | ||
- | |||
- | **mysql >** '' | ||
- | |||
- | **mysql >** '' | ||
- | |||
- | **mysql >** '' | ||
- | |||
- | <WRAP center round info 60%> | ||
- | |||
- | For the **source** command: As long as Pandora FMS console is installed in the same server, //otherwise send this file to the master server//. | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round info 60%> | ||
- | |||
- | **source** コマンド: | ||
- | |||
- | </ | ||
- | |||
- | 6.- Create the pandora user and give the access privileges to this user: | ||
- | |||
- | **6.-** pandora ユーザを作成し、このユーザにアクセス権限を与えます: | ||
- | |||
- | **mysql >** '' | ||
- | |||
- | **mysql >** '' | ||
- | |||
- | <WRAP center round box 75%> | ||
- | |||
- | At this point you have the master server ready to start replicating Pandora FMS database. | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round box 75%> | ||
- | |||
- | これで、Pandora FMS データベースのレプリケーションを開始するためのマスターサーバの準備が完了です。 | ||
- | |||
- | </ | ||
- | |||
- | === データベースの複製 === | ||
- | |||
- | 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_mode [pandora|pacemaker]** | ||
- | The token with the pandora value will be indicated for the current '' | ||
- | |||
- | * **ha_mode [pandora|pacemaker]** | ||
- | 現在の '' | ||
- | |||
- | < | ||
- | |||
- | ha_mode pandora | ||
- | |||
- | </ | ||
- | |||
- | * **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/ | ||
- | |||
- | === サーバ間の 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: | ||
- | |||
- | 例えば、ノード1 からノード2 へ手動で同期するには、次のように実行します: | ||
- | |||
- | < | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | 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 '' | ||
- | |||
- | **MASTER** と **SLAVE** の間で同期の問題が発生した際に HA 環境の自動回復を設定するには、サーバ設定ファイル(''/ | ||
- | |||
- | So, whenever a [[: | ||
- | |||
- | そうすると、[[: | ||
- | |||
- | This process will generate events in the system indicating the start, the end and if any error took place in there. | ||
- | |||
- | この処理は、開始、終了、およびそこでエラーが発生したかどうかを示すイベントをシステムで生成します。 | ||
- | |||
- | ===== (OBSOLETE) データベース HA ===== | ||
- | <WRAP center round tip 75%> | ||
- | これは、Pandora FMS 環境において完全な HA を提供するソリューションです。これは、Pandora FMS で唯一公式にサポートされた HA モデルです。このソリューションは OUM 724 からあらかじめインストールされた状態で提供されています。このシステムは、以前お勧めしていた DRBD およびその他 HA システムを置き換えるものです。 | ||
- | </ | ||
- | |||
- | <WRAP center round todo 75%> | ||
- | これは、最初の Pandora DB HA の実装であり、導入処理は Linux コンソールで root を使うことによる、ほぼ手動です。将来のバージョンでは、GUI から簡単に設定できるようにする予定です。 | ||
- | </ | ||
- | |||
- | Pandora FMS は、設定とデータの保存のために MySQL データベースに依存しています。データベースの障害は、一時的に監視処理が停止することになります。Pandora FMS の高可用性データベースクラスタにより、冗長化、堅牢なアーキテクチャを実現します。 | ||
- | |||
- | <WRAP center round important 60%> This is an advanced feature that requires knowledge of GNU/Linux systems. </ | ||
- | |||
- | <WRAP center round important 60%> これは、GNU/ | ||
- | |||
- | クラスタリソースは、高度でスケーラブルな HA クラスタリソースマネージャである [[https:// | ||
- | |||
- | アクティブ/ | ||
- | |||
- | {{ wiki: | ||
- | |||
- | Pandora FMS データベース HA ツール // | ||
- | |||
- | <WRAP center round tip 60%>It is recommended to keep a maximum of 15 days of data and events, for longer storage a [[: | ||
- | |||
- | <WRAP center round tip 60%> | ||
- | </ | ||
- | |||
- | ==== RHEL 8 および Rocky Linux 8 へのインストール ==== | ||
- | |||
- | <WRAP center round info 60%> | ||
- | |||
- | <WRAP center round info 60%> | ||
- | |||
- | In this example a two-node cluster will be configured, with hosts: **node1** | ||
- | |||
- | この例では、**node1** および **node2** の 2ノードクラスタを設定します。 | ||
- | |||
- | Change the host names, passwords, etcetera as needed to match the environment to be deployed. | ||
- | |||
- | 展開する環境に合わせて、必要に応じてホスト名やパスワードなどを変更してください。 | ||
- | |||
- | Commands that have to be executed on any node will have the following syntax (example for **node1**): | ||
- | |||
- | いずれかのノードで実行する必要のあるコマンドの構文は次のとおりです(**node1** の例)。 | ||
- | |||
- | < | ||
- | |||
- | node1# | ||
- | < | ||
- | < | ||
- | < | ||
- | |||
- | </ | ||
- | |||
- | Commands that **have to be executed on all nodes** | ||
- | |||
- | **すてべのノードで実行する必要のある**コマンドは、**all** をつけています。 | ||
- | |||
- | < | ||
- | all# | ||
- | < | ||
- | < | ||
- | < | ||
- | |||
- | </ | ||
- | |||
- | There is also an additional host called **pandorafms** | ||
- | |||
- | Pandora FMS がインストールされる **pandorafms** と呼ばれる追加のホストもあります。**all** が使われる場合、それはデータベースノードのみを指し、追加のPandora FMS ノードは常に pandorafms として表現され、**all** には含まれません。 | ||
- | |||
- | === 前提条件 === | ||
- | |||
- | RHEL version 8 or Rocky Linux version 8 must be installed on all hosts, and must be able to resolve the hostnames of the other hosts. | ||
- | |||
- | RHEL バージョン 8 または Rocky Linux バージョン 8 が全ホストでインストールされている必要があり、また、他のホストのホスト名の名前解決ができる必要があります。 | ||
- | |||
- | An OpenSSH server must be installed and running on each host. **Suppress** | ||
- | |||
- | OpenSSH サーバがインストールされており、それぞれのホストで起動している必要があります。OpenSSH が表示する警告を**抑制**します。 | ||
- | |||
- | < | ||
- | all# | ||
- | [ -f / | ||
- | sed -i -e ' | ||
- | systemctl restart sshd | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round important 60%> \\ The Pandora FMS HA database tool will **not** | ||
- | |||
- | <WRAP center round important 60%> \\ OpenSSH で警告が出る設定されている場合、Pandora FMS HAデータベースツールは正しく機能しません。</ | ||
- | |||
- | Generate new SSH authentication keys for each host and copy the public key for each of the hosts. | ||
- | |||
- | ホストごとに新しい SSH 認証キーを生成し、ホストごとに公開鍵をコピーします。 | ||
- | |||
- | <WRAP center round important 60%> \\ You can generate keys for a user other than root for a later cluster installation with " | ||
- | |||
- | <WRAP center round important 60%> \\ "root 以外の" | ||
- | |||
- | < | ||
- | all# | ||
- | printf " | ||
- | ssh-copy-id -p22 root@node1 | ||
- | ssh-copy-id -p22 root@node2 | ||
- | |||
- | </ | ||
- | < | ||
- | |||
- | pandorafms# | ||
- | printf " | ||
- | ssh-copy-id -p22 root@node1 | ||
- | ssh-copy-id -p22 root@node2 | ||
- | |||
- | </ | ||
- | |||
- | In the Pandora FMS node, copy the key pair to the following directories **httpd** | ||
- | |||
- | Pandora FMS ノードで、キーペアを次の **httpd** および **ssh** ディレクトリにコピーします。 Pandora FMS コンソール(**httpd**) は、クラスターステータスを取得する必要があります。 | ||
- | |||
- | < | ||
- | |||
- | pandorafms# | ||
- | cp -r /root/.ssh/ / | ||
- | chown -R apache: | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round tip 60%> \\ The following steps are necessary only if the nodes run SSH on a non-standard port. \\ </ | ||
- | |||
- | <WRAP center round tip 60%> \\ 次の手順は、ノードが非標準ポートで SSH を実行している場合にのみ必要です。</ | ||
- | |||
- | You must replace 22 with the port number you use: | ||
- | |||
- | 22 を利用ポート番号に置き換える必要があります。 | ||
- | |||
- | < | ||
- | all# | ||
- | echo -e "Host node1\n Port 22">> | ||
- | echo -e "Host node2\n Port 22">> | ||
- | |||
- | </ | ||
- | |||
- | You must test authentication without password from each node to the others: | ||
- | |||
- | それぞれのノードからパスワード無しで他のノードの認証が通るかを確認する必要があります。 | ||
- | |||
- | < | ||
- | all# | ||
- | ssh node1 | ||
- | ssh node2 | ||
- | |||
- | </ | ||
- | |||
- | < | ||
- | pandorafms# | ||
- | ssh node1 | ||
- | ssh node2 | ||
- | |||
- | </ | ||
- | |||
- | === Percona のインストール === | ||
- | |||
- | Install the required package: | ||
- | |||
- | 必要なパッケージをインストールします。 | ||
- | |||
- | < | ||
- | all# | ||
- | dnf install dnf-utils \ | ||
- | | ||
- | | ||
- | |||
- | dnf module disable -y mysql | ||
- | |||
- | dnf install -y Percona-Server-server-57 percona-xtrabackup-24 | ||
- | |||
- | </ | ||
- | |||
- | For more information regarding the Percona installation process, you can consult the official product documentation: | ||
- | |||
- | ercona に関するより詳細なインストール処理は、公式ドキュメントを確認してください。 | ||
- | |||
- | <WRAP center round box 90%> \\ [[https:// | ||
- | </ | ||
- | |||
- | Once the packages are installed, make sure the Percona service is disabled, as it will be managed by the cluster: | ||
- | |||
- | パッケージをインストールしたら、Percona サービスが無効化されていることを確認します。これは、クラスタによって管理されるためです。 | ||
- | |||
- | < | ||
- | |||
- | all# | ||
- | systemctl disable mysqld | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round tip 60%> \\ If the system service is not disabled, the cluster resource manager will **not** | ||
- | |||
- | <WRAP center round tip 60%> \\ システムのサービスが無効化されていないと、クラスタのリソースマネージャが正しく動作しません。</ | ||
- | |||
- | Next, start the Percona server: | ||
- | |||
- | 次に、Percona サーバを起動します。 | ||
- | |||
- | < | ||
- | all# | ||
- | systemctl start mysqld | ||
- | |||
- | </ | ||
- | |||
- | A new temporary password will be generated connected to ''/ | ||
- | |||
- | 新規のテンポラリパスワードが生成され、''/ | ||
- | |||
- | < | ||
- | all# | ||
- | export MYSQL_PWD=$(grep " | ||
- | |||
- | echo """ | ||
- | SET PASSWORD FOR ' | ||
- | UNINSTALL PLUGIN validate_password; | ||
- | SET PASSWORD FOR ' | ||
- | """ | ||
- | |||
- | </ | ||
- | |||
- | When carrying out the MySQL configuration, | ||
- | |||
- | MySQL 設定は次の自動生成機能を使用して実行できます。これは、Pandora FMS Enterprise サーバのインストールパッケージと Pandora FMS ISO にデフォルトで含まれています。 | ||
- | |||
- | Once the server is installed, you will find the configuration builder for database replication at the path: | ||
- | |||
- | サーバをインストールしたら、次のパスにデータベースレプリケーション用の設定ビルダーをみつけます。 | ||
- | |||
- | < | ||
- | |||
- | / | ||
- | |||
- | </ | ||
- | |||
- | < | ||
- | Example: ./ | ||
- | Mandatory parameters: | ||
- | -i --serverid Set the server id for the database (Mandatory) | ||
- | Optional parameters: | ||
- | -l --location Set my.cnf custom location including filename. [ default value: /etc/my.cnf ] (optional) | ||
- | -d --database Set the database to be replicated. [ default value: pandora ] (optional) | ||
- | -b --binlog Set binlog file. [ default value: mysql-bin ] (optional) | ||
- | -u --dbuser Set dbuser for mysql connection and backups. [ default value: root ] (optional) | ||
- | -p --dbpass Set dbpassword for mysql connection and backups. [ default value: pandora ] (optional) | ||
- | -s --poolsize Set innodb_buffer_pool_size static size in M (Megabytes) or G (Gigabytes). [ default value: autocalculated ] (optional) | ||
- | -h --help Print help. | ||
- | |||
- | </ | ||
- | |||
- | In the current case where the databases are not on the same server as the application, | ||
- | |||
- | データベースがアプリケーションと同じサーバ上にない場合は、ローカルで実行するノードにスクリプトをコピーする必要があります。 | ||
- | |||
- | < | ||
- | pandorafms# | ||
- | scp / | ||
- | scp / | ||
- | |||
- | </ | ||
- | |||
- | It will only be necessary to pass the parameter **serverid** (mandatory) in standard environments and some optional parameters for custom environments. | ||
- | |||
- | 標準環境ではパラメータ **serverid** (必須)を渡す必要があります。また、カスタム環境ではいくつかのオプションパラメーターを使用します。 | ||
- | |||
- | If the default or defined user does not connect to the database, the script will end with a connection error. | ||
- | |||
- | デフォルトまたは定義済みのユーザがデータベースに接続できない場合、スクリプトは接続エラーで終了します。 | ||
- | |||
- | You also have the possibility of passing database name, user and password as arguments. Otherwise, the default settings will be used. | ||
- | |||
- | データベース名、ユーザ、パスワードを引数として渡すこともできます。 それ以外の場合は、デフォルト設定が使用されます。 | ||
- | |||
- | In this case, it will execute the script on both nodes, only passing the '' | ||
- | |||
- | この場合、両方のノードでスクリプトを実行し、デフォルトの認証情報がある場合にのみ '' | ||
- | |||
- | < | ||
- | node1# | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | < | ||
- | node2# | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round important 60%> \\ Each node must have a unique identifier. \\ </ | ||
- | |||
- | <WRAP center round important 60%> \\ それぞれのノードは、ユニークな ID を持つ必要があります。</ | ||
- | |||
- | < | ||
- | all# | ||
- | systemctl restart mysqld | ||
- | |||
- | </ | ||
- | |||
- | === Pandora FMS のインストール === | ||
- | |||
- | You can either perform a completely new installation or migrate the data you have from an existing instance. | ||
- | |||
- | 完全に新規インストールを実行するか、既存のインスタンスからデータを移行することができます。 | ||
- | |||
- | == 新規の Pandora FMS インストール == | ||
- | |||
- | [[: | ||
- | |||
- | 新規で作成するデータベースに [[: | ||
- | |||
- | < | ||
- | |||
- | pandorafms# | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | From version NG 754 onwards you have [[: | ||
- | |||
- | バージョン NG 754 以降では、高可用性(HA)環境に[[: | ||
- | |||
- | == 既存の Pandora FMS へのインストール == | ||
- | |||
- | Stop the Pandora FMS server: | ||
- | |||
- | Pandora FMS サーバを停止します。 | ||
- | |||
- | < | ||
- | |||
- | pandorafms# | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | Backup the Pandora FMS database and transfer it to node 1: | ||
- | |||
- | Pandora FMS データベースをバックアップし、node1 へ転送します。 | ||
- | |||
- | < | ||
- | pandorafms# mysqldump -uroot -ppandora --databases pandora> / | ||
- | |||
- | </ | ||
- | |||
- | Now upload the information to the new database on the node (in case of not using the default credentials and database name, change it in the following command): | ||
- | |||
- | 次に、ノード上の新しいデータベースに情報をアップロードします(デフォルトの認証情報とデータベース名を使用しない場合は該当部分を変更します)。 | ||
- | |||
- | < | ||
- | node1# mysql -uroot -ppandora pandora -e source "/ | ||
- | |||
- | </ | ||
- | |||
- | === レプリケーション設定 === | ||
- | |||
- | Grant the necessary privileges for the replication in order to work in all the databases: | ||
- | |||
- | 全データベースでレプリケーションが動作するのに必要な権限を設定します。 | ||
- | |||
- | < | ||
- | all# | ||
- | mysql -uroot -ppandora | ||
- | GRANT ALL ON pandora.* TO ' | ||
- | GRANT REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO ' | ||
- | GRANT REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO ' | ||
- | GRANT REPLICATION CLIENT, REPLICATION SLAVE, SUPER, PROCESS, RELOAD ON *.* TO ' | ||
- | GRANT select ON mysql.user TO ' | ||
- | |||
- | </ | ||
- | |||
- | Stop the **node2** database: | ||
- | |||
- | **node2** データベースを停止します。 | ||
- | |||
- | < | ||
- | node2# | ||
- | systemctl stop mysqld | ||
- | |||
- | </ | ||
- | |||
- | Backup the database of the first node (**node1**) and write the name and position of the master log file (in this example, '' | ||
- | |||
- | 最初のノード (**node1**) のデータベースをバックアップし、マスターログファイルの名前と位置(この例では、'' | ||
- | |||
- | < | ||
- | node1# | ||
- | [ -e / | ||
- | innobackupex --no-timestamp / | ||
- | innobackupex --apply-log / | ||
- | rsync -avpP -e ssh / | ||
- | cat / | ||
- | |||
- | </ | ||
- | |||
- | Load the database on the second node (**node2**) and configure to replicate from the first node (you must set '' | ||
- | |||
- | 2つ目のノード(**node2**)にデータベースをコピーし、1つ目のノードからレプリケーションをする設定をします。(上記のステップで記録しておいた '' | ||
- | |||
- | < | ||
- | node2# | ||
- | chown -R mysql:mysql / | ||
- | chcon -R system_u: | ||
- | |||
- | systemctl start mysqld | ||
- | |||
- | mysql -uroot -ppandora | ||
- | CHANGE MASTER TO MASTER_HOST=' | ||
- | MASTER_USER=' | ||
- | MASTER_LOG_FILE =' | ||
- | START SLAVE; | ||
- | SHOW SLAVE STATUS \G | ||
- | |||
- | </ | ||
- | |||
- | You will get an output similar to: | ||
- | |||
- | 次のような出力結果が得られます。 | ||
- | |||
- | {{ : | ||
- | |||
- | <WRAP center round important 75%>You must make sure that '' | ||
- | |||
- | <WRAP center round important 75%>'' | ||
- | |||
- | If everything was correct exit the database interface: | ||
- | |||
- | 全て正常であれば、データベースのインタフェースから抜けます。 | ||
- | |||
- | < | ||
- | #node2 | ||
- | mysql> QUIT | ||
- | |||
- | </ | ||
- | |||
- | === 2ノードクラスタ設定 === | ||
- | |||
- | Install the necessary packages: For Rocky Linux™ it will only be necessary to execute the following command. | ||
- | |||
- | 必要なパッケージをインストールします。Rocky Linux では、次のコマンドを実行する必要があるのみです。 | ||
- | |||
- | < | ||
- | all# | ||
- | dnf install -y --enablerepo=' | ||
- | |||
- | </ | ||
- | |||
- | In the case of RedHat it will be necessary to enable the **rhel-8-for-x86_64-highavailability-rpms** | ||
- | |||
- | RedHat の場合、インストールする前に、サブスクリプションマネージャーから **rhel-8-for-x86_64-highavailability-rpms** リポジトリーを有効にする必要があります。 | ||
- | |||
- | < | ||
- | all# | ||
- | subscription-manager repos --enable=rhel-8-for-x86_64-highavailability-rpms | ||
- | dnf install -y --enablerepo=' | ||
- | |||
- | </ | ||
- | |||
- | Now define the configuration file and enable the **corosync**, | ||
- | |||
- | 設定を行い、**corosync**, | ||
- | |||
- | < | ||
- | all# | ||
- | cp / | ||
- | |||
- | systemctl enable chronyd --now | ||
- | |||
- | systemctl enable pcsd --now | ||
- | |||
- | systemctl enable corosync --now | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round info 60%> \\ You may see an error message when trying to start the **corosync** | ||
- | |||
- | <WRAP center round info 60%> \\ **corosync** 開始時にエラーが表示される場合があります。それはまだ設定されていないためですので、無視して次のステップで設定します。</ | ||
- | |||
- | Stop the Percona server: | ||
- | |||
- | Percona サーバを停止します。 | ||
- | |||
- | < | ||
- | all# | ||
- | systemctl stop mysqld | ||
- | |||
- | </ | ||
- | |||
- | === クラスタ内の全ノードの認証 === | ||
- | |||
- | Define the user password '' | ||
- | |||
- | '' | ||
- | |||
- | < | ||
- | all# | ||
- | echo hapass | passwd hacluster --stdin | ||
- | |||
- | </ | ||
- | |||
- | Create and start the cluster, these steps will only be necessary to do it in **node1**: | ||
- | |||
- | クラスタを作成し開始します。これらのステップは、**node1** でのみ実行する必要があります。 | ||
- | |||
- | < | ||
- | |||
- | node1# | ||
- | pcs host auth node1 node2 -u hacluster -p hapass | ||
- | |||
- | pcs cluster setup pandorafms node1 node2 --force | ||
- | |||
- | pcs cluster start --all | ||
- | pcs cluster enable --all | ||
- | |||
- | pcs property set stonith-enabled=false | ||
- | |||
- | pcs property set no-quorum-policy=ignore | ||
- | |||
- | </ | ||
- | |||
- | Check the status of the cluster: | ||
- | |||
- | クラスタの状態を確認します。 | ||
- | |||
- | < | ||
- | node1# | ||
- | pcs status | ||
- | |||
- | </ | ||
- | |||
- | You will see an output similar to: | ||
- | |||
- | 次のような出力が得られます。 | ||
- | |||
- | {{ : | ||
- | |||
- | <WRAP center round important 75%>\\ | ||
- | Both nodes should be online | ||
- | |||
- | ( '' | ||
- | |||
- | //Other values may be different from the example.// \\ | ||
- | </ | ||
- | |||
- | <WRAP center round important 75%>\\ | ||
- | 両方のノードがオンラインです。 | ||
- | |||
- | ( '' | ||
- | |||
- | その他の値は例とは異なることがあります。 | ||
- | </ | ||
- | |||
- | === Percona の Pacemaker レプリケーションエージェントのインストール === | ||
- | |||
- | Pacemaker can be downloaded manually from the [[https:// | ||
- | |||
- | Pacemaker は [[https:// | ||
- | |||
- | In case you have internet access you can install it by running: | ||
- | |||
- | インターネット接続があれば、以下を実行することでインストールできます。 | ||
- | |||
- | < | ||
- | |||
- | all# | ||
- | cd / | ||
- | mkdir percona | ||
- | cd percona | ||
- | curl -L -o pacemaker_mysql_replication.zip | ||
- | https:// | ||
- | l_replication.zip | ||
- | unzip pacemaker_mysql_replication.zip | ||
- | rm -f pacemaker_mysql_replication.zip | ||
- | chmod u+x mysql | ||
- | cd | ||
- | |||
- | </ | ||
- | |||
- | Configure cluster resources. | ||
- | |||
- | クラスタリソースを設定します。 | ||
- | |||
- | <WRAP center round important 75%>If the default password used in this guide for the database root user has been changed, it is advisable to update '' | ||
- | |||
- | <WRAP center round important 75%> | ||
- | |||
- | Replace **< | ||
- | |||
- | **< | ||
- | |||
- | < | ||
- | #node1 | ||
- | export VIP='< | ||
- | pcs resource create pandoradb ocf: | ||
- | pid="/ | ||
- | replication_user=" | ||
- | evict_outdated_slaves=" | ||
- | test_user=" | ||
- | op stop interval=" | ||
- | op monitor role=" | ||
- | timeout=" | ||
- | |||
- | pcs resource create pandoraip ocf: | ||
- | op monitor interval=20s | ||
- | |||
- | pcs resource promotable pandoradb meta master-max=" | ||
- | globally-unique=" | ||
- | |||
- | pcs constraint colocation add master pandoradb-clone with pandoraip | ||
- | |||
- | pcs constraint order promote pandoradb-clone then start pandoraip | ||
- | |||
- | sleep 5 ; pcs resource cleanup | ||
- | |||
- | </ | ||
- | |||
- | Check the cluster status: | ||
- | |||
- | クラスタの状態を確認します。 | ||
- | |||
- | < | ||
- | node1# | ||
- | pcs status | ||
- | |||
- | </ | ||
- | |||
- | You will see an output similar to: | ||
- | |||
- | 次のような出力が得られます。 | ||
- | |||
- | {{ : | ||
- | |||
- | <WRAP center round important 75%>\\ | ||
- | Both nodes should be online | ||
- | |||
- | ( '' | ||
- | |||
- | //Other values may be different from the example.// \\ | ||
- | </ | ||
- | |||
- | <WRAP center round important 75%>\\ | ||
- | 両方のノードがオンラインになります。 | ||
- | |||
- | ( '' | ||
- | |||
- | その他の値は例とは異なる場合があります。 | ||
- | </ | ||
- | |||
- | === root 以外のユーザでの 2ノードクラスタの設定 === | ||
- | |||
- | It will be done in a [[: | ||
- | |||
- | [[: | ||
- | |||
- | The user's credentials must have been copied, previously explained, and the following steps must be carried out: | ||
- | |||
- | すでに説明しているように、ログイン情報はコピーされている必要があり、以下のステップを実行する必要があります。 | ||
- | |||
- | < | ||
- | |||
- | # All nodes: | ||
- | useradd < | ||
- | passwd < | ||
- | usermod -a -G haclient < | ||
- | |||
- | # Enable PCS ACL system | ||
- | pcs property set enable-acl=true --force | ||
- | |||
- | # Create role | ||
- | pcs acl role create <rol> description=" | ||
- | |||
- | # Create PCS user - Local user | ||
- | pcs acl user create < | ||
- | |||
- | # Login into PCS from ALL nodes | ||
- | su - < | ||
- | pcs status | ||
- | Username: < | ||
- | Password: ***** | ||
- | |||
- | # Wait for ' | ||
- | |||
- | </ | ||
- | |||
- | ==== RedHat 7 および CentOS 7 へのインストール ==== | ||
- | |||
- | <WRAP center round info 60%> | ||
- | |||
- | <WRAP center round info 60%> | ||
- | |||
- | Configure a two-node cluster, with hosts // | ||
- | |||
- | //node1// および //node2// の 2つのノードのクラスタを設定します。環境に合わせて、ホスト名、パスワードなどを変更します。 | ||
- | |||
- | 一方のノードで実行するコマンドにについては、ノードのホスト名を前に表示します。例: | ||
- | |||
- | < | ||
- | node1# < | ||
- | |||
- | </ | ||
- | |||
- | すべてのノードで実行するコマンドについては、**all** を前に表示します。例: | ||
- | |||
- | < | ||
- | all# < | ||
- | |||
- | </ | ||
- | |||
- | さらに、Pandora FMS がインストールされているノードを **pandorafms** とします。 | ||
- | |||
- | <WRAP center round important 60%>When referencing **all** | ||
- | |||
- | <WRAP center round important 60%> | ||
- | |||
- | |||
- | === 前提条件 === | ||
- | CentOS バージョン 7 がすべてのノードにインストールされており、それぞれのホスト名の名前解決ができる必要があります。 | ||
- | |||
- | < | ||
- | | ||
- | PING node2 (192.168.0.2) 56(84) bytes of data. | ||
- | |||
- | | ||
- | PING node1 (192.168.0.1) 56(84) bytes of data. | ||
- | |||
- | | ||
- | PING node1 (192.168.0.1) 56(84) bytes of data. | ||
- | |||
- | | ||
- | PING node2 (192.168.0.2) 56(84) bytes of data. | ||
- | |||
- | </ | ||
- | |||
- | OpenSSH サーバがインストールされており、各ホストで実行されている必要があります。OpenSSH が表示するバナーを削除します。 | ||
- | |||
- | < | ||
- | all# [ -f / | ||
- | all# sed -i -e ' | ||
- | all# systemctl restart sshd | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | Pandora FMS データベース HA ツールは、OpenSSH のバナーを調整していないと正しく動作しません。 | ||
- | </ | ||
- | |||
- | それぞれのホストで SSH 認証鍵を生成し、公開鍵を他のホストへコピーします。 | ||
- | |||
- | <WRAP center round important 60%> | ||
- | root 以外のユーザを使用した設定を行う場合は、root 以外のユーザで鍵を生成します。 | ||
- | </ | ||
- | |||
- | < | ||
- | | ||
- | | ||
- | | ||
- | |||
- | | ||
- | | ||
- | | ||
- | |||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | </ | ||
- | |||
- | Pandora FMS ノードで、鍵のペアを /// | ||
- | |||
- | < | ||
- | |||
- | | ||
- | | ||
- | |||
- | </ | ||
- | |||
- | SSH が標準以外のポートで動作しているノードでは、以下のステップが必要です。// | ||
- | |||
- | < | ||
- | all# echo -e "Host node1\n | ||
- | all# echo -e "Host node2\n | ||
- | |||
- | </ | ||
- | |||
- | === Percona のインストール === | ||
- | 必要なパッケージをインストールします。 | ||
- | |||
- | < | ||
- | all# yum install https:// | ||
- | |||
- | all# yum install -y Percona-Server-server-57 percona-xtrabackup-24 | ||
- | |||
- | </ | ||
- | |||
- | For more information regarding the Percona installation process, check the official product documentation at: [[https:// | ||
- | |||
- | Percona に関するより詳細なインストール処理は、[[https:// | ||
- | |||
- | Once the packages have been installed, make sure the Percona service is disabled, since it will be managed by the cluster: | ||
- | |||
- | パッケージをインストールしたら、Percona サービスが無効化されていることを確認します。これは、クラスタによって管理されるためです。 | ||
- | |||
- | < | ||
- | |||
- | all# systemctl disable mysqld | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | システムのサービスが無効化されていないと、クラスタのリソースマネージャが正しく動作しません。 | ||
- | </ | ||
- | |||
- | 次に、Percona サーバを起動します。 | ||
- | |||
- | < | ||
- | all# systemctl start mysqld | ||
- | |||
- | </ | ||
- | |||
- | 新規のテンポラリパスワードが生成され、/ | ||
- | |||
- | < | ||
- | all# mysql -uroot -p$(grep " | ||
- | rev | cut -d' ' -f1 | rev) | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | </ | ||
- | |||
- | Reinstall with the '' | ||
- | |||
- | '' | ||
- | |||
- | < | ||
- | |||
- | pandorafms# ./ | ||
- | |||
- | </ | ||
- | |||
- | HA ツールを有効化してサーバをインストールしたら、データベースレプリケーションの設定ジェネレータを /// | ||
- | |||
- | < | ||
- | Example: ./ | ||
- | Mandatory parameters: | ||
- | -i --serverid | ||
- | Optional parameters: | ||
- | -l --location | ||
- | -d --database | ||
- | -b --binlog | ||
- | -u --dbuser | ||
- | -p --dbpass | ||
- | -s --poolsize | ||
- | -h --help | ||
- | |||
- | </ | ||
- | |||
- | データベースがアプリケーションと同じサーバ上にないケースでは、ローカルで実行するノードにスクリプトをコピーする必要があります。 | ||
- | |||
- | < | ||
- | | ||
- | | ||
- | |||
- | </ | ||
- | |||
- | As you see in the example, it will only be necessary to enter the parameter **serverid** (mandatory) in standard environments and some optional parameters for custom environments. | ||
- | |||
- | 例でわかるように、標準環境でパラメーター **serverid**(必須)を渡すか、カスタム環境の場合はいくつかのオプションパラメータを展開するだけで済みます。 | ||
- | |||
- | デフォルトのユーザまたは定義されたユーザがデータベースに接続できない場合、スクリプトは接続エラーとなります。 | ||
- | |||
- | データベース、ユーザ、パスワードを引数として渡すこともできます。それ以外の場合は、デフォルト設定が使用されます。 | ||
- | |||
- | この場合、両方のノードでスクリプトを実行し、デフォルトの資格情報がある場合にのみサーバ ID を渡します。それ以外の場合は、必要なパラメータを定義します。 | ||
- | |||
- | < | ||
- | | ||
- | | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round important 60%> each node must have a unique ID.</ | ||
- | |||
- | <WRAP center round important 60%> それぞれのノードはユニークな ID を持つ必要があります。</ | ||
- | |||
- | Percona の設定ファイルは /etc/my.cnf に書き込まれ、サーバ ID とデータベースレプリケーションの推奨設定が定義されます。 | ||
- | |||
- | mysqld サービスを再起動して、設定が正しく適用されていることを確認します。 | ||
- | |||
- | < | ||
- | all# systemctl restart mysqld | ||
- | |||
- | </ | ||
- | |||
- | === Pandora FMS のインストール === | ||
- | |||
- | ==新規の Pandora FMS インストール== | ||
- | |||
- | [[: | ||
- | |||
- | 新規で作成するデータベースに [[: | ||
- | |||
- | < | ||
- | https:// | ||
- | |||
- | </ | ||
- | |||
- | Pandora FMS サーバを停止します。 | ||
- | |||
- | < | ||
- | pandorafms# / | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round tip 60%>\\ | ||
- | From version NG 754 onwards, [[: | ||
- | </ | ||
- | |||
- | <WRAP center round tip 60%>\\ | ||
- | バージョン NG 754 以降では、高可用性(HA)環境に[[: | ||
- | </ | ||
- | |||
- | ==既存の Pandora FMS へのインストール== | ||
- | |||
- | Pandora FMS サーバを停止します。 | ||
- | < | ||
- | |||
- | pandorafms# / | ||
- | |||
- | </ | ||
- | |||
- | Pandora FMS データベースをバックアップします。 | ||
- | |||
- | < | ||
- | pandorafms# mysqldump -uroot -ppandora --databases pandora> / | ||
- | pandorafms# scp / | ||
- | |||
- | </ | ||
- | |||
- | バックアップを新しいデータベースにリストアします。 | ||
- | |||
- | < | ||
- | node1# mysql -uroot -ppandora -e source "/ | ||
- | |||
- | </ | ||
- | |||
- | |||
- | === レプリケーション設定 === | ||
- | 全データベースでレプリケーションが動作するのに必要な権限を設定します。 | ||
- | |||
- | < | ||
- | all# mysql -uroot -ppandora | ||
- | | ||
- | | ||
- | TO ' | ||
- | | ||
- | TO ' | ||
- | | ||
- | | ||
- | | ||
- | |||
- | </ | ||
- | |||
- | 1つ目のノードのデータベースをバックアップし、マスターログファイル名とポジションを記録します。(以下の例では、それぞれ // | ||
- | |||
- | < | ||
- | node1# [ -e / | ||
- | node1# innobackupex --no-timestamp / | ||
- | node1# innobackupex --apply-log / | ||
- | node1# cat / | ||
- | mysql-bin.000001 | ||
- | |||
- | </ | ||
- | |||
- | 2つ目のノードにデータベースをコピーし、1つ目のノードからレプリケーションをする設定をします。(上記のステップで記録しておいた MASTER_LOG_FILE と MASTER_LOG_POS を指定します。) | ||
- | |||
- | < | ||
- | node2# systemctl stop mysqld | ||
- | |||
- | node1# rsync -avpP -e ssh / | ||
- | |||
- | node2# chown -R mysql:mysql / | ||
- | node2# chcon -R system_u: | ||
- | node2# systemctl start mysqld | ||
- | node2# mysql -uroot -ppandora | ||
- | mysql> CHANGE MASTER TO MASTER_HOST=' | ||
- | MASTER_USER=' | ||
- | MASTER_LOG_FILE=' | ||
- | mysql> START SLAVE; | ||
- | mysql> SHOW SLAVE STATUS \G | ||
- | | ||
- | Slave_IO_State: | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | Relay_Log_File: | ||
- | | ||
- | | ||
- | Slave_IO_Running: | ||
- | | ||
- | | ||
- | | ||
- | Replicate_Do_Table: | ||
- | Replicate_Ignore_Table: | ||
- | | ||
- | | ||
- | Last_Errno: 0 | ||
- | Last_Error: | ||
- | Skip_Counter: | ||
- | | ||
- | | ||
- | | ||
- | Until_Log_File: | ||
- | | ||
- | Master_SSL_Allowed: | ||
- | Master_SSL_CA_File: | ||
- | Master_SSL_CA_Path: | ||
- | | ||
- | | ||
- | Master_SSL_Key: | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | Last_SQL_Errno: | ||
- | Last_SQL_Error: | ||
- | | ||
- | Master_Server_Id: | ||
- | | ||
- | Master_Info_File: | ||
- | | ||
- | | ||
- | | ||
- | Master_Retry_Count: | ||
- | | ||
- | | ||
- | Last_SQL_Error_Timestamp: | ||
- | Master_SSL_Crl: | ||
- | Master_SSL_Crlpath: | ||
- | Retrieved_Gtid_Set: | ||
- | | ||
- | | ||
- | Replicate_Rewrite_DB: | ||
- | Channel_Name: | ||
- | Master_TLS_Version: | ||
- | 1 row in set (0.00 sec) | ||
- | mysql> QUIT | ||
- | |||
- | all# systemctl stop mysqld | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **Slave_IO_Running** と **Slave_SQL_Running** が **Yes** であることを確認します。その他の値は例とは異なります。 | ||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | この処理を実行するのに **root** を **利用しない** ようにしてください。競合の可能性を回避するために、データベースの管理を担当するユーザにアクセス権限を付与することをお勧めします。 | ||
- | </ | ||
- | |||
- | === 2ノードクラスタの設定 === | ||
- | 必要なパッケージをインストールします。 | ||
- | |||
- | < | ||
- | all# yum install -y epel-release corosync ntp pacemaker pcs | ||
- | |||
- | all# systemctl enable ntpd | ||
- | all# systemctl enable corosync | ||
- | all# systemctl enable pcsd | ||
- | all# cp / | ||
- | |||
- | </ | ||
- | |||
- | < | ||
- | all# systemctl start ntpd | ||
- | all# systemctl start corosync | ||
- | all# systemctl start pcsd | ||
- | |||
- | </ | ||
- | |||
- | Percona サーバを停止します。 | ||
- | |||
- | < | ||
- | node1# systemctl stop mysqld | ||
- | |||
- | </ | ||
- | |||
- | < | ||
- | node2# systemctl stop mysqld | ||
- | |||
- | </ | ||
- | |||
- | == クラスタ内の全ノードの認証 == | ||
- | |||
- | クラスタを作成し、開始します。 | ||
- | |||
- | < | ||
- | all# echo hapass | passwd hacluster --stdin | ||
- | |||
- | </ | ||
- | < | ||
- | |||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | </ | ||
- | |||
- | クラスタの状態を確認します。 | ||
- | |||
- | < | ||
- | node#1 pcs status | ||
- | | ||
- | | ||
- | | ||
- | Last updated: Fri Jun 8 12:53:49 2018 | ||
- | Last change: Fri Jun 8 12:53:47 2018 by root via cibadmin on node1 | ||
- | |||
- | 2 nodes configured | ||
- | 0 resources configured | ||
- | |||
- | | ||
- | |||
- | No resources | ||
- | |||
- | | ||
- | | ||
- | | ||
- | pcsd: active/ | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | 両方のノードがオンライン (**Online: [ node1 node2 ]**) である必要があります。その他の値は例とは異なります。 | ||
- | </ | ||
- | |||
- | == Percona pacemake replication agent のインストール == | ||
- | |||
- | これは、我々の [[https:// | ||
- | |||
- | < | ||
- | all# cd / | ||
- | all# mkdir percona | ||
- | all# cd percona | ||
- | all# curl -L -o pacemaker_mysql_replication.zip https:// | ||
- | all# unzip pacemaker_mysql_replication.zip | ||
- | all# rm -f pacemaker_mysql_replication.zip | ||
- | all# chmod u+x mysql | ||
- | </ | ||
- | |||
- | クラスタリソースを設定します。**< | ||
- | |||
- | <WRAP center round important 60%> | ||
- | データベースの root ユーザのデフォルトパスワードを変更している場合は、関連して // | ||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | クラスタのリソース名は、このガイドで示されているものと正確に一致する必要があります (" | ||
- | </ | ||
- | |||
- | < | ||
- | node1# export VIP=< | ||
- | node1# pcs resource create pandoradb ocf: | ||
- | pid="/ | ||
- | replication_user=" | ||
- | evict_outdated_slaves=" | ||
- | test_user=" | ||
- | op stop interval=" | ||
- | op monitor role=" | ||
- | timeout=" | ||
- | node1# pcs resource create pandoraip ocf: | ||
- | op monitor interval=20s | ||
- | node1# pcs resource master master_pandoradb pandoradb meta master-max=" | ||
- | master-node-max=" | ||
- | globally-unique=" | ||
- | node1# pcs constraint colocation add master master_pandoradb with pandoraip | ||
- | node1# pcs constraint order promote master_pandoradb then start pandoraip | ||
- | </ | ||
- | |||
- | クラスタの状態を確認します。 | ||
- | |||
- | < | ||
- | node1# pcs status | ||
- | | ||
- | | ||
- | | ||
- | Last updated: Fri Jun 8 13:02:21 2018 | ||
- | Last change: Fri Jun 8 13:02:11 2018 by root via cibadmin on node1 | ||
- | |||
- | 2 nodes configured | ||
- | 3 resources configured | ||
- | |||
- | | ||
- | |||
- | Full list of resources: | ||
- | |||
- | Master/ | ||
- | Masters: [ node1 ] | ||
- | Slaves: [ node2 ] | ||
- | pandoraip | ||
- | |||
- | | ||
- | | ||
- | | ||
- | pcsd: active/ | ||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | 両方のノードがオンライン (**Online: [ node1 node2 ]**) である必要があります。その他の値は例とは異なります。 | ||
- | </ | ||
- | |||
- | === root 以外のユーザでの 2ノードクラスタの設定 === | ||
- | |||
- | It will be done [[: | ||
- | |||
- | [[: | ||
- | |||
- | # 全ノード: | ||
- | |||
- | < | ||
- | | ||
- | | ||
- | | ||
- | |||
- | </ | ||
- | |||
- | < | ||
- | # PCS ACL システムの有効化 | ||
- | pcs property set enable-acl=true --force | ||
- | </ | ||
- | |||
- | < | ||
- | # ロールの作成 | ||
- | pcs acl role create <rol> description=" | ||
- | </ | ||
- | |||
- | < | ||
- | # PCS ユーザの作成 - ローカルユーザ | ||
- | pcs acl user create < | ||
- | </ | ||
- | |||
- | < | ||
- | # 全ノードから PCS へログイン | ||
- | su - < | ||
- | pcs status | ||
- | Username: < | ||
- | Password: ***** | ||
- | </ | ||
- | |||
- | # ' | ||
- | |||
- | ==== Pandora FMS の設定 ==== | ||
- | |||
- | Make sure that **php-pecl-ssh2** is installed according to the OS and version you have installed: | ||
- | |||
- | インストールした OS とバージョンに従って **php-pecl-ssh2** がインストールされていることを確認します。 | ||
- | |||
- | **RHEL 8** | ||
- | < | ||
- | | ||
- | | ||
- | | ||
- | |||
- | </ | ||
- | |||
- | **Rocky Linux 8** | ||
- | < | ||
- | | ||
- | | ||
- | | ||
- | |||
- | </ | ||
- | |||
- | **CentOS 7** | ||
- | < | ||
- | | ||
- | | ||
- | |||
- | </ | ||
- | |||
- | |||
- | There are two parameters in ''/ | ||
- | |||
- | Pandora FMS データベース HA ツールの動作を制御する 2つのパラメータが ''/ | ||
- | |||
- | < | ||
- | # Pandora FMS Database HA Tool execution interval in seconds (PANDORA FMS ENTERPRISE ONLY). | ||
- | ha_interval 30 | ||
- | |||
- | # Pandora FMS Database HA Tool monitoring interval in seconds. Must be a multiple of ha_interval (PANDORA FMS ENTERPRISE ONLY). | ||
- | ha_monitoring_interval 60 | ||
- | |||
- | </ | ||
- | |||
- | Point your Pandora FMS to the master' | ||
- | |||
- | Pandora FMS の DB 参照先をマスターの仮想 IP アドレスにします。(**< | ||
- | |||
- | < | ||
- | pandorafms# export VIRT_IP=< | ||
- | pandorafms# sed -i -e " | ||
- | / | ||
- | pandorafms# sed -i -e " | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | Log in your Pandora FMS Console and go to //Servers > Manage database HA//: | ||
- | |||
- | Pandora FMS コンソールへログインし、// | ||
- | |||
- | {{ : | ||
- | |||
- | Click on **Add new node** and create an entry for the first node: | ||
- | |||
- | **新規ノード追加(Add new node)** をクリックし、1つ目のノードのエントリを作成します。 | ||
- | |||
- | {{ : | ||
- | |||
- | Next, click **Register** and add an entry for the second node. You should see something similar to this: | ||
- | |||
- | 次に、**登録(Register)** をクリックし、2つ目のノードのエントリを追加します。次のような画面が表示されます。 | ||
- | |||
- | {{ : | ||
- | |||
- | <WRAP center round important 60%> '' | ||
- | |||
- | <WRAP center round important 60%> '' | ||
- | データベースのレプリケーションについての詳細は、[[http:// | ||
- | |||
- | ==== スプリットブレーンからの自動復旧 ==== | ||
- | |||
- | **Scenario.** | ||
- | |||
- | **シナリオ** | ||
- | |||
- | Both servers are as main or //master//, in the HA console view both appear as main (Master) but the Virtual IP is only on one node (the one that is actually acting as main or Master). | ||
- | |||
- | 両方のサーバはメインまたは// | ||
- | |||
- | {{ : | ||
- | |||
- | At this point, if the //token// [[: | ||
- | |||
- | この時、// | ||
- | |||
- | For the correct operation of this functionality the following components must be correctly configured:: | ||
- | |||
- | この機能を正しく動作させるには、次のコンポーネントを正しく設定する必要があります。 | ||
- | |||
- | * SSH root user keys shared between the server '' | ||
- | * Replicator user configured in the setup with rights or // | ||
- | |||
- | * '' | ||
- | * '' | ||
- | |||
- | {{ : | ||
- | |||
- | * Space available for database backup on both servers where the 2 databases are hosted (primary and secondary, Master/ | ||
- | |||
- | * 2つのデータベースがある両方のサーバ(プライマリおよびセカンダリ、マスター/ | ||
- | |||
- | <wrap hi>In the case that the '' | ||
- | |||
- | <wrap hi>'' | ||
- | |||
- | If all the above points are correctly configured, **the recovery process is as follows**: | ||
- | |||
- | 上記のすべてのポイントが正しく設定されている場合、**回復処理は次のようになります**: | ||
- | |||
- | - Delete the previous // | ||
- | - Back up the '' | ||
- | - Performs backup of the main node (// | ||
- | - Sends backup of the main node to the secondary node (//Master// -> //Slave)//. | ||
- | - Starts the resource of the " | ||
- | - Checks that the resource is active and correct. For this it will make use of the configuration indicated in the parameters [[: | ||
- | |||
- | - 以前の// | ||
- | - セカンダリノード(// | ||
- | - メインノード(// | ||
- | - メインノードのバックアップをセカンダリノードへ送信 (// | ||
- | - バックアップ時の再同期パラメータを使用して、" | ||
- | - リソースが有効で正しいか確認。これには、[[: | ||
- | |||
- | If at some point in the process it fails, it will repeat it again the times indicated through the parameter [[: | ||
- | |||
- | 処理のある時点で失敗した場合は、パラメータ [[: | ||
- | |||
- | Once the process is finished, an event will appear indicating that the process has been completed successfully in the event view. | ||
- | |||
- | 処理が完了したら、イベント表示に処理が正常に完了したことを示すイベントが表示されます。 | ||
- | |||
- | If the environment is still not recovered automatically, | ||
- | |||
- | それでも環境が自動的にリカバリされない場合は、セカンダリ(スレーブ)ノードがスタンバイのままになり、**イベント表示でリカバリを手動で実行する必要があることを示すイベントが表示されます**。 | ||
- | |||
- | ==== クラスタへの新規ノードの追加 ==== | ||
- | |||
- | <WRAP center round info 60%> | ||
- | |||
- | Repeat the steps performed to install **node1** and **node2**, depending on the version to be used on the new node: | ||
- | |||
- | [[: | ||
- | |||
- | [[: | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round info 60%> | ||
- | 新しいノードで使用するバージョンに応じて、**node1** と **node2** をインストールするために実行した手順を繰り返します。 | ||
- | |||
- | [[: | ||
- | |||
- | [[: | ||
- | </ | ||
- | |||
- | OpenSSH で表示されるバナーを削除します。 | ||
- | |||
- | < | ||
- | node3# [ -f / | ||
- | node3# sed -i -e ' | ||
- | node3# systemctl restart sshd | ||
- | </ | ||
- | |||
- | 新しいホスト用の新しい SSH 認証キーを生成し、公開キーを他の各ホストにコピーします。 | ||
- | |||
- | <WRAP center round important 60%> | ||
- | 非 root ユーザを使用したクラスターインストールでは、非 root ユーザのキーを生成します。 | ||
- | </ | ||
- | |||
- | < | ||
- | node1# ssh-copy-id -p22 root@node3 | ||
- | node1# ssh node3 | ||
- | </ | ||
- | |||
- | < | ||
- | node2# ssh-copy-id -p22 root@node3 | ||
- | node2# ssh node3 | ||
- | </ | ||
- | |||
- | < | ||
- | pandorafms# ssh-copy-id -p22 root@node3 | ||
- | pandorafms# ssh node3 | ||
- | </ | ||
- | |||
- | < | ||
- | node3# echo -e " | ||
- | node3# ssh-copy-id -p22 root@node1 | ||
- | node3# ssh-copy-id -p22 root@node2 | ||
- | node3# ssh node1 | ||
- | node3# ssh node2 | ||
- | </ | ||
- | |||
- | Pandora FMS ノードで、apache ユーザに " | ||
- | |||
- | < | ||
- | |||
- | pandorafms# yes | cp / | ||
- | |||
- | </ | ||
- | |||
- | 次の手順は、ノードが非標準ポートで SSH を実行している場合にのみ必要です。 22 を正しいポート番号に置き換えます。 | ||
- | |||
- | < | ||
- | all# echo -e "Host node1\n | ||
- | all# echo -e "Host node2\n | ||
- | all# echo -e "Host node3\n | ||
- | </ | ||
- | |||
- | 必要なパッケージをインストールします。 | ||
- | |||
- | < | ||
- | node3# yum install -y http:// | ||
- | node3# yum install -y Percona-Server-server-57 percona-xtrabackup-24 | ||
- | </ | ||
- | |||
- | Percona サービスはクラスタによって管理されるため、無効にしてください。 | ||
- | |||
- | < | ||
- | node3# systemctl stop mysqld | ||
- | node3# systemctl disable mysqld | ||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | システムサービスが無効になっていない場合、クラスタのリソースマネージャーは正常に動作しません。 | ||
- | </ | ||
- | |||
- | Percona を設定し、**< | ||
- | |||
- | <WRAP center round important 60%> | ||
- | 2つのノードが同じ **SERVER_ID** を持っていると、レプリケーションが正しく動作しません。 | ||
- | </ | ||
- | |||
- | Once the server is installed, you will find the configuration builder for database replication at the path: | ||
- | |||
- | サーバをインストールしたら、次のパスにデータベースレプリケーション用の設定ビルダーが見つかります。 | ||
- | |||
- | < | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | < | ||
- | Example: ./ | ||
- | Mandatory parameters: | ||
- | -i --serverid Set the server id for the database (Mandatory) | ||
- | Optional parameters: | ||
- | -l --location Set my.cnf custom location including filename. [ default value: /etc/my.cnf ] (optional) | ||
- | -d --database Set the database to be replicated. [ default value: pandora ] (optional) | ||
- | -b --binlog Set binlog file. [ default value: mysql-bin ] (optional) | ||
- | -u --dbuser Set dbuser for mysql connection and backups. [ default value: root ] (optional) | ||
- | -p --dbpass Set dbpassword for mysql connection and backups. [ default value: pandora ] (optional) | ||
- | -s --poolsize Set innodb_buffer_pool_size static size in M (Megabytes) or G (Gigabytes). [ default value: autocalculated ] (optional) | ||
- | -h --help Print help. | ||
- | |||
- | </ | ||
- | |||
- | In the current case where the databases are not on the same server as the application, | ||
- | |||
- | データベースがアプリケーションと同じサーバ上にない現在のケースでは、スクリプトをノードにコピーしてローカルで実行する必要があります。 | ||
- | |||
- | < | ||
- | pandorafms# | ||
- | scp / | ||
- | |||
- | </ | ||
- | |||
- | It will only be necessary to pass the parameter **serverid** (mandatory) in standard environments and some optional parameters for custom environments. | ||
- | |||
- | 標準環境ではパラメータ **serverid** (必須) を渡すだけでよく、カスタム環境ではいくつかのオプションのパラメーターを渡す必要があります。 | ||
- | |||
- | If the default or defined user does not connect to the database, the script will end with a connection error. | ||
- | |||
- | デフォルトまたは定義されたユーザがデータベースに接続できない場合、スクリプトは接続エラーで終了します。 | ||
- | |||
- | You also have the possibility of passing database name, user and password as arguments. Otherwise, the default settings will be used. | ||
- | |||
- | データベース名、ユーザ、およびパスワードを引数として渡すこともできます。 それ以外の場合は、デフォルト設定が使用されます。 | ||
- | |||
- | In this case, it will execute the script on both nodes, only passing the '' | ||
- | |||
- | この場合、両方のノードでスクリプトを実行し、デフォルトの認証情報がある場合は '' | ||
- | |||
- | < | ||
- | node3# | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | Percona サーバを起動します。 | ||
- | |||
- | < | ||
- | node3# systemctl start mysqld | ||
- | |||
- | </ | ||
- | |||
- | 新しい一時パスワードが生成され、/ | ||
- | |||
- | < | ||
- | node3# mysql -uroot -p$(grep " | ||
- | rev | cut -d' ' -f1 | rev) | ||
- | mysql> SET PASSWORD FOR ' | ||
- | mysql> UNINSTALL PLUGIN validate_password; | ||
- | mysql> SET PASSWORD FOR ' | ||
- | mysql> quit | ||
- | </ | ||
- | |||
- | Back up the database of the master node (**node1** in this example) connect to Percona server and type in the name and position of the master log file (in the example '' | ||
- | |||
- | マスターノード(この例では **node1**)のデータベースをバックアップし、マスターログファイルの名前と位置(この例では '' | ||
- | |||
- | < | ||
- | node1# [ -e / | ||
- | node1# innobackupex --no-timestamp / | ||
- | node1# innobackupex --apply-log / | ||
- | node1# cat / | ||
- | mysql-bin.000001 | ||
- | </ | ||
- | |||
- | Load the database on the new node, which we will call **node3** and configure to replicate from **node1** (configure MASTER_LOG_FILE and MASTER_LOG_POS to the values found in the previous step): | ||
- | |||
- | 新規ノード **node3** にデータベースをコピーし、**node1** から複製するように設定します(MASTER_LOG_FILE およびMASTER_LOG_POS を前の手順で見つかった値に設定します)。 | ||
- | |||
- | < | ||
- | node3# systemctl stop mysqld | ||
- | |||
- | node1# rsync -avpP -e ssh / | ||
- | |||
- | node3# chown -R mysql:mysql / | ||
- | node3# chcon -R system_u: | ||
- | node3# systemctl start mysqld | ||
- | node3# mysql -uroot -ppandora | ||
- | mysql> CHANGE MASTER TO MASTER_HOST=' | ||
- | MASTER_USER=' | ||
- | MASTER_LOG_FILE=' | ||
- | mysql> START SLAVE; | ||
- | mysql> SHOW SLAVE STATUS \G | ||
- | | ||
- | Slave_IO_State: | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | Relay_Log_File: | ||
- | | ||
- | | ||
- | Slave_IO_Running: | ||
- | | ||
- | | ||
- | | ||
- | Replicate_Do_Table: | ||
- | Replicate_Ignore_Table: | ||
- | | ||
- | | ||
- | Last_Errno: 0 | ||
- | Last_Error: | ||
- | Skip_Counter: | ||
- | | ||
- | | ||
- | | ||
- | Until_Log_File: | ||
- | | ||
- | Master_SSL_Allowed: | ||
- | Master_SSL_CA_File: | ||
- | Master_SSL_CA_Path: | ||
- | | ||
- | | ||
- | Master_SSL_Key: | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | Last_SQL_Errno: | ||
- | Last_SQL_Error: | ||
- | | ||
- | Master_Server_Id: | ||
- | | ||
- | Master_Info_File: | ||
- | | ||
- | | ||
- | | ||
- | Master_Retry_Count: | ||
- | | ||
- | | ||
- | Last_SQL_Error_Timestamp: | ||
- | Master_SSL_Crl: | ||
- | Master_SSL_Crlpath: | ||
- | Retrieved_Gtid_Set: | ||
- | | ||
- | | ||
- | Replicate_Rewrite_DB: | ||
- | Channel_Name: | ||
- | Master_TLS_Version: | ||
- | 1 row in set (0.00 sec) | ||
- | mysql> QUIT | ||
- | |||
- | node3# systemctl stop mysqld | ||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **Slave_IO_Running** および **Slave_SQL_Running** が **Yes** と表示される必要があります。他の値は例と異なる場合があります。 | ||
- | </ | ||
- | |||
- | 必要なパッケージをインストールします。 | ||
- | |||
- | < | ||
- | node3# yum install -y epel-release corosync ntp pacemaker pcs | ||
- | |||
- | node3# systemctl enable ntpd | ||
- | node3# systemctl enable corosync | ||
- | node3# systemctl enable pcsd | ||
- | |||
- | node3# systemctl start ntpd | ||
- | </ | ||
- | |||
- | 新たなノードをクラスタに追加します。 | ||
- | |||
- | < | ||
- | node3# echo -n hapass | passwd hacluster --stdin | ||
- | node3# cd / | ||
- | node3# mkdir percona | ||
- | node3# cd percona | ||
- | node3# curl -L -o pacemaker_mysql_replication.zip https:// | ||
- | node3# unzip pacemaker_mysql_replication.zip | ||
- | node3# rm -f pacemaker_mysql_replication.zip | ||
- | node3# chmod u+x mysql | ||
- | </ | ||
- | |||
- | < | ||
- | node1# pcs cluster auth -u hacluster -p hapass --force node3 | ||
- | node1# pcs cluster node add --enable --start node3 | ||
- | </ | ||
- | |||
- | '' | ||
- | |||
- | < | ||
- | node3# pcs resource update master_pandoradb meta master-max=" | ||
- | master-node-max=" | ||
- | globally-unique=" | ||
- | </ | ||
- | |||
- | ノードの状態を確認します。 | ||
- | |||
- | < | ||
- | node3# pcs status | ||
- | Cluster name: pandoraha | ||
- | Stack: corosync | ||
- | Current DC: node1 (version 1.1.18-11.el7_5.2-2b07d5c5a9) - partition with quorum | ||
- | Last updated: Fri Jun 1 10:55:47 2018 | ||
- | Last change: Fri Jun 1 10:55:09 2018 by root via crm_attribute on node3 | ||
- | |||
- | 3 nodes configured | ||
- | 3 resources configured | ||
- | |||
- | Online: [ node1 node2 node3 ] | ||
- | |||
- | Full list of resources: | ||
- | |||
- | pandoraip | ||
- | Master/ | ||
- | Masters: [ node1 ] | ||
- | Slaves: [ node2 node3 ] | ||
- | |||
- | Daemon Status: | ||
- | | ||
- | | ||
- | pcsd: active/ | ||
- | </ | ||
- | | ||
- | <WRAP center round important 60%> | ||
- | すべてのノードがオンラインである必要があります('' | ||
- | </ | ||
- | |||
- | " | ||
- | |||
- | ==== 障害ノードの修正 ==== | ||
- | 例として node2 を用います。node2 をスタンバイモードにします。 | ||
- | |||
- | < | ||
- | node2# pcs node standby node2 | ||
- | node2# pcs status | ||
- | Cluster name: pandoraha | ||
- | Stack: corosync | ||
- | Current DC: node1 (version 1.1.18-11.el7_5.2-2b07d5c5a9) - partition with quorum | ||
- | Last updated: Tue Jun 12 08:20:49 2018 | ||
- | Last change: Tue Jun 12 08:20:34 2018 by root via cibadmin on node2 | ||
- | | ||
- | 2 nodes configured | ||
- | 3 resources configured | ||
- | | ||
- | Node node2: standby | ||
- | Online: [ node1 ] | ||
- | | ||
- | Full list of resources: | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | Daemon Status: | ||
- | corosync: active/ | ||
- | pacemaker: active/ | ||
- | pcsd: active/ | ||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | node2 がスタンバイ(**Node node2: standby**)である必要があります。他の値は例とは異なります。 | ||
- | </ | ||
- | |||
- | Percona のデータディレクトリをバックアップします。 | ||
- | |||
- | < | ||
- | node2# systemctl stop mysqld | ||
- | node2# [ -e / | ||
- | node2# mv / | ||
- | </ | ||
- | |||
- | マスターノード(この例では node1 です)のデータベースをバックアップし、マスターのログファイル名とポジションを記録します(この例では mysql-bin.000001 および 785 です)。 | ||
- | |||
- | < | ||
- | node1# [ -e / | ||
- | node1# innobackupex --no-timestamp / | ||
- | node1# innobackupex --apply-log / | ||
- | node1# binlog_info=$(cat / | ||
- | node1# crm_attribute --type crm_config --name pandoradb_REPL_INFO -s mysql_replication \ | ||
- | -v " | ||
- | </ | ||
- | |||
- | 障害が発生したノードへデータベースをコピーします。 | ||
- | |||
- | < | ||
- | node1# rsync -avpP -e ssh / | ||
- | |||
- | node2# chown -R mysql:mysql / | ||
- | node2# chcon -R system_u: | ||
- | </ | ||
- | |||
- | node2 のスタンバイモードを無効化します。 | ||
- | |||
- | < | ||
- | node2# pcs node unstandby node2 | ||
- | node2# pcs resource cleanup --node node2 | ||
- | </ | ||
- | |||
- | クラスタの状態を確認します。 | ||
- | |||
- | < | ||
- | node2# pcs status | ||
- | Cluster name: pandoraha | ||
- | Stack: corosync | ||
- | Current DC: node1 (version 1.1.18-11.el7_5.2-2b07d5c5a9) - partition with quorum | ||
- | Last updated: Fri Jun 1 10:55:47 2018 | ||
- | Last change: Fri Jun 1 10:55:09 2018 by root via crm_attribute on node3 | ||
- | |||
- | 2 nodes configured | ||
- | 3 resources configured | ||
- | |||
- | Online: [ node1 node2 ] | ||
- | |||
- | Full list of resources: | ||
- | |||
- | pandoraip | ||
- | Master/ | ||
- | Masters: [ node1 ] | ||
- | Slaves: [ node2 ] | ||
- | |||
- | Daemon Status: | ||
- | | ||
- | | ||
- | pcsd: active/ | ||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | 双方のノードがオンライン(**Online: | ||
- | </ | ||
- | |||
- | データベースのレプリケーション状態を確認します。 | ||
- | |||
- | < | ||
- | node2# mysql -uroot -ppandora | ||
- | | ||
- | | ||
- | Slave_IO_State: | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | Relay_Log_File: | ||
- | | ||
- | | ||
- | Slave_IO_Running: | ||
- | | ||
- | | ||
- | | ||
- | Replicate_Do_Table: | ||
- | Replicate_Ignore_Table: | ||
- | | ||
- | | ||
- | Last_Errno: 0 | ||
- | Last_Error: | ||
- | Skip_Counter: | ||
- | | ||
- | | ||
- | | ||
- | Until_Log_File: | ||
- | | ||
- | Master_SSL_Allowed: | ||
- | Master_SSL_CA_File: | ||
- | Master_SSL_CA_Path: | ||
- | | ||
- | | ||
- | Master_SSL_Key: | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | Last_SQL_Errno: | ||
- | Last_SQL_Error: | ||
- | | ||
- | Master_Server_Id: | ||
- | | ||
- | Master_Info_File: | ||
- | | ||
- | | ||
- | | ||
- | Master_Retry_Count: | ||
- | | ||
- | | ||
- | Last_SQL_Error_Timestamp: | ||
- | Master_SSL_Crl: | ||
- | Master_SSL_Crlpath: | ||
- | Retrieved_Gtid_Set: | ||
- | | ||
- | | ||
- | Replicate_Rewrite_DB: | ||
- | Channel_Name: | ||
- | Master_TLS_Version: | ||
- | 1 row in set (0.00 sec) | ||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **Slave_IO_Running** および **Slave_SQL_Running** が **Yes** であることを確認します。他の値は例とは異なります。 | ||
- | </ | ||
- | |||
- | |||
- | ==== トラブルシューティング ==== | ||
- | === クラスタノードの一つが動作していない場合に何をすれば良いでしょうか? | ||
- | {{ wiki: | ||
- | |||
- | マスターノードが動作している限り、サービスには影響がありません。もしマスターノードで障害が発生した場合は、スレーブが自動的にマスターに昇格します。詳細は、 [[ja: | ||
- | |||
- | |||
- | |||
- | ===== (OBSOLETE) HA のサイジングとアーキテクチャ設計 ===== | ||
- | |||
- | ==== サイジング ==== | ||
- | ニーズに依存します: | ||
- | |||
- | 1. スタンドアローン(高可用性なし)で、最大 2500エージェント / 50000 モジュール、監視間隔 5分、一様なデータ、ヒストリデータベースなし | ||
- | |||
- | < | ||
- | サーバ数: | ||
- | |||
- | メイン: | ||
- | ---------- | ||
- | CPU: 6 cores | ||
- | RAM: 8 GB | ||
- | Disk: 100GB | ||
- | </ | ||
- | |||
- | {{ wiki: | ||
- | |||
- | 2. スタンドアローン(高可用性なし)で、最大 2500エージェント / 50000 モジュール、監視間隔 5分、一様なデータ、ヒストリデータベースあり | ||
- | |||
- | < | ||
- | サーバ数: | ||
- | |||
- | メイン: | ||
- | ---------- | ||
- | CPU: 6 cores | ||
- | RAM: 8 GB | ||
- | Disk: 100GB | ||
- | |||
- | ヒストリDB: | ||
- | ---------- | ||
- | CPU: 2 cores | ||
- | RAM: 4 GB | ||
- | Disk: 200GB | ||
- | </ | ||
- | |||
- | {{ wiki: | ||
- | |||
- | 3. スタンドアローン(高可用性無し)で、最大 5000エージェント / 100000 モジュール、監視間隔 5分、一様なデータ、ヒストリデータベースあり(1年保存) | ||
- | |||
- | < | ||
- | サーバ台数: | ||
- | |||
- | サーバ + コンソール: | ||
- | ------------------- | ||
- | CPU: 6 cores | ||
- | RAM: 8 GB | ||
- | Disk: 40GB | ||
- | |||
- | メイン DB: | ||
- | ------------------------ | ||
- | CPU: 4 cores | ||
- | RAM: 8 GB | ||
- | Disk: 100GB | ||
- | |||
- | ヒストリ DB: | ||
- | ---------- | ||
- | CPU: 2 cores | ||
- | RAM: 4 GB | ||
- | Disk: 200GB | ||
- | </ | ||
- | |||
- | {{ wiki: | ||
- | |||
- | ==== HA のアーキテクチャ設計 ==== | ||
- | 1. データベースがシンプルな HA 構成、最大 7500エージェント / 125000 モジュール、監視間隔 5分、一様なデータ、ヒストリデータベースあり(1年保存) | ||
- | |||
- | < | ||
- | サーバ数: | ||
- | |||
- | | ||
- | | ||
- | CPU: 6 cores | ||
- | RAM: 8 GB | ||
- | Disk: 40GB | ||
- | |||
- | | ||
- | | ||
- | CPU: 6 cores | ||
- | RAM: 8 GB | ||
- | Disk: 100GB | ||
- | |||
- | | ||
- | | ||
- | CPU: 6 cores | ||
- | RAM: 8 GB | ||
- | Disk: 100GB | ||
- | |||
- | | ||
- | | ||
- | CPU: 2 cores | ||
- | RAM: 4 GB | ||
- | Disk: 300GB | ||
- | </ | ||
- | |||
- | {{ wiki: | ||
- | |||
- | 2. データベースが完全な HA 構成(3台構成)、最大 7500エージェント / 125000 モジュール、監視間隔 5分、一様なデータ、ヒストリデータベースあり(1年保存) | ||
- | |||
- | < | ||
- | サーバ数: | ||
- | |||
- | サーバ + コンソール: | ||
- | ------------------ | ||
- | CPU: 6 cores | ||
- | RAM: 8 GB | ||
- | Disk: 40GB | ||
- | |||
- | データベースノード 1: | ||
- | --------------------- | ||
- | CPU: 6 cores | ||
- | RAM: 8 GB | ||
- | Disk: 100GB | ||
- | |||
- | データベースノード 2: | ||
- | --------------------- | ||
- | CPU: 6 cores | ||
- | RAM: 8 GB | ||
- | Disk: 100GB | ||
- | |||
- | データベースノード 3: | ||
- | --------------------- | ||
- | CPU: 6 cores | ||
- | RAM: 8 GB | ||
- | Disk: 100GB | ||
- | |||
- | ヒストリ DB: | ||
- | ---------- | ||
- | CPU: 2 cores | ||
- | RAM: 4 GB | ||
- | Disk: 200GB | ||
- | </ | ||
- | |||
- | {{ wiki: | ||
- | |||
- | 3. データベースがシンプルな HA 構成、Pandora FMS が負荷分散 HA で、最大 7500エージェント / 125000 モジュール、監視間隔 5分、一様なデータ、ヒストリデータベースあり(1年保存) | ||
- | |||
- | < | ||
- | サーバ数: | ||
- | |||
- | サーバ + コンソール ノード1: | ||
- | ------------------- | ||
- | CPU: 6 cores | ||
- | RAM: 8 GB | ||
- | Disk: 40GB | ||
- | |||
- | サーバ + コンソール ノード2: | ||
- | ------------------- | ||
- | CPU: 6 cores | ||
- | RAM: 8 GB | ||
- | Disk: 40GB | ||
- | |||
- | データベースノード 1: | ||
- | --------------------- | ||
- | CPU: 6 cores | ||
- | RAM: 8 GB | ||
- | Disk: 100GB | ||
- | |||
- | データベースノード 2: | ||
- | --------------------- | ||
- | CPU: 6 cores | ||
- | RAM: 8 GB | ||
- | Disk: 100GB | ||
- | |||
- | ヒストリ DB: | ||
- | ---------- | ||
- | CPU: 2 cores | ||
- | RAM: 4 GB | ||
- | Disk: 200GB | ||
- | </ | ||
- | |||
- | {{ wiki: | ||
- | |||
- | 4. サーバが基本的な負荷分散 HA、マスター・スレーブのデータベース、最大 4000エージェント / 90000 モジュール、監視間隔 5分、一様なデータ、ヒストリデータベースあり(1年保存) | ||
- | |||
- | < | ||
- | サーバ数: | ||
- | |||
- | メイン: (コンソール + サーバ + データベース ノード 1) | ||
- | ---------- | ||
- | CPU: 8 cores | ||
- | RAM: 12 GB | ||
- | Disk: 100GB | ||
- | |||
- | セカンダリ: | ||
- | ---------- | ||
- | CPU: 8 cores | ||
- | RAM: 12 GB | ||
- | Disk: 100GB | ||
- | |||
- | ヒストリ DB: | ||
- | ---------- | ||
- | CPU: 2 cores | ||
- | RAM: 4 GB | ||
- | Disk: 200GB | ||
- | </ | ||
- | |||
- | このスキーマでは、Pandroa FMS データベースのノードは、2台それぞれのサーバで(マスター・スレーブ構成で)設定します。 | ||
- | |||
- | {{ wiki: | ||
- | |||
- | <WRAP center round tip 60%>** **For large environments, | ||
- | |||
- | <WRAP center round tip 60%> | ||
- | |||
- | ==== 例 ==== | ||
- | 30,000 エージェント、500, | ||
- | |||
- | HA #1 の設計を選択した場合(1 サーバ + コンソール, | ||
- | |||
- | 全体の環境を管理するには、全体を一元管理できるメタコンソールのインストールが必要です。 | ||
- | |||
- | メタコンソールに必要なリソースは以下の通りです。 | ||
- | |||
- | < | ||
- | サーバ数: | ||
- | |||
- | メイン: | ||
- | ---------- | ||
- | CPU: 8 cores | ||
- | RAM: 12 GB | ||
- | Disk: 100GB | ||
- | </ | ||
- | |||
- | ヒストリ DB を個別に用意した場合のサーバトータル数: | ||
- | |||
- | ヒストリ DB を集約した場合のサーバトータル数: | ||
- | |||
- | <WRAP center round tip 60%> To combine all the historical databases (4) in a single team, resize their characteristics to take on the extra load: </ | ||
- | |||
- | <WRAP center round tip 60%> 全ヒストリ DB (4台) を一つのサーバに集約するには、負荷を考慮してサイズを変更する必要があります。</ | ||
- | |||
- | < | ||
- | 集約したヒストリ DB: | ||
- | -------------------- | ||
- | CPU: 8 cores | ||
- | RAM: 12 GB | ||
- | Disk: 1200GB | ||
- | </ | ||