clickhouse 单机体验

这里使用的是clickhouse 18.6.0版本,运行环境为CentOS 7.4

官方提供的软件版本支持docker和deb包,官方推荐使用Ubuntu操作系统,但是在国内服务器多是CentOS。

1.软件RPM下载:

#cat clickhouse_download.sh
wget --content-disposition https://packagecloud.io/Altinity/clickhouse/packages/el/7/clickhouse-server-common-18.6.0-1.el7.x86_64.rpm/download.rpm
wget --content-disposition https://packagecloud.io/Altinity/clickhouse/packages/el/7/clickhouse-test-18.6.0-1.el7.x86_64.rpm/download.rpm
wget --content-disposition https://packagecloud.io/Altinity/clickhouse/packages/el/7/clickhouse-server-18.6.0-1.el7.x86_64.rpm/download.rpm
wget --content-disposition https://packagecloud.io/Altinity/clickhouse/packages/el/7/clickhouse-common-static-18.6.0-1.el7.x86_64.rpm/download.rpm
wget --content-disposition https://packagecloud.io/Altinity/clickhouse/packages/el/7/clickhouse-client-18.6.0-1.el7.x86_64.rpm/download.rpm
wget --content-disposition https://packagecloud.io/Altinity/clickhouse/packages/el/7/clickhouse-debuginfo-18.6.0-1.el7.x86_64.rpm/download.rpm

2.软件安装需要依赖2个额外的包 libtool-ltdl和unixODBC,推荐使用yum 安装:

查看需要安装的软件包:
#ls -l
clickhouse-client-18.6.0-1.el7.x86_64.rpm         
clickhouse-server-18.6.0-1.el7.x86_64.rpm         
clickhouse-test-18.6.0-1.el7.x86_64.rpm
clickhouse-common-static-18.6.0-1.el7.x86_64.rpm  
clickhouse-server-common-18.6.0-1.el7.x86_64.rpm
#yum -y localinstall clickhouse-*.rpm

...
Dependencies Resolved

==========================================================================================================================================================================================
 Package                                       Arch                        Version                               Repository                                                          Size
==========================================================================================================================================================================================
Installing:
 clickhouse-client                             x86_64                      18.6.0-1.el7                          /clickhouse-client-18.6.0-1.el7.x86_64                             1.5 k
 clickhouse-common-static                      x86_64                      18.6.0-1.el7                          /clickhouse-common-static-18.6.0-1.el7.x86_64                       90 M
 clickhouse-server                             x86_64                      18.6.0-1.el7                          /clickhouse-server-18.6.0-1.el7.x86_64                              11 k
 clickhouse-server-common                      x86_64                      18.6.0-1.el7                          /clickhouse-server-common-18.6.0-1.el7.x86_64                       20 k
 clickhouse-test                               x86_64                      18.6.0-1.el7                          /clickhouse-test-18.6.0-1.el7.x86_64                               2.4 M
Installing for dependencies:
 libicu                                        x86_64                      50.1.2-15.el7                         base                                                               6.9 M
 libtool-ltdl                                  x86_64                      2.4.2-22.el7_3                        base                                                                49 k
 unixODBC                                      x86_64                      2.3.1-11.el7                          base                                                               413 k

Transaction Summary
==========================================================================================================================================================================================
Install  5 Packages (+3 Dependent packages)

...

3.验证软件包的安装:

# yum list installed 'clickhouse*'
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Installed Packages
clickhouse-client.x86_64                                 18.6.0-1.el7                          installed
clickhouse-common-static.x86_64                          18.6.0-1.el7                          installed
clickhouse-server.x86_64                                 18.6.0-1.el7                          installed
clickhouse-server-common.x86_64                          18.6.0-1.el7                          installed
clickhouse-test.x86_64                                   18.6.0-1.el7                          installed
或者:
# rpm  -qa | grep -i clickhouse
clickhouse-server-common-18.6.0-1.el7.x86_64
clickhouse-common-static-18.6.0-1.el7.x86_64
clickhouse-server-18.6.0-1.el7.x86_64
clickhouse-client-18.6.0-1.el7.x86_64
clickhouse-test-18.6.0-1.el7.x86_64

4.软件的启动和登录,基本的查询:

# sudo /etc/init.d/clickhouse-server restart
Start clickhouse-server service: Path to data directory in 
/etc/clickhouse-server/config.xml: /var/lib/clickhouse/
DONE
# /etc/init.d/clickhouse-server 
Usage: /etc/init.d/clickhouse-server {start|stop|status|restart|forcestop|forcerestart|reload|condstart|condstop|condrestart|condreload|initdb}

# /etc/init.d/clickhouse-server status
clickhouse-server service is running

--登录:
# clickhouse-client 
ClickHouse client version 18.6.0.
Connecting to localhost:9000 as user default.
Connected to ClickHouse server version 18.6.0 revision 54401.

node1 :) 
node1 :) exit
Bye.

node1 :) show databases;

SHOW DATABASES

┌─name────┐
│ default │
│ system  │
└─────────┘

2 rows in set. Elapsed: 0.015 sec. 
node1 :) select now();

SELECT now()

┌───────────────now()─┐
│ 2018-08-10 17:07:43 │
└─────────────────────┘

1 rows in set. Elapsed: 0.008 sec. 


5.配置文件:

# rpm -ql clickhouse-server-common
/etc/clickhouse-server/config.xml
/etc/clickhouse-server/users.xml

# rpm -ql clickhouse-server
/etc/cron.d/clickhouse-server
/etc/init.d/clickhouse-server
/etc/security/limits.d/clickhouse.conf
/usr/bin/clickhouse-clang
/usr/bin/clickhouse-copier
/usr/bin/clickhouse-format
/usr/bin/clickhouse-lld
/usr/bin/clickhouse-obfuscator
/usr/bin/clickhouse-report
/usr/bin/clickhouse-server
/usr/share/clickhouse
/usr/share/clickhouse/bin
/usr/share/clickhouse/headers

# rpm -ql clickhouse-common-static
/etc/security/limits.d/clickhouse.conf
/usr/bin/clickhouse
/usr/share/clickhouse
/usr/share/clickhouse/bin
/usr/share/clickhouse/headers


# rpm -ql clickhouse-client
/etc/clickhouse-client/config.xml
/usr/bin/clickhouse-benchmark
/usr/bin/clickhouse-client
/usr/bin/clickhouse-compressor
/usr/bin/clickhouse-extract-from-config
/usr/bin/clickhouse-local


#rpm -ql clickhouse-test | wc -l
1631
clickhouse-test则提供了大量的测试脚本。

 

你可能感兴趣的:(Clickhouse)