[pgpool-general: 8502] Re: load balancing

j.emerlik j.emerlik at gmail.com
Tue Nov 22 17:51:50 JST 2022


wt., 22 lis 2022, 03:28 użytkownik Tatsuo Ishii <ishii at sraoss.co.jp>
napisał:

> > Hi,
> >
> > is possible to send the selected queries directly to specific slave node
> ?
> >
> > For example, if we have a master and two slaves (slave01 and slave02)  I
> > would like direct one SELECT to slave slave02.
> > OR if we have a master and one slave (slave01)  I would like direct one
> > SELECT to slave not to master and others select should be load balanced
> to
> > master and slave.
>
> If the SELECT can only be issued in a particular session, you can use
> app_name_redirect_preference_list for the purpose.
>
> Set following to pgppol.conf and restart or reload pgpool.
>
> app_name_redirect_preference_list = 'foo:1'
>
> Here, 'foo' is an application name you want to use. '1' means
> PostgreSQL node number. We suppose that node 0 is primary and 1 is
> slave.
>
> Start psql with the application name 'foo' and connect to pgpool.
>
> PGAPPNAME=foo psql test
>
> Issue a read only SELECT query you want to send to PostgreSQL node 1.
>
> SELECT 1;
>
> The SELECT should be forwarded to node 1.
>
> Note that all read only SELECTs in the session will be forwarded to
> node 1. If you want to forward SELECT to other than node 1, you need to
> disconnect to pgpool and connect again. For example if you want to forward
> a SELECT to node 2, you can set:
>
> app_name_redirect_preference_list = 'foo:1,bar:2'
>
> and start psql:
>
> PGAPPNAME=bar psql test
>
> See manual for mode details.
>
>
> https://www.pgpool.net/docs/latest/en/html/runtime-config-load-balancing.html#RUNTIME-CONFIG-LOAD-BALANCING-SETTINGS
>
> Best reagards,
> --
> Tatsuo Ishii
> SRA OSS LLC
> English: http://www.sraoss.co.jp/index_en/
> Japanese:http://www.sraoss.co.jp


There is no other way ?

I have only one application name and I would like to route a selected query
to a selected node, not all queries using application name.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pgpool.net/pipermail/pgpool-general/attachments/20221122/fa030d9e/attachment.htm>


More information about the pgpool-general mailing list