Skip to main content

Failed connect to vertica in VM

  • March 8, 2017
  • 9 replies
  • 12 views

alex12

Hi all! I'm new in Vertica. And try to connect with spark vertica connector to my vertica in VM Virtualbox.

I have this options
val opt = Map(
"host" -> "10.0.3.117",
"table" -> "test_table2",
"db" -> "test",
"user" -> "test_user",
"password" -> "test",
"port" -> "5433")

And then try to read
val df2 = sqlContext.read.format("com.vertica.spark.datasource.DefaultSource").options(opt).load()

but I have an Exception
java.sql.SQLNonTransientConnectionException: [Vertica]VJDBC Failed to connect to host 127.0.0.1 on port 5433. Reason: Failed to establish a connection to the primary server or any backup address
Currently I'm using scala 2.10.6 and spark 1.6.2
It is too strange, because my ip 10.0.3.117 is being pinged good. And, when I used simple spark jdbc, scala 2.11 and spark 2.0.x for reading it's worked!
Maybe I'm doing something wrong?

9 replies

chewbaca
  • New Participant
  • July 13, 2017

I'm running into the same issue with Vertica 8.1 and Spark 2.1. Any recommendations on resolving this?


sKwa
Forum|alt.badge.img+1
  • Participating Frequently
  • July 13, 2017

Hi!

VJDBC Failed to connect to host 127.0.0.1 on port 5433. 
Reason: Failed to establish a connection to [...]

Check this article - Debugging Client Issues with Client Side Logging

Try pure java (or DbVisualizer). Is it works?


amishansky
  • New Participant
  • July 29, 2019

Hi everyone!
I have this problem too. Spark 2.4.3, Vertica 9.2.1. Has anyone found a solution for this problem?


marcothesane
Forum|alt.badge.img+1
  • Participating Frequently
  • July 30, 2019

I have never tried to connect Spark to Vertica.

But:
The error message mentions a host 127.0.0.1 (that's localhost ...), while you're explicitly specifying a host 10.0.3.117 .
Either a spark config overriding your opt Map? Or some error that prevents Spark from loading your opt Map in the first place?


amishansky
  • New Participant
  • August 1, 2019

I found the source of the problem. Default settings for vertica node export_ip is localhost(127.0.0.1), but when spark tries to connect to vertica, it calls the node ip and connects to node directly. So export_ip should be set to one that is reachable for spark.


vikas_garg
  • New Participant
  • August 8, 2019

I am able to connect with Vertica using Spark.

Try making these 2 changes:
1) Created Static IP instead of dhcp
2) Change Network Card type from NTP to Bridge.


safa
  • New Participant
  • November 30, 2020

Hello,
I have the same problem : java.sql.SQLNonTransientConnectionException: [Vertica]VJDBC Failed to connect to host ( VIP ) on port 5433. Reason: Failed to establish a connection to the primary server or any backup address
however , the connexion works using DbVisualizer.
Any help please ?


Jim_Knicely
Forum|alt.badge.img+2
  • Participating Frequently
  • November 30, 2020

@safa - What version of Vertica is this (server and JDBC client)? Take a look at the JDBC Connection Property LoginTimeout .

https://www.vertica.com/docs/10.0.x/HTML/Content/Authoring/ConnectingToVertica/ClientJDBC/JDBCConnectionProperties.htm?zoom_highlight=LoginTimeout

Setting the value to >= 30 seconds may help.


SergeB
Forum|alt.badge.img
  • Participating Frequently
  • November 30, 2020

What IPs do you see when running select * from nodes; ?