使用spark(192.168.1.40)操作远程的mysql数据库(192.168.110.224)
两台服务器不在同一网段!有影响吗?怎么破?程序报错如下:
scala> val jdbcDF =spark.read.format("jdbc").option("driver","com.mysql.jdbc.Driver").option("url","jdbc:mysql://192.168.1.40:3306/wisvdi").option("dbtable","assignment").option("user","root").option("password","root").load();
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Caused by: java.net.ConnectException: Connection timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)