FAQ-ClickHouse exception xxx Read timed out
更新时间: 2024-03-11 02:43:33
阅读 2741
ClickHouse exception, code: 159, host: xxx, port: 8123; Read timed out
问题描述/异常栈
TaskSetManager: Lost task 0.0 in stage 0.0
22/06/22 10:44:14 ERROR Executor: Exception in task 374.0 in stage 0.0 (TID 43)
transfer.ru.yandex.clickhouse.except.ClickHouseException: ClickHouse exception, code: 159, host: cc-bp1o2qg068979c7f6.ads.rds.aliyuncs.com, port: 8123; Read timed out
at transfer.ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.getException(ClickHouseExceptionSpecifier.java:85)
at transfer.ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:55)
at transfer.ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:24)
at transfer.ru.yandex.clickhouse.ClickHouseStatementImpl.sendStream(ClickHouseStatementImpl.java:855)
at transfer.ru.yandex.clickhouse.ClickHouseStatementImpl.sendStream(ClickHouseStatementImpl.java:824)
at transfer.ru.yandex.clickhouse.ClickHouseStatementImpl.sendStream(ClickHouseStatementImpl.java:817)
at transfer.ru.yandex.clickhouse.ClickHousePreparedStatementImpl.executeBatch(ClickHousePreparedStatementImpl.java:335)
at transfer.ru.yandex.clickhouse.ClickHousePreparedStatementImpl.executeBatch(ClickHousePreparedStatementImpl.java:320)
at org.apache.spark.sql.execution.datasources.jdbc.SparkJdbcUtils$.savePartition(SparkJdbcUtils.scala:545)
at com.netease.music.da.transfer.jdbc.writer.JDBCWriter$$anonfun$doWrite$1.apply(JDBCWriter.scala:150)
at com.netease.music.da.transfer.jdbc.writer.JDBCWriter$$anonfun$doWrite$1.apply(JDBCWriter.scala:145)
at org.apache.spark.rdd.RDD$$anonfun$foreachPartition$1$$anonfun$apply$29.apply(RDD.scala:935)
at org.apache.spark.rdd.RDD$$anonfun$foreachPartition$1$$anonfun$apply$29.apply(RDD.scala:935)
at org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:2082)
at org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:2082)
at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:87)
at org.apache.spark.scheduler.Task.run(Task.scala:109)
at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:345)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.SocketTimeoutException: Read timed out
解决方案
1、数据源增加配置:?socket_timeout=300000
或者
2、在传输任务配置target.urlSuffix=socket_timeout=300000
问题原因
在通过ClickHouse官方驱动使用java代码连接数据库的时候,有时由于ClickHouse服务器在高负载下出现滞后以及ClickHouse服务器和JDBC驱动程序的超时设置不同所致。当我们有很多选择查询时,ClickHouse服务器的性能将大大降低,简单查询将运行30秒以上,从而导致JDBC驱动程序超时。
出现报错:ClickHouse exception, code: 159, host: 10.100.xx.xxx, port: 8123; Read timed out
参照:https://blog.csdn.net/ws271/article/details/111914727
作者:林帅
文档反馈
以上内容对您是否有帮助?