安装部署
Centos、RedHat
sudo yum install yum-utils
sudo rpm --import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPG
sudo yum-config-manager --add-repo https://repo.clickhouse.tech/rpm/stable/x86_64
sudo yum install clickhouse-server clickhouse-client
sudo /etc/init.d/clickhouse-server start
clickhouse-client
vi /etc/security/limits.d/clickhouse.conf
clickhouse soft nofile 262144
clickhouse hard nofile 262144
vi /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
vi /etc/selinux/config
SELINUX=disabled
关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
创建目录
mkdir -p /data/clickhouse/config
chown -R clickhouse:clickhouse /data/clickhouse
mkdir -p /data/clickhouse/log/clickhouse-server
mkdir /data/clickhouse/tmp/
mkdir /data/clickhouse/format_schemas
mkdir -p /data/clickhouse/task_queue/ddl
cp /etc/clickhouse-server/config.xml /data/clickhouse/config/config.xml
cp /etc/clickhouse-server/users.xml /data/clickhouse/config/users.xml
chmod 755 config.xml
chmod 755 users.xml
ln -s /data/clickhouse/config/config.xml /etc/clickhouse-server/config.xml
config.xml
<log>/data/clickhouse/log/clickhouse-server/clickhouse-server.log</log>
<errorlog>/data/clickhouse/log/clickhouse-server/clickhouse-server.err.log</errorlog>
<!-- Path to data directory, with trailing slash. -->
<path>/data/clickhouse/data/</path>
<tmp_path>/data/clickhouse/tmp/</tmp_path>
<format_schema_path>/data/clickhouse/format_schemas/</format_schema_path>
<remote_servers incl="clickhouse_remote_servers" >
<perftest_2shards_1replicas>
<!-- 数据分片1 -->
<shard>
<internal_replication>true</internal_replication>
<replica>
<host>clickhouse1</host>
<port>9000</port>
</replica>
<replica>
<host>clickhouse2</host>
<port>9000</port>
</replica>
</shard>
<!-- 数据分片2 -->
<shard>
<internal_replication>true</internal_replication>
<replica>
<host>clickhouse3</host>
<port>9000</port>
</replica>
<replica>
<host>clickhouse4</host>
<port>9000</port>
</replica>
</shard>
</perftest_2shards_1replicas>
</remote_servers>
<zookeeper>
<node>
<host>clickhouse2</host>
<port>2181</port>
</node>
<node>
<host>clickhouse3</host>
<port>2181</port>
</node>
<node>
<host>clickhouse4</host>
<port>2181</port>
</node>
</zookeeper>
<macros>
<shard>shard1</shard>
<replica>replica1</replica>
</macros>
<distributed_ddl>
<!-- Path in ZooKeeper to queue with DDL queries -->
<path>/data/clickhouse/task_queue/ddl</path>