網站首頁 編程語言 正文
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協議。
- 如果用jdbc連接,端口為 8123
- 如果用driver連接,端口為 9000
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導數據報錯
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端口,然后修改端口后成功。
原文鏈接:https://goodgoodstudy.blog.csdn.net/article/details/119214731
相關推薦
- 2023-03-26 Go語言通過WaitGroup實現控制并發的示例詳解_Golang
- 2022-06-28 ASP.NET一次性對GridView批量更新多行數據_實用技巧
- 2023-10-09 mobx中react的觀察者
- 2023-04-24 numpy.reshape()的函數的具體使用_python
- 2023-03-26 C#連接藍牙設備的實現示例_C#教程
- 2022-05-10 電商后臺開發之商品規格組合算法
- 2022-05-11 Excel表中數據轉為sql
- 2022-02-04 Win10 無法保存對hosts權限所作的更改 拒絕訪問
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支