How to find the current active node in a Vertica Cluster
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?
0
Comments
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
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.
@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.