
The RUN_LOAD_BALANCE_POLICY function returns a string formatted as address:port that results from running the current Native Load Balancer policy.
It’s a great tool for testing after enabling a new Load Balance Policy!
Example:
dbadmin=> SELECT set_load_balance_policy('ROUNDROBIN');
set_load_balance_policy
--------------------------------------------------------------------------------
Successfully changed the client initiator load balancing policy to: roundrobin
(1 row)
dbadmin=> SELECT node_name, node_address FROM nodes;
node_name | node_address
--------------------+---------------
v_test_db_node0001 | 172.16.61.176
v_test_db_node0002 | 172.16.61.177
v_test_db_node0003 | 172.16.61.178
(3 rows)
dbadmin=> SELECT local_node_name();
local_node_name
--------------------
v_test_db_node0001
(1 row)
dbadmin=> SELECT run_load_balance_policy();
run_load_balance_policy
-------------------------
172.16.61.176:5433
(1 row)
dbadmin=> SELECT run_load_balance_policy();
run_load_balance_policy
-------------------------
172.16.61.177:5433
(1 row)
dbadmin=> SELECT run_load_balance_policy();
run_load_balance_policy
-------------------------
172.16.61.178:5433
(1 row)
dbadmin=> SELECT local_node_name();
local_node_name
--------------------
v_test_db_node0001
(1 row)
Because the local node did not change in the above example, note that running the RUN_LOAD_BALANCE_POLICY functions does not actually redirect the session to the node returned by the function.Helpful Links: https://www.vertica.com/docs/latest/HTML/Content/Authoring/AdministratorsGuide/ManagingClientConnections/LoadBalancing/ConnectionLoadBalancing.htm https://www.vertica.com/docs/latest/HTML/Content/Authoring/SQLReferenceManual/Functions/VerticaFunctions/ConnectionManagement/SET_LOAD_BALANCE_POLICY.htm
Have fun!