clickhouse的使用教程

2021-10-21 16:55:00 字數 2187 閱讀 4804

在檔案末尾新增

*soft nofile 65536

*hard nofile 65536

*soft nproc 131072

*hard nproc 131072

安裝依賴檔案

示例

clickhouse-client -q 'show databases;'

clickhouse-client -d system -q 'show tables;'

存資料庫檔案一般是csv

clickhouse資料的儲存位置

/

var/lib/clickhouse/

data

clickhouse-client #進入clickhouse

exit

#離開clickhouse

clickhouse沒有bool型別

可以使用enum來代替

詳細見官網

表引擎 嚴格區分大小寫

最簡單的表引擎,用於將資料儲存在磁碟上。每列都儲存在單獨的壓縮檔案中。寫入時,資料將附加到檔案末尾。

併發資料訪問不受任何限制:

這種表引擎的典型用法是 write-once:首先只寫入一次資料,然後根據需要多次讀取。查詢在單個流中執行。換句話說,此引擎適用於相對較小的表(建議最多1,000,000行)。如果您有許多小表,則使用此表引擎是適合的,因為它比log引擎更簡單(需要開啟的檔案更少)。當您擁有大量小表時,可能會導致效能低下,但在可能已經在其它 dbms 時使用過,則您可能會發現切換使用 tinylog 型別的表更容易。不支援索引。

在 yandex.metrica 中,tinylog 表用於小批量處理的中間資料。

memory 引擎以未壓縮的形式將資料儲存在 ram 中。資料完全以讀取時獲得的形式儲存。換句話說,從這張表中讀取是很輕鬆的。併發資料訪問是同步的。鎖範圍小:讀寫操作不會相互阻塞。不支援索引。查詢是並行化的。在簡單查詢上達到最大速率(超過10 gb /秒),因為沒有磁碟讀取,不需要解壓縮或反序列化資料。(值得注意的是,在許多情況下,與 mergetree 引擎的效能幾乎一樣高)。重新啟動伺服器時,表中的資料消失,表將變為空。通常,使用此表引擎是不合理的。但是,它可用於測試,以及在相對較少的行(最多約100,000,000)上需要最高效能的查詢。

memory 引擎是由系統用於臨時表進行外部資料的查詢(請參閱 «外部資料用於請求處理» 部分),以及用於實現 global in

見官網

見官網

click house函式的使用

格式 hdfs url,format,struct select toint32ornull id name jobfrom hdfs hdfs linux01 8020 doit18 user2.csv csv id string name string,job string 格式 file pa...

clickhouse簡單使用 函式整理

一 ddl 如果想按集群操作,需要借助zookeeper,在config.xml中新增配置 clickhouse task queue ddl 乙個節點建立表,會同步到各個節點 create table db.table on cluster cluster 新增 刪除 修改列 alter tabl...

clickhouse客戶端使用

測試初始化 clickhouse client m create database if not exists test use test drop table test create table test id uint8,text string,created datetime engine t...