Skip to main content

How to find the current active node in a Vertica Cluster

  • March 13, 2017
  • 3 replies
  • 18 views

khizer19194

I have a requirement where I am supposed to query a Vertica DB Cluster to fetch some data.
Is there a way in which I can dynamically query the current active node without hard-coding the hostnames of the nodes in the cluster?

Can I find the current active node using a command or is it available in any variable?

Or is there a workaround logic that you can suggest?

3 replies

ckotsidimos
Forum|alt.badge.img+1
  • Participating Frequently
  • March 13, 2017

As far as I know, you can direct your query to any node that you want. Then the cluster spreads the query to all nodes. by default all nodes are active


khizer19194
  • Author
  • New Participant
  • March 14, 2017

Thanks @ckotsidimos .

I need to query the cluster from a remote server. So at any time, the command requires a hostname.

Consider a scenario where the current active node goes down.
If I hard-code the hostname of initial active node, the query will fail and it wont replace this hostname with the hostname of the new active node intelligently.

I was hoping to find this information using a command or in a variable so that I can make my query intelligent enough to change hostnames as per the circumstances.


ckotsidimos
Forum|alt.badge.img+1
  • Participating Frequently
  • March 24, 2017

@khizer19194
I have 2 cases for you.

1) try to remotely run admintools on a node remotely and get the details from there
there is a command to get the nodes

2) Make a connection pool and get the names of hosts from that pool for your connection string. We have done this with the dev team in our company and worked.