Clickhouse stand-alone deployment
-
Upload the rpm package to the /opt/lagou/software/clickhouse directory
-
Execute the command in the directory where the rpm is located
rpm -ivh *.rpm
-
Execute start command
sudo -u clickhouse clickhouse-server --config-file=/etc/clickhouse-server/config.xml
or
/etc/init.d/clickhouse-server start
Show successful startup:
- Client login is successful
clickhouse distributed deployment
- Follow the above steps to install the rpm package on the linux121 and linux123 machines
- Create a cluster configuration file
vim /etc/metrika.xml
<yandex>
<clickhouse_remote_servers>//自定义配置文件名字
<perftest_3shards_1replicas> //自定义集群名字
<shard>
<internal_replication>true</internal_replication>
<replica>
<host>linux121</host>
<port>9000</port>
</replica>
</shard>
<shard>
<replica>
<internal_replication>true</internal_replication>
<host>linux122</host>
<port>9000</port>
</replica>
</shard>
<shard>
<internal_replication>true</internal_replication>
<replica>
<host>linux123</host>
<port>9000</port>
</replica>
</shard>
</perftest_3shards_1replicas>
</clickhouse_remote_servers>
<!--zookeeper相关配置-->
<zookeeper-servers>
<node index="1">
<host>linux121</host>
<port>2181</port>
</node>
<node index="2">
<host>linux122</host>
<port>2181</port>
</node>
<node index="3">
<host>linux123</host>
<port>2181</port>
</node>
</zookeeper-servers>
<macros>
<replica>linux121</replica>
</macros>
<networks>
<ip>::/0</ip>
</networks>
<clickhouse_compression>
<case>
<min_part_size>10000000000</min_part_size>
<min_part_size_ratio>0.01</min_part_size_ratio>
<method>lz4</method>
</case>
</clickhouse_compression>
</yandex>
- Bind the new configuration file to /etc/clickhouse-server/config.xml
<include_from>/etc/metrika.xml</include_from>
- Start the zookeeper of the cluster configuration
- Restart the system
clickhouse-server --config-file=/etc/clickhouse-server/config.xml
- client verification
SELECT *FROM system.clusters