ClickHouse快速入門-創(chuàng)新互聯(lián)

專注于為中小企業(yè)提供成都網(wǎng)站設(shè)計(jì)、做網(wǎng)站服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)橋西免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動(dòng)了上1000家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。

ClickHouse 是什么

ClickHouse 是一個(gè)開源的面向聯(lián)機(jī)分析處理(OLAP, On-Line Analytical Processing) 的列式存儲(chǔ)數(shù)據(jù)庫管理系統(tǒng)。

在一個(gè) "常規(guī)" 的行式數(shù)據(jù)庫管理系統(tǒng)中,數(shù)據(jù)按下面的順序存儲(chǔ)

id |   name   | age
---|----------|---1  | Zhangsan | 182  | GlonHo   | 203  | Lisi     | 22...| ...      | ...

換言之,所有相關(guān)的值在一個(gè)行里面一個(gè)挨一個(gè)存儲(chǔ)。行式存儲(chǔ)的的數(shù)據(jù)庫管理系統(tǒng)有:MySQL, Postgres, MS SQL Server 等。

在一個(gè)列式存儲(chǔ)數(shù)據(jù)庫管理系統(tǒng)中,數(shù)據(jù)存儲(chǔ)的方式如下所示

id: 1 2 3 ...name: Zhangsan GlonHo Lisi ...age: 18 20 22 ...

列式存儲(chǔ)的數(shù)據(jù)庫管理系統(tǒng)更適合于 OLAP 場景(對于大多數(shù)查詢,至少有 100 倍的處理速度提升)的原因有:

I/O 方面:
  • 對于一個(gè)分析的查詢,只需要表中少量的列。在一個(gè)列存儲(chǔ)數(shù)據(jù)庫管理系統(tǒng)中,可以只讀取所需的數(shù)據(jù)。例如,如果只需要從 100 列中讀取 5 列,那么預(yù)期可以減少 20倍 I/O

  • 列式存儲(chǔ)數(shù)據(jù),更易于壓縮,進(jìn)一步減少 I/O

  • 由于減少了 I/O,系統(tǒng)中可以緩存更多符合要求的數(shù)據(jù)

CPU 方面:

執(zhí)行一個(gè)查詢需要處理大量的行,它有助于調(diào)度所有操作對整個(gè)向量而不是單獨(dú)的行,或?qū)崿F(xiàn)查詢引擎,這樣幾乎沒有調(diào)度成本,如果不這么做,對于任意還過得去的磁盤子系統(tǒng),查詢解釋器不可避免地分?jǐn)?CPU。因此,把數(shù)據(jù)以列的方式來存儲(chǔ)和處理是很有意義的。

有兩種方法可以做到這一點(diǎn):

  1. vector 引擎。所有操作是寫成向量的形式,而不是單獨(dú)的值。這意味著你不需要頻繁調(diào)用操作,并且調(diào)度成本可以忽略不計(jì)。

  2. 代碼生成。生成的查詢的代碼中含有所有的間接調(diào)用。

ClickHouse 獨(dú)有特性

列式存儲(chǔ)
數(shù)據(jù)壓縮
不是所有的列式存儲(chǔ)數(shù)據(jù)管理系統(tǒng)都會(huì)進(jìn)行數(shù)據(jù)壓縮,如:InfiniDB CE 和 MonetDB。然而,數(shù)據(jù)壓縮真的提高了性能
支持磁盤存儲(chǔ)數(shù)據(jù)
一些列式存儲(chǔ)數(shù)據(jù)管理系統(tǒng)只能在 RAM(Random Access Memory)上面工作,如:SAP HANA 和 Google PowerDrill。但是對于海量數(shù)據(jù),RAM 的成本太大了。
多核并行處理
分布式處理
類 SQL 支持
支持非標(biāo)準(zhǔn) SQL。
不支持 NULL,不支持相關(guān)子查詢,支持 JOIN,支持在 FROM、IN、 JOIN 子句中的子查詢和標(biāo)量子查詢。
Vector 引擎
不止以列的形式存儲(chǔ)數(shù)據(jù),部分列還經(jīng)過向量處理。這樣能取得高 CPU 性能。
數(shù)據(jù)實(shí)時(shí)更新
ClickHouse支持主鍵表。為了迅速查詢某個(gè)范圍內(nèi)的主鍵,數(shù)據(jù)使用合并樹增量地進(jìn)行排序。因此,數(shù)據(jù)可以不斷被添加到表中,添加數(shù)據(jù)時(shí)沒有加鎖。
索引
允許有一個(gè)主鍵
適用于在線查詢
這使得 ClickHouse 可以用作 Web 系統(tǒng)的后端。低延時(shí)意味著查詢可以被及時(shí)處理。
支持近似計(jì)算
支持嵌套的數(shù)據(jù)結(jié)構(gòu),支持?jǐn)?shù)組
支持限制查詢的復(fù)雜性
復(fù)制和支持復(fù)制節(jié)點(diǎn)的數(shù)據(jù)完整性
使用多主節(jié)點(diǎn)復(fù)制。數(shù)據(jù)被寫入任何可用的復(fù)制節(jié)點(diǎn)后,分發(fā)給其他的復(fù)制節(jié)點(diǎn)。系統(tǒng)在不同的復(fù)制節(jié)點(diǎn)中維護(hù)相同的數(shù)據(jù)。在出現(xiàn)失敗之后,數(shù)據(jù)會(huì)自動(dòng)回復(fù),或者在復(fù)雜的情況下使用一個(gè) "按鈕"。

入門指南

系統(tǒng)要求

ClickHouse 不是一個(gè)跨平臺(tái)的系統(tǒng),它要求 Linux Ubuntu 12.04 或更新版本,支持帶有 4.2 SSE 指令集的 x86_64 架構(gòu)。

檢查是否支持 4.2 SSE 指令集:

grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported"

推薦使用 Ubuntu 系統(tǒng),連接終端必須是 UTF-8 編碼(Ubuntu 默認(rèn)是 UTF-8)。

安裝
用系統(tǒng)安裝包的方式

在 /etc/apt/sources.list 或者一個(gè)單獨(dú)的 /etc/apt/sources.list.d/clickhouse.list 文件中添加 repository:

在 Ubuntu Trusty (14.04):

deb http://repo.yandex.ru/clickhouse/trusty stable main

對于其他 Ubuntu 版本,把替換 trusty 成 xenial 或者 precise。

然后執(zhí)行:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv E0C56BD4    # optionalsudo apt-get updatesudo apt-get install clickhouse-client clickhouse-server-common

也可以手動(dòng)下載安裝包:

ClickHouse 包含訪問限制設(shè)置,設(shè)置在 users.xml 文件中(和 config.xml 放在一起)。

默認(rèn)情況下,允許自任何地方的默認(rèn)用戶無密碼的訪問。

用源碼安裝

Linux 平臺(tái)跟著 build.md 中的介紹進(jìn)行 build,Mac OS X 則跟著 build_osx.md 進(jìn)行 build。

你可以編譯包然后安裝,也可以不安裝。

ITEM路徑
Clientsrc/dbms/src/Client/
Serversrc/dbms/src/Server/

對于 Server,創(chuàng)建一個(gè)數(shù)據(jù)目錄,如:

/var/lib/clickhouse/data/default//var/lib/clickhouse/metadata/default/

在 server config 中配置,然后給所需用戶 chown 分配權(quán)限。

注意:服務(wù)器配置的路徑是:src/dbms/src/Server/config.xml

其他安裝方式

Docker p_w_picpath: https://hub.docker.com/r/yandex/clickhouse-server/

Gentoo: https://github.com/kmeaw/clickhouse-overlay

運(yùn)行

以守護(hù)進(jìn)程(daemon)的方式啟動(dòng)服務(wù):

sudo service clickhouse-server start

日志目錄:

/var/log/clickhouse-server/

如果啟動(dòng)失敗,檢查配置文件:

/etc/clickhouse-server/config.xml

還可以在控制臺(tái)啟動(dòng)服務(wù):

clickhouse-server --config-file=/etc/clickhouse-server/config.xml

在這種情況下,日志會(huì)輸出到控制臺(tái),這在開發(fā)的時(shí)候還是挺方便的。如果配置文件就在當(dāng)前目錄(即與 clickhouse-server 同一目錄),無需使用參數(shù) --config-file,默認(rèn)讀取 ./config-file。

可以使用命令行客戶端來連接服務(wù):

clickhouse-client

clickhouse-client 參數(shù)介紹

參數(shù)描述
--host, -h目標(biāo)服務(wù)器名,默認(rèn)為 localhost
--port目標(biāo)端口,默認(rèn)為 9000
--user, -u連接用戶,默認(rèn)為 default
--password連接用戶密碼,默認(rèn)為空字符串
--query, -q非交互模式下執(zhí)行的命令
--database, -d當(dāng)前操作的數(shù)據(jù)庫,默認(rèn)選擇配置文件配置的值(默認(rèn)為 default 庫)
--multiline, -m如果設(shè)定,允許多行查詢
--multiquery, -n如果指定,允許處理由分號分隔的多個(gè)查詢。只有在非交互式模式工作。
--format, -f使用指定的默認(rèn)格式輸出結(jié)果
--vertical, -E如果指定,默認(rèn)使用垂直格式輸出結(jié)果,等同于 --format=Vertical。在這種格式中,每個(gè)值可在單獨(dú)的行上,顯示寬表時(shí)很有用。
--time, -t如果指定,在 stderr 中輸出查詢執(zhí)行時(shí)間的非交互式模式下。
--stacktrace如果指定,如果發(fā)生異常,也會(huì)輸出堆棧跟蹤。
--config-file配置文件的名稱,額外的設(shè)置或改變了上面列出的設(shè)置默認(rèn)值。

默認(rèn)情況下,配置文件的搜索順序如下:

  • ./clickhouse-client.xml

  • ~/.clickhouse-client/config.xml

  • /etc/clickhouse-client/config.xml

如果三個(gè)文件同時(shí)存在N個(gè),則以找到的第一個(gè)配置文件為準(zhǔn)。

這個(gè)客戶端還可以連接到一個(gè)遠(yuǎn)程服務(wù)端:

clickhouse-client --host=example.com

還可以指定將用于處理查詢的任何設(shè)置,如:clickhouse-client --max_threads=1,表示查詢處理線程的大數(shù)量為 1。

檢查系統(tǒng)
root@GlonHo:~# clickhouse-clientClickHouse client version 1.1.54198.
Connecting to localhost:9000.Connected to ClickHouse server version 1.1.54198.

:) 
:) select 1SELECT 1┌─1─┐
│ 1 │
└───┘1 rows in set. Elapsed: 0.023 sec. 

:)

恭喜你,it works!

測試數(shù)據(jù)

如果你是 Yandex 的員工,你可以使用 Yandex.Metrica 的測試數(shù)據(jù)來探索系統(tǒng)的功能和性能,你在這里可以找到如何使用測試數(shù)據(jù)的介紹。另外,你可以使用一個(gè)公開的可用的數(shù)據(jù)集,看這里。

如果你有疑問

如果你是 Yandex 的員工,你可以使用 ClickHouse 內(nèi)部郵件列表,你可以訂閱這個(gè)列表來獲取公告、新的發(fā)展信息和其他用戶的問題。

另外,你可以在 Stack Overflow 上提問,在 Google Groups 上討論,或者發(fā)郵件到開發(fā)者郵箱:clickhouse-feedback@yandex-team.com。

最后

ClickHouse 目前官方只支持 Ubuntu,對于 RedHat 并沒有什么描述。在 CentOS 6.9 上編譯安裝的時(shí)候,特別麻煩,最后放棄了,后來在官方的 Google Groups 上找到一個(gè) RedHat 的包安裝方式(或者直接到 GitHub),但還是找不到對應(yīng)版本的依賴,搜了一下,可能需要重新編譯內(nèi)核,也就放棄了。最終找了個(gè) Ubuntu 14.04 LTS 來做的實(shí)驗(yàn)。

CentOS:

[root@GlonHo ~]# grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported"
SSE 4.2 supported

[root@GlonHo ~]# yum-config-manager --add-repo http://repo.red-soft.biz/repos/clickhouse/repo/clickhouse-el6.repobash: yum-config-manager: command not found

[root@GlonHo ~]# yum -y install yum-utils 
...

[root@GlonHo ~]# yum-config-manager --add-repo http://repo.red-soft.biz/repos/clickhouse/repo/clickhouse-el6.repoLoaded plugins: fastestmirror
adding repo from: http://repo.red-soft.biz/repos/clickhouse/repo/clickhouse-el6.repo
grabbing file http://repo.red-soft.biz/repos/clickhouse/repo/clickhouse-el6.repo to /etc/yum.repos.d/clickhouse-el6.repo
clickhouse-el6.repo                                                                                                                                  |  165 B     00:00     repo saved to /etc/yum.repos.d/clickhouse-el6.repo

[root@GlonHo ~]# yum install clickhouse-server clickhouse-client clickhouse-server-common clickhouse-compressor -y
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirrors.zju.edu.cn
 * epel: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.zju.edu.cn
 * updates: mirrors.163.com
base                                                                                                                         | 3.7 kB     00:00     clickhouse                                                                                                                   | 2.9 kB     00:02     extras                                                                                                                       | 3.4 kB     00:00     updates                                                                                                                      | 3.4 kB     00:00     Package clickhouse-server-common-1.1.54198-3.el6.x86_64 already installed and latest versionPackage clickhouse-compressor-1.1.54198-3.el6.x86_64 already installed and latest versionResolving Dependencies--> Running transaction check---> Package clickhouse-client.x86_64 0:1.1.54198-3.el6 will be installed---> Package clickhouse-server.x86_64 0:1.1.54198-3.el6 will be installed--> Processing Dependency: libbfd-2.20.51.0.2-5.44.el6.so()(64bit) for package: clickhouse-server-1.1.54198-3.el6.x86_64--> Finished Dependency ResolutionError: Package: clickhouse-server-1.1.54198-3.el6.x86_64 (clickhouse)
           Requires: libbfd-2.20.51.0.2-5.44.el6.so()(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

Ubuntu:

root@GlonHo:~# grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported"SSE 4.2 supported

root@GlonHo:/etc/apt/sources.list.d# vim clickhouse.list
deb http://repo.yandex.ru/clickhouse/trusty stable main

root@GlonHo:~# apt-key adv --keyserver keyserver.ubuntu.com --recv E0C56BD4
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.IoJhY8ePkd --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv E0C56BD4
gpg: requesting key E0C56BD4 from hkp server keyserver.ubuntu.com
gpg: key E0C56BD4: public key "ClickHouse Repository Key <milovidov@yandex-team.ru>" imported
gpg: Total number processed: 1gpg:               imported: 1  (RSA: 1)
root@GlonHo:~# apt-get updateHit http://security.ubuntu.com trusty-security InRelease                     
Ign http://archive.ubuntu.com trusty InRelease                                 
...    
Reading package lists... Done
root@GlonHo:~# root@GlonHo:~# apt-get install clickhouse-client clickhouse-server-commonReading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  acl at-spi2-core colord dconf-gsettings-backend dconf-service fontconfig
  fontconfig-config fonts-dejavu-core hicolor-icon-theme libasound2
  libasound2-data libatk-bridge2.0-0 libatk1.0-0 libatk1.0-data libatspi2.0-0
  libavahi-client3 libavahi-common-data libavahi-common3 libcairo-gobject2
  libcairo2 libcanberra-gtk3-0 libcanberra-gtk3-module libcanberra0 libcolord1
  libcolorhug1 libcups2 libdatrie1 libdconf1 libdrm-intel1 libdrm-nouveau2
  libdrm-radeon1 libexif12 libfontconfig1 libfontenc1 libgd3
  libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgl1-mesa-dri libgl1-mesa-glx
  libglapi-mesa libgphoto2-6 libgphoto2-l10n libgphoto2-port10 libgraphite2-3
  libgtk-3-0 libgtk-3-bin libgtk-3-common libgudev-1.0-0 libgusb2
  libharfbuzz0b libice6 libieee1284-3 libjasper1 libjbig0 libjpeg-turbo8
  libjpeg8 liblcms2-2 libllvm3.4 libltdl7 libnotify-bin libnotify4 libogg0
  libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpciaccess0
  libpixman-1-0 libsane libsane-common libsm6 libtdb1 libthai-data libthai0
  libtiff5 libtxc-dxtn-s2tc0 libv4l-0 libv4lconvert0 libvorbis0a
  libvorbisfile3 libvpx1 libwayland-client0 libwayland-cursor0 libx11-xcb1
  libxaw7 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0
  libxcb-render0 libxcb-shm0 libxcb-sync1 libxcomposite1 libxcursor1
  libxdamage1 libxfixes3 libxfont1 libxi6 libxinerama1 libxkbcommon0
  libxkbfile1 libxmu6 libxpm4 libxrandr2 libxrender1 libxshmfence1 libxt6
  libxtst6 libxxf86vm1 notification-daemon sound-theme-freedesktop x11-common
  x11-xkb-utils xfonts-base xfonts-encodings xfonts-utils xserver-common
  xserver-xorg-core
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  clickhouse-server-base
The following NEW packages will be installed:
  clickhouse-client clickhouse-server-base clickhouse-server-common0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 198 MB of archives.
After this operation, 632 MB of additional disk space will be used.
Do you want to continue? [Y/n] yGet:1 http://repo.yandex.ru/clickhouse/trusty/ stable/main clickhouse-server-base amd64 1.1.54198 [198 MB]
Get:2 http://repo.yandex.ru/clickhouse/trusty/ stable/main clickhouse-client amd64 1.1.54198 [2,674 B]
Get:3 http://repo.yandex.ru/clickhouse/trusty/ stable/main clickhouse-server-common amd64 1.1.54198 [7,578 B]
Fetched 198 MB in 18min 7s (182 kB/s)                                          
Selecting previously unselected package clickhouse-server-base.
(Reading database ... 62852 files and directories currently installed.)
Preparing to unpack .../clickhouse-server-base_1.1.54198_amd64.deb ...
Unpacking clickhouse-server-base (1.1.54198) ...
Selecting previously unselected package clickhouse-client.
Preparing to unpack .../clickhouse-client_1.1.54198_amd64.deb ...
Unpacking clickhouse-client (1.1.54198) ...
Selecting previously unselected package clickhouse-server-common.
Preparing to unpack .../clickhouse-server-common_1.1.54198_amd64.deb ...
Unpacking clickhouse-server-common (1.1.54198) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up clickhouse-server-base (1.1.54198) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up clickhouse-client (1.1.54198) ...
Setting up clickhouse-server-common (1.1.54198) ...
root@GlonHo:~# root@GlonHo:~# topTasks:  90 total,   2 running,  88 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.2 sy,  0.0 ni, 99.8 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:   2049856 total,  1147260 used,   902596 free,    16004 buffers
KiB Swap:        0 total,        0 used,        0 free.   960556 cached Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                                                                 
 1262 root      20   0  112712  34552   1112 S   0.0  1.7   0:00.00 ruby                                                                                                                    
 1196 root      20   0  182364  34428   2728 S   0.0  1.7   0:00.77 puppet                                                                                                                  
 **2368 clickho+  20   0  241336  12524   3504 S   0.0  0.6   0:00.04 clickhouse-serv**                                                                                                         
 1973 root      20   0  107720   4216   3220 S   0.0  0.2   0:00.02 sshd      

root@GlonHo:~# ls /var/log/clickhouse-server/clickhouse-server.err.log  clickhouse-server.log  stderr  stdout

root@GlonHo:~# cat /var/log/clickhouse-server/clickhouse-server.err.log 2017.04.24 09:30:03.783101 [ 1 ] <Warning> ConfigProcessor: Include not found: networks2017.04.24 09:30:03.783125 [ 1 ] <Warning> ConfigProcessor: Include not found: networks2017.04.24 09:30:05.803298 [ 2 ] <Warning> ConfigProcessor: Include not found: clickhouse_remote_servers2017.04.24 09:30:05.803353 [ 2 ] <Warning> ConfigProcessor: Include not found: clickhouse_compression
root@GlonHo:~# root@GlonHo:~# cat /var/log/clickhouse-server/clickhouse-server.log 2017.04.24 09:30:03.708578 [ 1 ] <Information> : Starting daemon with revision 541982017.04.24 09:30:03.781176 [ 1 ] <Information> Application: starting up2017.04.24 09:30:03.781650 [ 1 ] <Debug> Application: rlimit on number of file descriptors is 2621442017.04.24 09:30:03.781664 [ 1 ] <Debug> Application: Initializing DateLUT.2017.04.24 09:30:03.781670 [ 1 ] <Trace> Application: Initialized DateLUT with time zone `UTC'.
2017.04.24 09:30:03.782226 [ 1 ] <Debug> Application: Configuration parameter 'interserver_http_host' doesn't exist or exists and empty. Will use 'ubuntu' as replica host.
2017.04.24 09:30:03.782338 [ 1 ] <Debug> ConfigReloader: Loading config `/etc/clickhouse-server/users.xml'
2017.04.24 09:30:03.783093 [ 1 ] <Warning> ConfigProcessor: Include not found: networks
2017.04.24 09:30:03.783121 [ 1 ] <Warning> ConfigProcessor: Include not found: networks
2017.04.24 09:30:03.783472 [ 1 ] <Information> Application: Loading metadata.
2017.04.24 09:30:03.783610 [ 1 ] <Information> DatabaseOrdinary (default): Total 0 tables.
2017.04.24 09:30:03.783734 [ 1 ] <Debug> Application: Loaded metadata.
2017.04.24 09:30:03.783848 [ 1 ] <Information> DatabaseOrdinary (system): Total 0 tables.
2017.04.24 09:30:03.784376 [ 1 ] <Information> Application: Listening http://[::1]:8123
2017.04.24 09:30:03.784420 [ 1 ] <Information> Application: Listening tcp: [::1]:9000
2017.04.24 09:30:03.784448 [ 1 ] <Information> Application: Listening interserver: [::1]:9009
2017.04.24 09:30:03.784473 [ 1 ] <Information> Application: Listening http://127.0.0.1:8123
2017.04.24 09:30:03.784491 [ 1 ] <Information> Application: Listening tcp: 127.0.0.1:9000
2017.04.24 09:30:03.784507 [ 1 ] <Information> Application: Listening interserver: 127.0.0.1:9009
2017.04.24 09:30:03.784621 [ 1 ] <Information> Application: Ready for connections.
2017.04.24 09:30:05.801608 [ 2 ] <Debug> ConfigReloader: Loading config `/etc/clickhouse-server/config.xml'2017.04.24 09:30:05.803274 [ 2 ] <Warning> ConfigProcessor: Include not found: clickhouse_remote_servers2017.04.24 09:30:05.803348 [ 2 ] <Warning> ConfigProcessor: Include not found: clickhouse_compression


root@GlonHo:~# cat /var/log/clickhouse-server/stderr Should logs to /var/log/clickhouse-server/clickhouse-server.logShould error logs to /var/log/clickhouse-server/clickhouse-server.err.logroot@GlonHo:~# clickhouse-clientClickHouse client version 1.1.54198.
Connecting to localhost:9000.
Connected to ClickHouse server version 1.1.54198.

:) 
:) select 1SELECT 1┌─1─┐
│ 1 │
└───┘1 rows in set. Elapsed: 0.023 sec. 

:) 
:) select now()

SELECT now()

┌───────────────now()─┐
│ 2017-04-24 09:37:31 │
└─────────────────────┘1 rows in set. Elapsed: 0.005 sec. 

:) 
:) Bye. (CTRL + d 退出客戶端)

root@GlonHo:~# service clickhouse-server stopStop clickhouse-server service: DONE

日志變化:

root@GlonHo:~# tail -f /var/log/clickhouse-server/clickhouse-server.log2017.04.24 09:36:59.286669 [ 3 ] <Trace> TCPConnectionFactory: TCP Request. Address: 127.0.0.1:369422017.04.24 09:36:59.288258 [ 3 ] <Debug> TCPHandler: Connected ClickHouse client version 1.1.54198, user: default.2017.04.24 09:37:15.669268 [ 3 ] <Debug> executeQuery: (from 127.0.0.1:36942) select 12017.04.24 09:37:15.678877 [ 3 ] <Trace> InterpreterSelectQuery: FetchColumns -> Complete2017.04.24 09:37:15.679000 [ 3 ] <Debug> executeQuery: Query pipeline:Expression
 Expression
  One2017.04.24 09:37:15.679459 [ 3 ] <Information> executeQuery: Read 1 rows, 1.00 B in 0.010 sec., 98 rows/sec., 98.89 B/sec.2017.04.24 09:37:15.679521 [ 3 ] <Debug> MemoryTracker: Peak memory usage (for query): 1.00 MiB.2017.04.24 09:37:15.679541 [ 3 ] <Debug> MemoryTracker: Peak memory usage (for user): 1.00 MiB.2017.04.24 09:37:15.679548 [ 3 ] <Debug> MemoryTracker: Peak memory usage (total): 1.00 MiB.2017.04.24 09:37:15.679559 [ 3 ] <Information> TCPHandler: Processed in 0.011 sec.2017.04.24 09:37:31.497405 [ 3 ] <Debug> executeQuery: (from 127.0.0.1:36942) select now()2017.04.24 09:37:31.497653 [ 3 ] <Trace> InterpreterSelectQuery: FetchColumns -> Complete2017.04.24 09:37:31.497976 [ 3 ] <Debug> executeQuery: Query pipeline:Expression
 Expression
  One2017.04.24 09:37:31.500776 [ 3 ] <Information> executeQuery: Read 1 rows, 1.00 B in 0.003 sec., 313 rows/sec., 313.78 B/sec.2017.04.24 09:37:31.500856 [ 3 ] <Debug> MemoryTracker: Peak memory usage (for query): 1.00 MiB.2017.04.24 09:37:31.500872 [ 3 ] <Debug> MemoryTracker: Peak memory usage (for user): 1.00 MiB.2017.04.24 09:37:31.500880 [ 3 ] <Debug> MemoryTracker: Peak memory usage (total): 1.00 MiB.2017.04.24 09:37:31.500893 [ 3 ] <Information> TCPHandler: Processed in 0.004 sec.2017.04.24 10:04:11.313863 [ 3 ] <Information> TCPHandler: Done processing connection.2017.04.24 10:04:36.359834 [ 4 ] <Information> Application: Received termination signal (Terminated)2017.04.24 10:04:36.359978 [ 1 ] <Debug> Application: Received termination signal.2017.04.24 10:04:36.360021 [ 1 ] <Debug> Application: Waiting for current connections to close.2017.04.24 10:04:37.000043 [ 1 ] <Debug> Application: Closed all connections.2017.04.24 10:04:37.004456 [ 1 ] <Information> Application: Shutting down storages.2017.04.24 10:04:37.005499 [ 1 ] <Debug> Application: Shutted down storages.2017.04.24 10:04:37.010125 [ 1 ] <Debug> Application: Destroyed global context.2017.04.24 10:04:37.010483 [ 1 ] <Information> Application: shutting down2017.04.24 10:04:37.011206 [ 1 ] <Debug> Application: Uninitializing subsystem: Logging Subsystem2017.04.24 10:04:37.011572 [ 4 ] <Information> BaseDaemon: Stop SignalListener thread

作者:GlonHo

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。

網(wǎng)頁標(biāo)題:ClickHouse快速入門-創(chuàng)新互聯(lián)
本文網(wǎng)址:http://bm7419.com/article22/dgodcc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供Google網(wǎng)站收錄、ChatGPT、虛擬主機(jī)、建站公司自適應(yīng)網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

h5響應(yīng)式網(wǎng)站建設(shè)