[pgpool-general: 6313] Re: load_balance_node column value keeps switching in "show pool_nodes" output

Bo Peng pengbo at sraoss.co.jp
Tue Nov 27 16:25:29 JST 2018


Hi,

On Tue, 27 Nov 2018 12:00:42 +0800
Mike Yeap <wkk1020 at gmail.com> wrote:

> Hello! I noticed the value in the load_balance_node column keeps switching
> between "true" and "false" for both nodes, even there's no change in the
> Postgres's availability.
> 
> Is it indicating any configuration problems?

No. It's normal.

"load_balance_node" means the node which is selected for load balancing.
When a session starts, Pgpool-II will select one node as load_balance_node.

At the next session, the load_balance_node may be changed.

You can control the probability of being selected as load_balance_node 
by setting backend_weight.

> # pgpool.conf
> backend_hostname0 = 'hoopa-uat-1.sg.m-daq.net'
> backend_port0 = 5432
> backend_weight0 = 1
> backend_data_directory0 = '/var/lib/pgsql/11/data'
> backend_flag0 = 'ALWAYS_MASTER'
> 
> backend_hostname1 = 'hoopa-uat-2.sg.m-daq.net'
> backend_port1 = 5432
> backend_weight1 = 1
> backend_data_directory1 = '/var/lib/pgsql/11/data'
> backend_flag1 = 'ALLOW_TO_FAILOVER'
> 
> # output for "show pool_nodes"
> [postgres at hoopa-uat-1 data]$ psql -h hoopa-uat-pgpool-1.sg.m-daq.net -p
> 5432 -U postgres -c "show pool_nodes" postgres
> show pool_nodes
>  node_id |         hostname         | port | status | lb_weight |  role   |
> select_cnt | load_balance_node | replication_delay | last_status_change
> ---------+--------------------------+------+--------+-----------+---------+------------+-------------------+-------------------+---------------------
>  0       | hoopa-uat-1.sg.m-daq.net | 5432 | up     | 0.500000  | primary |
> 48         | true              | 0                 | 2018-11-27 11:54:06
>  1       | hoopa-uat-2.sg.m-daq.net | 5432 | up     | 0.500000  | standby |
> 51         | false             | 0                 | 2018-11-27 11:54:06
> (2 rows)
> 
> [postgres at hoopa-uat-1 data]$ psql -h hoopa-uat-pgpool-1.sg.m-daq.net -p
> 5432 -U postgres -c "show pool_nodes" postgres
> show pool_nodes
>  node_id |         hostname         | port | status | lb_weight |  role   |
> select_cnt | load_balance_node | replication_delay | last_status_change
> ---------+--------------------------+------+--------+-----------+---------+------------+-------------------+-------------------+---------------------
>  0       | hoopa-uat-1.sg.m-daq.net | 5432 | up     | 0.500000  | primary |
> 48         | false             | 0                 | 2018-11-27 11:54:06
>  1       | hoopa-uat-2.sg.m-daq.net | 5432 | up     | 0.500000  | standby |
> 51         | true              | 0                 | 2018-11-27 11:54:06
> (2 rows)
> 
> 
> Thank you.
> 
> Regards,
> Mike Yeap


-- 
Bo Peng <pengbo at sraoss.co.jp>
SRA OSS, Inc. Japan



More information about the pgpool-general mailing list