0

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?

Vishakha Lall
  • 1,178
  • 12
  • 33

2 Answers2

5

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.

A. Saunders
  • 815
  • 1
  • 6
  • 19
  • Thanks a lot, this helps. I thought the load balancing policy would not take care of the case when node is down. Will check this out. – Vishakha Lall Apr 08 '20 at 05:21
  • I'm wondering if in this case `host01` is down would we still be able to use the command `vsql -h host01 -U dbadmin -C` and it connects to `host02`? – Vishakha Lall Apr 08 '20 at 05:49
  • @VishakhaLall, I don't have a cluster to test with at the moment, but I am pretty sure that -C will work even if the node on the specified host is down, as long as the Vertica agent is still running on that host. Either way, these options are not mutually exclusive, you can include both: `$ vsql -h host01 -C -B host02:5433`. – A. Saunders Apr 08 '20 at 14:20
3

The docs say with vsql -B.

Have you tried that option?

edd
  • 1,307
  • 10
  • 10