一、ClickHouse安装方式:
- 源码编译安装
- Docker安装
- RPM包安装
为了方便使用,一般采用RPM包方式安装,其他两种方式这里不做说明。
二、下载安装包
官方没有提供rpm包,但是Altinity第三方公司提供了。
地址:https://packagecloud.io/altinity/clickhouse
三、配置文件
安装好rmp包后,默认配置文件在/etc/clickhouse-server/目录下,主要涉及以下3种配置文件,也可以自定义配置文件位置,如果修改了目录记得连带修改启动脚本。
默认启动脚本,注意,这个名字虽然叫server,其实是个shell脚本vi /etc/init.d/clickhouse-server
12 CLICKHOUSE_USER=clickhouse
13 CLICKHOUSE_GROUP=${CLICKHOUSE_USER}
14 SHELL=/bin/bash
15 PROGRAM=clickhouse-server
16 GENERIC_PROGRAM=clickhouse
17 EXTRACT_FROM_CONFIG=${GENERIC_PROGRAM}-extract-from-config
18 SYSCONFDIR=/data/clickhouse
19 CLICKHOUSE_LOGDIR=/data/clickhouse/logs
20 CLICKHOUSE_LOGDIR_USER=root
21 CLICKHOUSE_DATADIR_OLD=/data/clickhouse
22 LOCALSTATEDIR=/data/clickhouse/lock
23 BINDIR=/usr/bin
24 CLICKHOUSE_CRONFILE=/etc/cron.d/clickhouse-server
25 CLICKHOUSE_CONFIG=$SYSCONFDIR/config.xml
26 LOCKFILE=$LOCALSTATEDIR/$PROGRAM
27 RETVAL=0
29 CLICKHOUSE_PIDDIR=/var/run/$PROGRAM
30 CLICKHOUSE_PIDFILE="$CLICKHOUSE_PIDDIR/$PROGRAM
- config.xml 全局信息配置文件
<?xml version=""1.0""?>
<yandex>
<!--日志-->
<logger>
<level>error</level>
<log>/data/clickhouse/logs/clickhouse.log</log>
<errorlog>/data/clickhouse/logs/error.log</errorlog>
<size>500M</size>
<count>5</count>
</logger>
<!--本地节点信息-->
<http_port>8123</http_port>
<tcp_port>9000</tcp_port>
<interserver_http_port>9009</interserver_http_port>
<interserver_http_host>本机IP</interserver_http_host> <!--本机域名或IP-->
<!--本地配置-->
<listen_host>0.0.0.0</listen_host>
<max_connections>4096</max_connections>
<receive_timeout>800</receive_timeout>
<send_timeout>800</send_timeout>
<keep_alive_timeout>300</keep_alive_timeout>
<max_concurrent_queries>1000</max_concurrent_queries>
<uncompressed_cache_size>8589934592</uncompressed_cache_size>
<mark_cache_size>5368709120</mark_cache_size>
<path>/data/clickhouse/</path>
<tmp_path>/data/clickhouse/tmp/</tmp_path>
<users_config>users.xml</users_config>
<default_profile>default</default_profile>
<log_queries>1</log_queries>
<default_database>default</default_database>
<!--集群相关配置-->
<remote_servers incl=""clickhouse_remote_servers"" />
<zookeeper incl=""zookeeper-servers"" optional=""true"" />
<macros incl=""macros"" optional=""true"" />
<builtin_dictionaries_reload_interval>3600</builtin_dictionaries_reload_interval>
<max_session_timeout>3600</max_session_timeout>
<default_session_timeout>300</default_session_timeout>
<max_table_size_to_drop>0</max_table_size_to_drop>
<merge_tree>
<parts_to_delay_insert>300<