このドキュメントでは、AlloyDB Omni に Active Directory を統合する際に発生する可能性のあるエラーについて説明します。エラーの例と推奨される修正方法も記載しています。
Active Directory が機能しない
説明
pg_hba.conf
のエントリに誤りがあるため、AlloyDB Omni で Active Directory が機能していません。pg_hba.conf
ファイルに追加したエントリが有効でない場合、AlloyDB for PostgreSQL はこれらのエントリを無視します。そのため、指定された認証メカニズムが機能しません。
推奨の解決方法
問題の解決方法に関する情報を含むエラー メッセージを表示するには、psql
にログインして次のコマンドを実行します。
docker exec -it alloydb_docs psql -h localhost -U postgres
psql (16.3)
Type "help" for help.
postgres=# table pg_hba_file_rules ;
rule_number | file_name | line_number | type | database | user_name | address | netmask | auth_method | options | error
-------------+--------------------------------------+-------------+---------+----------+--------------------+-----------+-----------------------------------------+-------------+--------------------------+-----------------------------------------------------
1 | /var/lib/postgresql/data/pg_hba.conf | 1 | host | {all} | {alloydbadmin} | 127.0.0.1 | 255.255.255.255 | trust | |
| /var/lib/postgresql/data/pg_hba.conf | 2 | hostssl | {all} | {alloydbadmin} | ::1 | ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff | trust | | hostssl record cannot match because SSL is disabled
| /var/lib/postgresql/data/pg_hba.conf | 3 | hostssl | {all} | {alloydbpgbouncer} | 0.0.0.0 | 0.0.0.0 | cert | {clientcert=verify-full} | hostssl record cannot match because SSL is disabled
| /var/lib/postgresql/data/pg_hba.conf | 4 | hostssl | {all} | {alloydbpgbouncer} | ::1 | ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff | cert | {clientcert=verify-full} | hostssl record cannot match because SSL is disabled
| /var/lib/postgresql/data/pg_hba.conf | 5 | hostssl | {all} | {alloydbadmin} | all | | reject | | hostssl record cannot match because SSL is disabled
| /var/lib/postgresql/data/pg_hba.conf | 6 | | | | | | | | invalid CIDR mask in address "0.0.0.0/1000"
2 | /var/lib/postgresql/data/pg_hba.conf | 7 | local | {all} | {all} | | | trust | |
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL: role "user2" does not exist
説明
このエラーは、接続しようとしているシステム ユーザーに PostgreSQL ユーザーが作成されていないか、ロールがマッピングされていない場合に発生します。
推奨の解決方法
必要なユーザー名を使用して PostgreSQL にロールを作成するか、このユーザーのエントリを pg_ident.conf
ファイルに追加します。
psql (16.3)
Type "help" for help.
postgres=# CREATE ROLE user2 WITH LOGIN;
CREATE ROLE
Server restart fails with error: "could not load /var/lib/postgresql/data/pg_hba.conf""
説明
pg_hba.conf
に無効なエントリが含まれているため、サーバーの再起動に失敗しました。
推奨の解決方法
pg_hba.conf
ファイルに無効なエントリがないか確認します。