[pgpool-general-jp: 1687] Re: パラメータステータスの取り扱いの変更について

Shingo Kiyoura kiyoura @ passlogy.com
2022年 3月 2日 (水) 18:10:02 JST


石井様

お世話になっております。清浦です。

実行環境、手順について展開させていただきます。

- PostgreSQL, Pgpool-II を同じ VM 上で起動
  - pgpool-II-4.2.8
  - postgresql-13.4
  - 評価中なので backend 1つで、backend_clustering_mode = 'native_replication'

1) postgresql-13.4 の psql コマンドで、pgpool に接続, なにかクエリを実行
  - 同じVM の上で、psql コマンドを実行、9915 で bind している pgpool に接続

$ /build_dir/pgsql/bin/psql -h localhost -p 9915 -U superuser template1
template1=# pgpool show all;

2) Ctrl-D で psql コマンドを終了すると、pgpool の stderr に以下が出ます:

2022-03-02 17:39:20: pid 4915: LOG:  ParameterStatus message from backend: 0
2022-03-02 17:39:20: pid 4915: DETAIL:  parameter name: "is_superuser" value: "on"
2022-03-02 17:39:20: pid 4915: LOG:  ParameterStatus message from backend: 0
2022-03-02 17:39:20: pid 4915: DETAIL:  parameter name: "session_authorization" value: "superuser"

*1 role や DB を他に作っても superuser /template1 と同様にログされました。
*2 backend の PostgreSQL をソースからビルドものから、下記のコンテナ(postgres:12.6)に切り替えて、
   postgresql-13.4 の psql コマンドで接続しても、同様に切断時に pgpool のログが出ました。

   $ podman pull postgres:12.6
   $ podman network create aws --subnet 172.30.0.0/24
   $ mkdir /opt/podman/pgsql
   $ podman run -d --name pgsql --network aws --ip 172.30.0.2 -e POSTGRES_USER=superuser -e PGPORT=5439 -e POSTGRES_PASSWORD=password -v /opt/podman/pgsql:/var/lib/postgresql/data postgres:12.6

以下に詳細を記載いたします。足りない情報等ございましたら、お知らせください。

== pgpool.conf ==

- 4.2.8 同梱の pgpool-II-4.2.8/src/sample/pgpool.conf.sample との差分は
以下となります:

```
[root @ localhost etc]# diff pgpool.conf.sample pgpool.conf
27c27
< backend_clustering_mode = 'streaming_replication'
---
> backend_clustering_mode = 'native_replication'
35c35
< listen_addresses = 'localhost'
---
> listen_addresses = '127.0.0.1'
39c39
< port = 9999
---
> port = 9915
59c59
< pcp_port = 9898
---
> pcp_port = 9925
77c77,78
< backend_hostname0 = 'host1'
---
> backend_hostname0 = '127.0.0.1'
> #backend_hostname0 = '172.30.0.2'
79c80
< backend_port0 = 5432
---
> backend_port0 = 5439
171c172
< child_max_connections = 0
---
> child_max_connections = 100
295c296
< pid_file_name = '/var/run/pgpool/pgpool.pid'
---
> pid_file_name = '/opt/xxxx/pgpool/pgpool.pid'
332c333
< insert_lock = off
---
> insert_lock = on
363c364
< load_balance_mode = on
---
> load_balance_mode = off
372c373
< write_function_list = ''
---
> write_function_list = 'nextval,setval'
464c465
< delay_threshold = 10000000
---
> delay_threshold = 0
534c535
< failover_command = ''
---
> failover_command = '/opt/xxxx/pgsql/data/failover.sh %h %H'
717c718
< failover_when_quorum_exists = on
---
> failover_when_quorum_exists = off
722c723
< failover_require_consensus = on
---
> failover_require_consensus = off
```

== 環境詳細 ==
=== OS ===
[root @ localhost ~]# cat /etc/redhat-release 
Rocky Linux release 8.5 (Green Obsidian)

=== pgsql, pgpool ビルド ===

1) postgresql-13.4.tar.gz
2) pgpool-II-4.2.8.tar.gz

1), 2) をソースからビルド (makefile の抜粋)

- pgsql
	cd ${BUILD}/src/
	tar zxf postgresql-${POSTGRES_VER}.tar.gz
	cd postgresql-${POSTGRES_VER}/
	./configure --prefix=${BUILD}/pgsql/
	$(MAKE) -C ${BUILD}/src/postgresql-${POSTGRES_VER} MAKELEVEL=0 all
	$(MAKE) -C ${BUILD}/src/postgresql-${POSTGRES_VER} install

- pgpool
	cd ${BUILD}/src/
	tar zxf pgpool-II-${PGPOOL_VER}.tar.gz
	cd pgpool-II-$(PGPOOL_VER)
	./configure --prefix=${BUILD}/pgpool --with-pgsql=${BUILD}/pgsql
	$(MAKE) -C ${BUILD}/src/pgpool-II-$(PGPOOL_VER)
	$(MAKE) -C ${BUILD}/src/pgpool-II-$(PGPOOL_VER) install

以上よろしくお願いいたします。

清浦


pgpool-general-jp メーリングリストの案内