Search code examples
verticavsql

Can Vertica vsql have a failover host like the JDBC client


I am trying to connect to Vertica nodes through vsql using the -h parameter to specify the host IP. However, I want to specify failover nodes.

According to the documentation backup hosts can be provided as a property in JDBC connection.

How can I implement the same through vsql?


Solution

  • edd is correct, you can use -B SERVER:PORT. Also, if you have native connection load balancing set, you can use the -C option. This will allow the Vertica native load balancer to choose a host for you.

    To set the load balancer you run:

    SELECT SET_LOAD_BALANCE_POLICY('ROUNDROBIN');
    

    Then when you connect, you use the -C option, and you will see that Vertica has selected a new host.

    $ vsql -h host01 -U dbadmin -C
    Welcome to vsql, the Vertica Analytic Database interactive terminal.
    
    Type:  \h or \? for help with vsql commands
           \g or terminate with semicolon to execute query
           \q to quit
    
    INFO: Connected using a load-balanced connection.
    INFO: Connected to host02 at port 5433.
    
    dbadmin=>
    

    Using -C should work if the node is down on the specified host, as long as the Vertica agent is still running on that host.