前提条件¶
Failover Managerを構成する前にクラスタの場合、以下で説明する前提条件を満たす必要があります。
Java1.8(以降)をインストールします
Failover Managerを使用する前に、最初にJava(バージョン1.8以降)をインストールする必要があります。Failover ManagerOpenJDKでテストされています。そのバージョンのJavaをインストールすることを強くお勧めします。`Java<https://openjdk.java.net/install/>`__のインストール手順はプラットフォーム固有です。
SMTPサーバーを提供する
Failover Managerから通知を受け取ることができますユーザー定義の通知スクリプト、電子メール、またはその両方で指定されたとおり。
電子メール通知を使用している場合、SMTPサーバーはFailover Managerの各ノードで実行されている必要がありますシナリオ。
script.notificationプロパティに値を指定する場合、user.emailフィールドを空白のままにできます。SMTPサーバーは必要ありません。
イベントが発生した場合、Failover Managerスクリプト(提供されている場合)を呼び出し、クラスタープロパティファイルのuser.emailパラメーターで指定された任意の電子メールアドレスに通知電子メールを送信します。SMTPサーバーの使用の詳細については、次のWebサイトをご覧ください。
ストリーミングレプリケーションの構成
Failover ManagerPostgreSQLストリーミングレプリケーションをプライマリノードとスタンバイノード間で構成する必要があります。Failover Manager他のタイプのレプリケーションはサポートしていません。
On database versions 11 (or prior), unless specified with the -sourcenode option, a recovery.conf file is
copied from a random standby node to the stopped primary during switchover. You should ensure that the paths within the recovery.conf file on your standby nodes are consistent before performing a switchover. For more information about the -sourcenode option, please see Promoting a Failover Manager Node.
データベースバージョン12では、スイッチオーバー中に primary_conninfo および restore_command プロパティが停止したプライマリにコピーされます( -sourcenode オプションで指定されていない限り)。
pg_hba.confファイルを変更します
プライマリノードとスタンバイノードの pg_hba.conf ファイルを変更して、クラスター内のすべてのノード間の通信を許可するエントリを追加する必要があります。次の例は、プライマリノード上のpg_hba.confファイルに作成される可能性のあるエントリを示しています。
# access for itself
host fmdb efm 127.0.0.1/32 md5
# access for standby
host fmdb efm 192.168.27.1/32 md5
# access for witness
host fmdb efm 192.168.27.34/32 md5
どこで:
efmは、有効なデータベースユーザーの名前を指定します。
fmdbはefmユーザーが接続できるデータベースの名前を指定します。
By default, the pg_hba.conf file resides in the data directory, under
your Postgres installation. After modifying the pg_hba.conf file, you
must reload the configuration file on each node for the changes to take
effect. You can use the following command:
# systemctl reload edb-as-x
ここで、 x はPostgresバージョンを指定します。
データベースサーバーの自動起動の使用
If a Primary node reboots, Failover Manager may detect the database is down on the Primary node and promote a Standby node to the role of Primary. If this happens, the Failover Manager agent on the (rebooted) Primary node will not get a chance to write the recovery.conf file; the recovery.conf file prevents the database server from starting. If this happens, the rebooted Primary node will return to the cluster as a second Primary node.
これを防ぐには、Failover Managerを開始しますデータベースサーバーを起動する前のエージェント。エージェントはアイドルモードで起動し、クラスターに既にプライマリがあるかどうかを確認します。プライマリノードがある場合、エージェントは recovery.conf または standby.signal ファイルが存在することを確認し、データベースは2番目のプライマリとして起動しません。
ファイアウォールを介した通信を保証
Linuxファイアウォール(つまり、iptables)がフェールオーバーマネージャーノードのホストで有効になっている場合、Failover Manager間のTCP通信を許可するルールをファイアウォール構成に追加する必要があります。クラスター内のプロセス。例:
# iptables -I INPUT -p tcp --dport 7800:7810 -j ACCEPT
/sbin/service iptables save
上記のコマンドは、狭い範囲のポート(7800〜7810)を開きます。Failover Managerクラスタプロパティファイルで指定されたポートに対応するポートを介して接続します。
データベースユーザーに十分な権限があることを確認してください
efm.properties ファイルの db.user プロパティで指定されたデータベースユーザーは、Failover Managerに代わって次の関数を呼び出すのに十分な権限を持っている必要があります。
pg_current_wal_lsn()
pg_last_wal_replay_lsn()
pg_wal_replay_resume()
pg_wal_replay_pause()
pg_reload_conf()
pg_reload_conf() 特権は、 reconfigure.num.sync または reconfigure.sync.primary プロパティが true に設定されている場合にのみ必要です。
これらの各関数の詳細については、`PostgreSQLコアドキュメント<https://www.postgresql.org/docs/10/static/index.html>`_を参照してください。
ユーザーには、構成変数の値を読み取る権限も必要です。データベースのスーパーユーザーは、PostgreSQLの GRANT コマンドを使用して、必要な権限を提供できます。
GRANT pg_read_all_settings TO user_name;
pg_read_all_settings の詳細については、`PostgreSQLコアドキュメント<https://www.postgresql.org/docs/current/default-roles.html>`_を参照してください。