[pgpool-general: 6112] Re: How can I send a query to any replication node?

Bo Peng pengbo at sraoss.co.jp
Sat Jun 2 17:46:06 JST 2018


Hi,

> > There is the comment /*NO LOAD BALANCE*/ to sent a query to the primary
> > node... is there a similar way to send the query to a replication node.
> 
> You mean master_slave_mode using PostgreSQL streaming replication?
> It can not be configure for particular standby node.

Last time I said  it can not be configure for sending particular query to standby node,
but actually you can use "app_name_redirect_preference_list" parameter.

http://www.pgpool.net/docs/latest/en/html/runtime-config-load-balancing.html#GUC-APP-NAME-REDIRECT-PREFERENCE-LIST

For example, you can set 
  
  app_name_redirect_preference_list = 'myapp:1'

to send all SELECT queries with application name "myapp" to node 1.
Then specify environment variable PGAPPNAME=myapp while executing a query.

   $ PGAPPNAME=myapp psql -U postgres -p 11000 -h localhost postgres -c "SELECT ..."

On Thu, 31 May 2018 14:46:14 +0900
Bo Peng <pengbo at sraoss.co.jp> wrote:

> Hi,
> 
> > There is the comment /*NO LOAD BALANCE*/ to sent a query to the primary
> > node... is there a similar way to send the query to a replication node.
> 
> You mean master_slave_mode using PostgreSQL streaming replication?
> It can not be configure for particular standby node.
> 
> 
> But you can send all SELECT queries to standby node by using following parameters:
>   
>   backend_weight0 = 0
>   backend_weight1 = 1
>  
> Also you can specify the list of "database-name:node id" pairs to 
> send SELECT queries to a particular backend node for a particular database connection. 
> 
>   database_redirect_preference_list
> 
> http://www.pgpool.net/docs/latest/en/html/runtime-config-load-balancing.html#GUC-DATABASE-REDIRECT-PREFERENCE-LIST
> 
> 
> On Wed, 30 May 2018 08:56:17 -0400
> Araujo Manuel Emilio <emilio.araujo at gmail.com> wrote:
> 
> > Hello guys.
> > 
> > There is the comment /*NO LOAD BALANCE*/ to sent a query to the primary
> > node... is there a similar way to send the query to a replication node.
> > 
> > Environment:
> > - pgpool version: 3.6.4 (subaruboshi)
> > - nodes count: 2 (primary and replicated).
> > - replication mode: PostgreSQL native,  hot standby streaming replication
> > 
> > 
> > Regards,
> 
> 
> -- 
> Bo Peng <pengbo at sraoss.co.jp>
> SRA OSS, Inc. Japan
> 
> _______________________________________________
> pgpool-general mailing list
> pgpool-general at pgpool.net
> http://www.pgpool.net/mailman/listinfo/pgpool-general
> 


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



More information about the pgpool-general mailing list