[pgpool-general: 4228] Re: Working wiht pgpool and one master and one slave

Tatsuo Ishii ishii at postgresql.org
Thu Nov 19 23:41:19 JST 2015


Works. For me.

Can you show me the result of "show pool_nodes" to make sure that load
balancing weight of slave is 1 and master is 0?

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp

> Hello,
> 
> Unfortunately is not OK working, see my example. I'm executing the
> following queries:
> 
> INSERT QUERY: psql -p 9999 -h 127.0.0.1 test -U postgres -c "SELECT * FROM
> test.tab01;" --Should be directed to the master
> 
> SELECT QUERY: psql -p 9999 -h 127.0.0.1 teste -U postgres -c "SELECT * FROM
> test.tab01;" --Should be directed to the slave
> 
> The both are going to the master:
> 
> My master log file:
> 
> psql postgres test (40544) 2015-11-18 11:36:08 BRST INSERTLOG:  duration:
> 1.376 ms  statement: INSERT INTO test.tab01 VALUES (generate_series(1,100))
> psql postgres test (40544) 2015-11-18 11:36:08 BRST DISCARD ALLLOG:
> duration: 0.052 ms  statement:  DISCARD ALL
> psql postgres test (40547) 2015-11-18 11:36:44 BRST SELECTLOG:  duration:
> 0.616 ms  statement: SELECT * FROM test.tab01;
> psql postgres test (40547) 2015-11-18 11:36:45 BRST DISCARD ALLLOG:
> duration: 0.077 ms  statement:  DISCARD ALL
> 
> 
> My slave log file doesn't show information about these queries.
> 
> Thanks again.
> 
> Best regards
> 
> 2015-11-17 20:54 GMT-02:00 Tatsuo Ishii <ishii at postgresql.org>:
> 
>> > Hello,
>> >
>> >
>> >
>> > 2015-11-16 20:25 GMT-02:00 Tatsuo Ishii <ishii at postgresql.org>:
>> >
>> >> > Hello,
>> >> >
>> >> > Could you help me?
>> >> >
>> >> > I have one master and one slave in my environment. I configured my
>> >> > pgpool.conf such as below:
>> >> >
>> >> > listen_addresses = '*'
>> >> >
>> >> > port = 9999
>> >> >
>> >> > backend_hostname0 = master'
>> >> > backend_port0 = 5432
>> >> > backend_weight0 = 0
>> >> > backend_data_directory0 = '/tmp/data/'
>> >> >
>> >> > backend_hostname1 = 'slave'
>> >> > backend_port1 = 5432
>> >> > backend_weight1 = 1
>> >> > backend_data_directory1 = '/tmp/data'
>> >> >
>> >> > load_balance_mode = on
>> >> >
>> >> > My target is: SELECT queries should be sent to the slave server and
>> >> another
>> >> > operations to the master server.
>> >> >
>> >> > How I can simulated connections to the slave server?
>> >>
>> >> You should set:
>> >>
>> >> backend_weight0 = 0
>> >> backend_weight1 = 1
>> >>
>> >
>> > ​Thanks for answering, but unfortunately I couldn't simulate these
>> > operations using psql. Is it possible to simulate this situation using
>> psql
>> > client?​
>>
>> Can you please elaborate more? I don't understand what is the objective
>> of "simulate". If you want to make sure that SELECT queries go to
>> slave server, you could look at the PostgreSQL statement log at the
>> slave server. I'm confused.
>>
>> Best regards,
>> --
>> Tatsuo Ishii
>> SRA OSS, Inc. Japan
>> English: http://www.sraoss.co.jp/index_en.php
>> Japanese:http://www.sraoss.co.jp
>>
> 
> 
> 
> -- 
> JotaComm
> http://jotacomm.wordpress.com


More information about the pgpool-general mailing list