Python连接clickhouse端口怎样做,保持如何解决
Admin 2022-08-31 群英技术资讯 1614 次浏览
关于“Python连接clickhouse端口怎样做,保持如何解决”的知识有一些人不是很理解,对此小编给大家总结了相关内容,具有一定的参考借鉴价值,而且易于学习与理解,希望能对大家有所帮助,有这个方面学习需要的朋友就继续往下看吧。 <!-- It is the name that will be shown in the clickhouse-client.
By default, anything with "production" will be highlighted in red in query prompt.
-->
<!--display_name>production</display_name-->
<!-- Port for HTTP API. See also 'https_port' for secure connections.
This interface is also used by ODBC and JDBC drivers (DataGrip, Dbeaver, ...)
and by most of web interfaces (embedded UI, Grafana, Redash, ...).
-->
<http_port>8123</http_port>
<!-- Port for interaction by native protocol with:
- clickhouse-client and other native ClickHouse tools (clickhouse-benchmark, clickhouse-copier);
- clickhouse-server with other clickhouse-servers for distributed query processing;
- ClickHouse drivers and applications supporting native protocol
(this protocol is also informally called as "the TCP protocol");
See also 'tcp_port_secure' for secure connections.
-->
<tcp_port>9000</tcp_port>
注意到可以使用两个端口,8123 和 9000 分别接收 http 协议和tcp协议。
from clickhouse_driver import Client
client = Client(host=host, port=port, user=user, password=password, database='default')
client = get_client()
client.execute("show tables;")
print(client.execute("select * from test_arr"))
client.disconnect()
此时如果用8123端口则会得到如下报错:
clickhouse_driver.errors.UnexpectedPacketFromServerError: Code: 102. Unexpected packet from server 192.168.137.101:8123 (expected Hello or Exception, got Unknown packet)
clickhouse_driver.errors.UnexpectedPacketFromServerError: Code: 102
今天用python写个etl从mysql向clickhouse同步数据, 数据量不到1千万,导了一会报上面的第错误。然后在网上查了一下:找到文档写得很清楚:
Welcome to clickhouse-driver — clickhouse-driver 0.2.4 documentation
原来clickhouse提供两个端口:8123和9000
用native protocal需要使用9000端口,然后修改端口后成功。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
猜你喜欢
索引有助于更快地获取信息,如果没有索引,必须遍历整个表,就会很麻烦。在python中,也有对列表做索引的函数,就是index() 函数,本文具体介绍具体index() 函数及其如何使用。
这篇文章主要为大家介绍了Python 内置方法和属性,具有一定的参考价值,感兴趣的小伙伴们可以参考一下,希望能够给你带来帮助
本文给大家分享Python 实时获取任务请求对应的Nginx日志的方法,本文通过实例代码给大家介绍的非常详细,需要的朋友参考下吧
这篇文章给大家分享的是有关python实现webp图片格式转化的内容。小编觉得挺实用的,因此分享给大家做个参考,下文有具体的实例,接下来一起跟随小编看看吧。
混淆矩阵(Confusion Matrix)是机器学习中用来总结分类模型预测结果的一个分析表,是模式识别领域中的一种常用的表达形式。它以矩阵的形式描绘样本数据的真实属性和分类预测结果类型之间的关系,是用来评价分类器性能的一种常用方法。
成为群英会员,开启智能安全云计算之旅
立即注册关注或联系群英网络
7x24小时售前:400-678-4567
7x24小时售后:0668-2555666
24小时QQ客服
群英微信公众号
CNNIC域名投诉举报处理平台
服务电话:010-58813000
服务邮箱:service@cnnic.cn
投诉与建议:0668-2555555
Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2020 群英 版权所有
增值电信经营许可证 : B1.B2-20140078 ICP核准(ICP备案)粤ICP备09006778号 域名注册商资质 粤 D3.1-20240008