py4j.protocol.Py4JJavaError:调用o29.jdbc时发生错误。谷歌云中的通信链路故障

时间:2017-11-02 09:57:16

标签: mysql google-cloud-platform google-cloud-storage google-cloud-sql

我正在按照https://github.com/GoogleCloudPlatform/spark-recommendation-engine中提到的教程进行操作 在使用bdutil“找到最佳模型”的步骤中,我遇到了以下错误。我可以使用cloud sql进行连接,创建了上面链接中提到的所有必要的表。

 gcloud beta sql connect unilogreco --user=root

我能够使用上面的命令连接

 /home/jeevitesh_ms/spark-2.2.0-bin-hadoop2.7/bin/spark-submit --driver-class-path /home/jeevitesh_ms/mysql-connector-java-5.1.44/mysql-connector-java-5.1.44-bin.jar --jars /home/jeevitesh_ms/mysql-connector-java-5.1.44/mysql-connector-java-5.1.44-bin.jar find_model_collaborative.py 172.18.0.1 unilogreco root unilog123

当我检查错误时

py4j.protocol.Py4JJavaError: An error occurred while calling o29.jdbc.: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

未在谷歌中找到相关解决方案。因此请帮助我解决问题

错误日志片段

  17/10/24 20:06:19 INFO SharedState: Warehouse path is 'file:/home/jeevitesh_ms/spark-recommendation-engine-master/pyspark/spark-warehouse/'.
17/10/24 20:06:21 INFO StateStoreCoordinatorRef: Registered StateStoreCoordinator endpoint
Traceback (most recent call last):
File "/home/jeevitesh_ms/spark-recommendation-engine-master/pyspark/find_model_collaborative.py", line 59, in 
dfRates = sqlContext.read.jdbc(url=jdbcUrl, table='Rating')
File "/home/jeevitesh_ms/spark-2.2.0-bin-hadoop2.7/python/lib/pyspark.zip/pyspark/sql/readwriter.py", line 475, in jdbc
File "/home/jeevitesh_ms/spark-2.2.0-bin-hadoop2.7/python/lib/py4j-0.10.4-src.zip/py4j/java_gateway.py", line 1133, in call
File "/home/jeevitesh_ms/spark-2.2.0-bin-hadoop2.7/python/lib/pyspark.zip/pyspark/sql/utils.py", line 63, in deco
File "/home/jeevitesh_ms/spark-2.2.0-bin-hadoop2.7/python/lib/py4j-0.10.4-src.zip/py4j/protocol.py", line 319, in get_return_value
py4j.protocol.Py4JJavaError: An error occurred while calling o29.jdbc.
: 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.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

完成日志

jeevitesh_ms@testmlrecommendation:~/spark-recommendation-engine-master/pyspark$ /home/jeevitesh_ms/spark-2.2.0-bin-hadoop2.7/bin/spark-submit --driver-class-path /home/jeevitesh_ms/mysql-connector-java-5.1.44/mysql-connector-java-5.1.44-bin.jar --jars /home/jeevitesh_ms/mysql-connector-java-5.1.44/mysql-connector-java-5.1.44-bin.jar find_model_collaborative.py 35.202.220.185 unilogreco root unilog123
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
17/10/24 20:57:48 INFO SparkContext: Running Spark version 2.2.0
17/10/24 20:57:48 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
17/10/24 20:57:48 INFO SparkContext: Submitted application: app_collaborative
17/10/24 20:57:48 INFO SecurityManager: Changing view acls to: jeevitesh_ms
17/10/24 20:57:48 INFO SecurityManager: Changing modify acls to: jeevitesh_ms
17/10/24 20:57:48 INFO SecurityManager: Changing view acls groups to:
17/10/24 20:57:48 INFO SecurityManager: Changing modify acls groups to:
17/10/24 20:57:48 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(jeevitesh_ms); groups with view permissions: Set(); users with modify permissions: Set(jeevitesh_ms); groups with modify permissions: Set()
17/10/24 20:57:49 INFO Utils: Successfully started service 'sparkDriver' on port 56068.
17/10/24 20:57:49 INFO SparkEnv: Registering MapOutputTracker
17/10/24 20:57:49 INFO SparkEnv: Registering BlockManagerMaster
17/10/24 20:57:49 INFO BlockManagerMasterEndpoint: Using org.apache.spark.storage.DefaultTopologyMapper for getting topology information
17/10/24 20:57:49 INFO BlockManagerMasterEndpoint: BlockManagerMasterEndpoint up
17/10/24 20:57:49 INFO DiskBlockManager: Created local directory at /tmp/blockmgr-aff00f6d-085c-4b22-b853-8a122f59dab1
17/10/24 20:57:49 INFO MemoryStore: MemoryStore started with capacity 413.9 MB
17/10/24 20:57:49 INFO SparkEnv: Registering OutputCommitCoordinator
17/10/24 20:57:49 INFO Utils: Successfully started service 'SparkUI' on port 4040.
17/10/24 20:57:49 INFO SparkUI: Bound SparkUI to 0.0.0.0, and started at http://172.17.0.2:4040
17/10/24 20:57:49 INFO SparkContext: Added JAR file:/home/jeevitesh_ms/mysql-connector-java-5.1.44/mysql-connector-java-5.1.44-bin.jar at spark://172.17.0.2:56068/jars/mysql-connector-java-5.1.44-bin.jar with timestamp 1508858869966
17/10/24 20:57:50 INFO SparkContext: Added file file:/home/jeevitesh_ms/spark-recommendation-engine-master/pyspark/find_model_collaborative.py at spark://172.17.0.2:56068/files/find_model_collaborative.py with timestamp 1508858870271
17/10/24 20:57:50 INFO Utils: Copying /home/jeevitesh_ms/spark-recommendation-engine-master/pyspark/find_model_collaborative.py to /tmp/spark-b4e50762-1ad8-40bd-afcc-7506d7001573/userFiles-33652ea8-5749-42da-b9b5-ff92f2951c3b/find_model_collaborative.py
17/10/24 20:57:50 INFO StandaloneAppClient$ClientEndpoint: Connecting to master spark://172.17.0.2:7077...
17/10/24 20:57:50 INFO TransportClientFactory: Successfully created connection to /172.17.0.2:7077 after 28 ms (0 ms spent in bootstraps)
17/10/24 20:57:50 INFO StandaloneSchedulerBackend: Connected to Spark cluster with app ID app-20171024205750-0007
17/10/24 20:57:50 INFO Utils: Successfully started service 'org.apache.spark.network.netty.NettyBlockTransferService' on port 52228.
17/10/24 20:57:50 INFO NettyBlockTransferService: Server created on 172.17.0.2:52228
17/10/24 20:57:50 INFO BlockManager: Using org.apache.spark.storage.RandomBlockReplicationPolicy for block replication policy
17/10/24 20:57:50 INFO BlockManagerMaster: Registering BlockManager BlockManagerId(driver, 172.17.0.2, 52228, None)
17/10/24 20:57:50 INFO BlockManagerMasterEndpoint: Registering block manager 172.17.0.2:52228 with 413.9 MB RAM, BlockManagerId(driver, 172.17.0.2, 52228, None)
17/10/24 20:57:50 INFO BlockManagerMaster: Registered BlockManager BlockManagerId(driver, 172.17.0.2, 52228, None)
17/10/24 20:57:50 INFO BlockManager: Initialized BlockManager: BlockManagerId(driver, 172.17.0.2, 52228, None)
17/10/24 20:57:51 INFO EventLoggingListener: Logging events to file:/tmp/spark-events/app-20171024205750-0007
17/10/24 20:57:51 INFO StandaloneSchedulerBackend: SchedulerBackend is ready for scheduling beginning after reached minRegisteredResourcesRatio: 0.0
17/10/24 20:57:51 INFO SharedState: Setting hive.metastore.warehouse.dir ('null') to the value of spark.sql.warehouse.dir ('file:/home/jeevitesh_ms/spark-recommendation-engine-master/pyspark/spark-warehouse/').
17/10/24 20:57:51 INFO SharedState: Warehouse path is 'file:/home/jeevitesh_ms/spark-recommendation-engine-master/pyspark/spark-warehouse/'.
17/10/24 20:57:52 INFO StateStoreCoordinatorRef: Registered StateStoreCoordinator endpoint
Traceback (most recent call last):
File "/home/jeevitesh_ms/spark-recommendation-engine-master/pyspark/find_model_collaborative.py", line 59, in 
dfRates = sqlContext.read.jdbc(url=jdbcUrl, table='Rating')
File "/home/jeevitesh_ms/spark-2.2.0-bin-hadoop2.7/python/lib/pyspark.zip/pyspark/sql/readwriter.py", line 475, in jdbc
File "/home/jeevitesh_ms/spark-2.2.0-bin-hadoop2.7/python/lib/py4j-0.10.4-src.zip/py4j/java_gateway.py", line 1133, in call
File "/home/jeevitesh_ms/spark-2.2.0-bin-hadoop2.7/python/lib/pyspark.zip/pyspark/sql/utils.py", line 63, in deco
File "/home/jeevitesh_ms/spark-2.2.0-bin-hadoop2.7/python/lib/py4j-0.10.4-src.zip/py4j/protocol.py", line 319, in get_return_value
py4j.protocol.Py4JJavaError: An error occurred while calling o29.jdbc.
: 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.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  jeevitesh_ms@testmlrecommendation:~/spark-recommendation-engine-master/pyspark$ /home/jeevitesh_ms/spark-2.2.0-bin-hadoop2.7/bin/spark-submit   --driver-class-path /home/jeevitesh_ms/mysql-connector-java-5.1.44/mysql-connector-java-5.1.44-bin.j
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
    at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:989)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:341)
    at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2189)
    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2222)
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2017)
    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:779)
    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:389)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330)
    at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$$anonfun$createConnectionFactory$1.apply(JdbcUtils.scala:61)
    at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$$anonfun$createConnectionFactory$1.apply(JdbcUtils.scala:52)
    at org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD$.resolveTable(JDBCRDD.scala:58)
    at org.apache.spark.sql.execution.datasources.jdbc.JDBCRelation.<init>(JDBCRelation.scala:113)
    at org.apache.spark.sql.execution.datasources.jdbc.JdbcRelationProvider.createRelation(JdbcRelatio)

请帮助解决此问题

0 个答案:

没有答案