【PostgreSQL】レプリケーションの同期/非同期の確認【備忘録】

Linux
スポンサーリンク

備忘録です。

 

スポンサーリンク

あらまし

社内で利用しているPostgresDBのレプリケーションのタイプを確認したかった。

構築したのは私。

あれ?

 

確認方法

pgsqlにログイン

psql -h [マスタDBのホスト(IPアドレス)] -U root -d [DB名]
postgres=#

パスワードは任意のものでログインします。

 

確認

postgres=# SELECT * FROM pg_stat_replication;
  pid   | usesysid | usename  | application_name | client_addr  | client_hostname | client_port |         backend_start         | backend_xmin |   state   | sent_location |pid   | usesysid | usename  | application_name | client_addr  | client_hostname | client_port |         backend_start         | backend_xmin |   state   | sent_location | write_location | flush_location | replay_location | sync_priority | sync_state
--------+----------+----------+------------------+--------------+-----------------+-------------+-------------------------------+--------------+-----------+---------------+----------------+----------------+-----------------+---------------+------------
10844 | 10 | postgres | walreceiver | *... | | 44605 | 2018-07-10 00:58:09.095771+09 | | streaming | 246/89D1EEE8 | 246/89D1EEE8 | 246/89D1EEE8 | 246/89D1D260 | 0 | async
124913 | 10 | postgres | walreceiver | *... | | 52250 | 2018-09-10 06:52:51.415914+09 | | streaming | 246/89D1EEE8 | 246/89D1EEE8 | 246/89D1EEE8 | 246/89D1D260 | 0 | async
21173 | 10 | postgres | walreceiver | *... | | 49965 | 2018-07-10 01:02:28.046731+09 | | streaming | 246/89D1EEE8 | 246/89D1EEE8 | 246/89D1EEE8 | 246/89D1D260 | 0 | async
6697 | 10 | postgres | walreceiver | *... | | 46304 | 2018-07-10 00:52:54.502609+09 | | streaming | 246/89D1EEE8 | 246/89D1EEE8 | 246/89D1EEE8 | 246/89D1D260 | 0 | async
25070 | 10 | postgres | walreceiver | *... | | 33869 | 2018-07-10 01:03:41.721403+09 | | streaming | 246/89D1EEE8 | 246/89D1EEE8 | 246/89D1EEE8 | 246/89D1D260 | 0 | async
14895 | 10 | postgres | walreceiver | *... | | 57380 | 2018-07-10 01:01:16.803584+09 | | streaming | 246/89D1EEE8 | 246/89D1EEE8 | 246/89D1EEE8 | 246/89D1D260 | 0 | async
10242 | 10 | postgres | walreceiver | *... | | 43578 | 2018-07-10 00:56:19.785311+09 | | streaming | 246/89D1EEE8 | 246/89D1EEE8 | 246/89D1EEE8 | 246/89D1D260 | 0 | async write_location | flush_location | replay_location | sync_priority | sync_state

注目すべきは[sync_state]です。

ここの値が「sync」になっていたら同期、「async」になっていたら非同期となります。

また、[state]が「streaming」になっていたらレプリケーションできている状態となります。

 

おわり

 

[itemlink post_id=”1350″]

 

 

Youtubeチャンネル作成しました!

主にFPSゲームのプレイ動画を投稿しております
良ければ登録よろしくお願いいたします
Linux
スポンサーリンク
vatchをフォローする
ばちブロ

コメント

タイトルとURLをコピーしました