Failover Manager with client connect failover¶
PostgreSQL接続ライブラリのほとんどは、クライアント接続のフェイルオーバーをサポートしています。これらのライブラリは、複数のデータベースサーバーとの接続文字列をサポートします。最初の接続試行時または接続が失われた場合(フェイルオーバー中にも発生します)、クライアントドライバーは、読み取り/書き込み接続が見つかるまで、指定されたホストに1つずつ接続します。新しいマスターに再接続する時間は、ドライバーとTCPレイヤーで構成された接続タイムアウトによって異なります。
Failover Manager traffic routing diagram for client connect failover¶
図2:クライアント接続フェールオーバーを使用したフェールオーバーマネージャーのトラフィックルーティング
クライアント接続フェールオーバーでのフェールオーバーマネージャーの使用¶
インストール¶
次のように、 Advanced ServerとFailover Managerを3つのサーバーにインストールして構成します。
Systems |
Components |
|---|---|
PG Primary, PG Standby1, and PG Standby2 |
Primary or standby nodes running Advanced Server 13 and Failover Manager 4.2 |
efm.properties (virtual.ip 、virtual.ip.interface
、virtual.ip.prefix 、およびvirtual.ip.single
)で仮想IP構成を構成する必要はありません。
クライアント接続フェイルオーバーの構成¶
Driver |
Client Connection failover support |
Version supported |
Configuration |
|---|---|---|---|
JDBC |
Yes |
All supported versions |
Supply multiple hosts in the connection string and set the targetServerType attribute as primary. Example: jdbc:postgresql://host1:5444,host2:5444/accounting?targetServerType=primary. More information: https://jdbc.postgresql.org/documentation/head/connect.html#connection-failover |
libpq |
Yes |
10 and above |
Supply multiple hosts in the connection string and set the target_session_attrs attribute as read-write. Example: postgresql://host1:5444,host2:5444/edb?target_session_attrs=read-write. More information: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING |
.NET |
Yes |
6 and above |
Supply multiple hosts in the connection string and set the Target Session Attributes attribute as primary. Example: Host=host1,host2;Username=test;Password=test;Target Session Attributes=primary. More information: https://www.npgsql.org/doc/failover-and-load-balancing.html |
OCL |
Yes |
10 and above |
OCL is based on libpq hence check libpq for details. |
ODBC |
No |