ck数据写入超过3分钟 会报 504
ru.yandex.clickhouse.except.ClickHouseUnknownException: ClickHouse exception, code: 1002, host: xxxxxclickhouse.ads.aliyuncs.com, port: 8123; <html>
<head><title>504 Gateway Time-out</title></head>
<body bgcolor="white">
<center><h1>504 Gateway Time-out</h1></center>
<hr><center>nginx</center>
</body>
</html>
at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.getException(ClickHouseExceptionSpecifier.java:92)
at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:56)
at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:29)
at ru.yandex.clickhouse.ClickHouseStatementImpl.checkForErrorAndThrow(ClickHouseStatementImpl.java:1052)
at ru.yandex.clickhouse.ClickHouseStatementImpl.getInputStream(ClickHouseStatementImpl.java:743)
at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:193)
at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:163)
at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:158)
at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:153)
at ru.yandex.clickhouse.ClickHouseStatementImpl.execute(ClickHouseStatementImpl.java:330)
at com.alibaba.dw.alisa.wrapper.launcher.ClickHouseSqlJobLauncher.runWithClickHouseJdbc(ClickHouseSqlJobLauncher.java:61)
at com.alibaba.dw.alisa.wrapper.launcher.ClickHouseSqlJobLauncher.runTask(ClickHouseSqlJobLauncher.java:48)
at com.alibaba.dw.alisa.wrapper.ClickHouseWrapper.main(ClickHouseWrapper.java:57)
Caused by: java.lang.Throwable: <html>
<head><title>504 Gateway Time-out</title></head>
<body bgcolor="white">
<center><h1>504 Gateway Time-out</h1></center>
<hr><center>nginx</center>
</body>
</html>
at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:54)
... 11 more
初步分析是因为类似超时参数引起,分析现有参数发现
http_send_timeout http_receive_timeout distributed_ddl_task_timeout的参数超时时间是180秒。
select
*
from
system.settings
where
`value` = '180'
猜测是:
http_send_timeout http_receive_timeout
修改ck参数 (顺便把 distributed_ddl_task_timeout参数修改。)
set global on cluster default http_send_timeout=1800;
set global on cluster default distributed_ddl_task_timeout=1800;
set global on cluster default http_receive_timeout=1800;
查看参数是否生效。
show settings like ‘%timeout%’;
修改参数以后 可以查看query_log 中的Settings 内容语句是否已经生效。
select type,event_time,query,user, Settings from remote(default, system, query_log) where event_date = toDate(now()) order by event_time desc limit 10
虽然修改了以上参数,但是程序依然报504 报错。
让阿里云服务商修改了clickhouse 前面的lb 超时相关参数 。 解决了问题。 lb 配置对用户来说是个黑盒,用户无法修改内部参数。
分析:
到底同时 修改clickhouse 参数 和 slb参数 才解决了问题, 还是只修改slb 参数就可以解决问题 有待进一步验证