Skip to main content

how to tell if vertica is ready to accept connections

  • September 10, 2013
  • 4 replies
  • 20 views

David_Marti
upon reboot it seems to take a long time for spreadd, vertical_agent and verticad to come up. how can i tell when vertica is ready to accept connections

4 replies

Sharon_Cutter
Forum|alt.badge.img
  • Participating Frequently
  • September 10, 2013
When configuring the load balancer, we set it up to verify that "select 1" executes against each node to confirm that they are responding. You could do something similar to confirm that that database in general is ready to accept connections. --Sharon

Kiryl_Mauryshch
or you could poll on the following command and wait until all nodes are in "UP" state. admintools -t view_cluster

Daniel_Leybovic
Forum|alt.badge.img+1
Hi Kiryl. IMHO 'vsql -l' little better than 'admintools -t view_cluster'. Because it doesn't matter if DB is running or not your statement always returns an answer and you need to parse it to understand. In my case you just checks a return code - 0 or whatever. When db is ready:
  daniel@synapse:/tmp$ vsql -l  List of databases   name | user_name   ------+-----------   test | daniel  (1 row)  daniel@synapse:/tmp$ echo $?  0  
When db is not ready:
  daniel@synapse:/tmp$ vsql -l  vsql: could not connect to server: Connection refused   Is the server running on host "???" and accepting   TCP/IP connections on port 5433?  daniel@synapse:/tmp$ vsql -l 2>/dev/null  daniel@synapse:/tmp$ echo $?  2  
Bash validation:
  if [[ '/opt/vertica/bin/vsql -l 2>/dev/null' ]]; then       echo 'READY';   else       echo 'NOT READY';   fi  
Test:
  daniel@synapse:/tmp$ if [[ '/opt/vertica/bin/vsql -l 2>/dev/null' ]]; then echo 'READY'; else echo 'NOT READY'; fi  NOT READY  

Kiryl_Mauryshch
Yes, this is another way of doing it. Thanks for sharing.