<div dir="ltr"><div dir="ltr"><div>It is far from the 40/60 proportion I would like. </div><div><br></div><div>So far, it seems that when a query is dispatched to a server, the following are as well. Sometimes I have a load of more than 90% in the standby, when the writing starts, the proportions are inverted and practically all the queries goes to the primary.</div><div><br></div><div>Another thing I noticed is that sometimes the standby appears down even though everything it is ok. </div><div>If I restart the pgpool, it still shows as down. So I need to stop pgpool, delete pgpool_status, and start again, only then it shows up. Maybe I have to set up the healthchecks properly?</div><div><br></div><div>Thanks you for your help.</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 14, 2019 at 6:08 PM Pierre Timmermans &lt;<a href="mailto:ptim007@yahoo.com">ptim007@yahoo.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="gmail-m_6321996834522736726ydpfd46724eyahoo-style-wrap" style="font-family:&quot;Helvetica Neue&quot;,Helvetica,Arial,sans-serif;font-size:16px"><div><div>I am not familiar with load-balancing feature of pgpool. But you gave a higher weight to the standby, so I suppose the stand-by should get more or less 60% of the load ? </div><div><br></div><div>In order to test I suggest that you start a psql session, execute one read-query, then disconnect it. If you do that 100 times, you should have a 60/40 proportions to the stand-by I suppose ? Write statement will always be sent to the primary database. It is no use to execute multiple queries in each psql session because from the doc you know that all queries in one particular session will always go to the same database.</div><div><br></div><div>A problem with load-balancing is that if the stand-by database is stopped then the sessions that were using the standby must be re-created by pgpool (it will do it automatically), but it means that stopping the standby has an impact on the applications (which might not be a big problem but it is good to know).</div><div><br></div><div class="gmail-m_6321996834522736726ydpfd46724esignature">Pierre</div></div>
        <div><br></div><div><br></div>
        
        </div><div id="gmail-m_6321996834522736726ydp18acd4c3yahoo_quoted_3000807309" class="gmail-m_6321996834522736726ydp18acd4c3yahoo_quoted">
            <div style="font-family:&quot;Helvetica Neue&quot;,Helvetica,Arial,sans-serif;font-size:13px;color:rgb(38,40,42)">
                
                <div>
                    On Thursday, March 14, 2019, 8:12:50 PM GMT+1, Fernando Luizão &lt;<a href="mailto:fernandoluizao@gmail.com" target="_blank">fernandoluizao@gmail.com</a>&gt; wrote:
                </div>
                <div><br></div>
                <div><br></div>
                <div><div id="gmail-m_6321996834522736726ydp18acd4c3yiv3416062212"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Thanks, now the standby is up.<div><br clear="none"></div><div>But I&#39;m not sure if I understand the balancing rules.</div><div><br clear="none"></div><div>What I would like is for the consultations to be divided more evenly.<br clear="none"></div><div>I tried to test the load balancing by opening several psql&#39;s on my local machine and doing queries on each of them, but it looks like the queries are always being routed to the standby now ...<br clear="none"></div><div><br clear="none"></div><div>The docs says:</div><div><br clear="none"></div><div>To which node the load balancing mechanism sends read queries is decided at the session start time and will not be changed until the session ends.<br clear="none"></div><div><br clear="none"></div><div>Does this mean that every query will be directed to the same node, until there is a write operation, on connection basis?<br clear="none"></div><div><br clear="none"></div><div>Thanks,</div><div>Fernando</div></div></div></div></div></div><br clear="none"><div class="gmail-m_6321996834522736726ydp18acd4c3yiv3416062212yqt3286840121" id="gmail-m_6321996834522736726ydp18acd4c3yiv3416062212yqt67053"><div class="gmail-m_6321996834522736726ydp18acd4c3yiv3416062212gmail_quote"><div class="gmail-m_6321996834522736726ydp18acd4c3yiv3416062212gmail_attr" dir="ltr">On Thu, Mar 14, 2019 at 3:36 PM Pierre Timmermans &lt;<a shape="rect" href="mailto:ptim007@yahoo.com" rel="nofollow" target="_blank">ptim007@yahoo.com</a>&gt; wrote:<br clear="none"></div><blockquote class="gmail-m_6321996834522736726ydp18acd4c3yiv3416062212gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="gmail-m_6321996834522736726ydp18acd4c3yiv3416062212gmail-m_8381391662156465538ydpf86762c9yahoo-style-wrap"><div><div>For some reason the status is unused, it should be up or down.</div><div><br clear="none"></div><div>I think you should stop pgpool, remove the file /tmp/pgpool_status, then restart pgpool. The file /tmp/pgpool_status is used by pgpool to record the status of the node. When the file is not there it will create it at startup</div><div><br clear="none"></div><div>Regards, </div><div><br clear="none"></div><div class="gmail-m_6321996834522736726ydp18acd4c3yiv3416062212gmail-m_8381391662156465538ydpf86762c9signature">Pierre</div></div>
        <div><br clear="none"></div><div><br clear="none"></div>
        
        </div><div class="gmail-m_6321996834522736726ydp18acd4c3yiv3416062212gmail-m_8381391662156465538ydp9079828fyahoo_quoted" id="gmail-m_6321996834522736726ydp18acd4c3yiv3416062212gmail-m_8381391662156465538ydp9079828fyahoo_quoted_3246817989">
            <div>
                
                <div>
                    On Thursday, March 14, 2019, 7:32:04 PM GMT+1, Fernando Luizão &lt;<a shape="rect" href="mailto:fernandoluizao@gmail.com" rel="nofollow" target="_blank">fernandoluizao@gmail.com</a>&gt; wrote:
                </div>
                <div><br clear="none"></div>
                <div><br clear="none"></div>
                <div><div id="gmail-m_6321996834522736726ydp18acd4c3yiv3416062212gmail-m_8381391662156465538ydp9079828fyiv3262507976"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi,<div><br clear="none"></div><div>I&#39;m new to pgpool, and I&#39;m trying to use the load balancer. </div><div>I have a primary and a hot standby, using native streaming replication.</div><div><br clear="none"></div><div><div>Versions: </div><div>postgresql - 11.2</div><div>pgpool - 4.0.2</div><div><br clear="none"></div></div><div>Here&#39;s what I changed in pgpool.conf:</div><div><br clear="none"></div><div><div>listen_addresses = &#39;*&#39;</div><div>port = 5432</div><div><br clear="none"></div><div>backend_hostname0 = &#39;192.168.51.186&#39;</div><div>backend_port0 = 5433</div><div>backend_weight0 = 0.4</div><div>backend_data_directory0 = &#39;/var/lib/postgresql/11/main&#39;</div><div>backend_flag0 = &#39;ALWAYS_MASTER&#39;</div><div><br clear="none"></div><div>backend_hostname1 = &#39;192.168.51.185&#39;</div><div>backend_port1 = 5433</div><div>backend_weight1 = 0.6</div><div>backend_data_directory1 = &#39;/var/lib/postgresql/11/main&#39;</div><div><br clear="none"></div><div>load_balance_mode = on</div><div><br clear="none"></div><div>master_slave_mode = on</div><div>master_slave_sub_mode = &#39;stream&#39;</div></div><div><br clear="none"></div><div>However, when I inspect the nodes on pgpool, I get the following:</div><div><br clear="none"></div><div><div>postgres=# show pool_nodes;</div><div> node_id |    hostname    | port | status | lb_weight |  role   | select_cnt | load_balance_node | replication_delay | last_status_change  </div><div>---------+----------------+------+--------+-----------+---------+------------+-------------------+-------------------+---------------------</div><div> 0       | 192.168.51.186 | 5433 | up     | 0.400000  | primary | 6113       | true              | 0                 | 2019-03-14 11:39:15</div><div> 1       | 192.168.51.185 | 5433 | unused | 0.600000  | standby | 0          | false             | 0                 | 2019-03-14 11:39:15</div></div><div><br clear="none"></div><div>All queries are being redirected to primary. I can query the standby directly, so everything seems fine with my replication setup.</div><div><br clear="none"></div><div>Why it says the standby is unused? I&#39;m missing something in the configuration?</div><div><br clear="none"></div><div>Thanks,<br clear="none"></div><div>Fernando</div></div></div></div></div></div></div>_______________________________________________<br clear="none">pgpool-general mailing list<br clear="none"><a shape="rect" href="mailto:pgpool-general@pgpool.net" rel="nofollow" target="_blank">pgpool-general@pgpool.net</a><br clear="none"><a shape="rect" href="http://www.pgpool.net/mailman/listinfo/pgpool-general" rel="nofollow" target="_blank">http://www.pgpool.net/mailman/listinfo/pgpool-general</a><br clear="none"></div>
            </div>
        </div></div></blockquote></div></div></div></div></div>
            </div>
        </div></div></blockquote></div>