clickhouse筆記


什么是clikhouse:

https://www.jianshu.com/p/350b59e8ea68

clickhouse優缺點:

https://blog.csdn.net/lovewebeye/article/details/102739939

個人使用到的clickhouse相關操作:

1、創建表(clickhouse不支持換行)

CREATE TABLE 數據庫名.表名 (`id` UInt16, `port` String, `create` Date) ENGINE = MergeTree(create, id, 8192); 

2、遠程導入mysql數據並新建表

CREATE TABLE 表名 ENGINE = MergeTree ORDER BY id AS SELECT * FROM mysql('ip:端口', '數據庫', '表名', '用戶名', '密碼') as a where a.id in (1,2,3,4);

3、導出csv文件

clickhouse-client --query="select * from 表名 format CSV">/home/root1/a.csv;(非數據庫內執行)

4、時間戳轉時間

select toDateTime(timestamp);

5、導入csv

cat 1.csv | clickhouse-client --query="INSERT INTO 表名 FORMAT CSV";


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM