一.单机版
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv E0C56BD4 # optional
echo "deb http://repo.yandex.ru/clickhouse/deb/stable/ main/" | sudo tee /etc/apt/sources.list.d/clickhouse.list
sudo apt-get update
sudo apt-get install -y clickhouse-server clickhouse-client
sudo service clickhouse-server start
clickhouse-client
二.集群版
1.按照单机版的模式分别在每台机器上安装
2.修改配置文件
/etc/metrika.xml
<yandex>
<clickhouse_remote_servers>
<perftest_3shards_1replicas>
<shard>
<internal_replication>true</internal_replication>
<replica>
<host>isec-hdp01</host>
<port>9000</port>
</replica>
</shard>
<shard>
<internal_replication>true</internal_replication>
<replica>
<host>isec-hdp02</host>
<port>9000</port>
</replica>
</shard>
<shard>
<internal_replication>true</internal_replication>
<replica>
<host>isec-hdp03</host>
<port>9000</port>
</replica>
</shard>
</perftest_3shards_1replicas>
</clickhouse_remote_servers>
<zookeeper-servers>
<node index="1">
<host>192.168.121.41</host>
<port>2181</port>
</node>
<node index="2">
<host>192.168.121.42</host>
<port>2181</port>
</node>
<node index="3">
<host>192.168.121.43</host>
<port>2181</port>
</node>
</zookeeper-servers>
<macros>
<replica>192.168.121.41</replica>
</macros>
/etc/clickhouse-server/config.xml 70行左右
<listen_host>::1</listen_host>
<listen_host>isec-hdp01</listen_host>
/etc/clickhouse-server/users.xml 最大查询内存
<max_memory_usage>50000000000</max_memory_usage>
3.启动
service clickhouse-server stop
service clickhouse-server start
clickhouse-client --host 192.168.121.41 --port 9000 --multiline