Clickhouse部署文档
clickhouse部署配置
1. 手动安装
https://packages.clickhouse.com/rpm/stable/
version = '22.3.2.2-2'
clickhouse-client-{version}.noarch.rpm
clickhouse-common-static-{version}.x86_64.rpm
clickhouse-common-static-dbg-{version}.x86_64.rpm
clickhouse-server-{version}.noarch.rpm
或则
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://packages.clickhouse.com/rpm/clickhouse.repo
sudo yum install -y clickhouse-server clickhouse-client
sudo /etc/init.d/clickhouse-server start
clickhouse-client # or "clickhouse-client --password" if you set up a password.
建议手动安装 命令:
rpm -ivh *.rpm
2. 配置可远程
vim /etc/clickhouse-server/config.xml
<listen_host>::</listen_host> #可以远程访问
3. 启动服务
sudo chown -R clickhouse /var/log/clickhouse-server /etc/clickhouse-server /etc/clickhouse-client /var/lib/clickhouse
systemctl start clickhouse-server 或者 service clickhouse-server start
服务端日志的默认位置是/var/log/clickhouse-server/目录
# clickhouse-server start 有的时候不好用
4. 配置zk 配置文件
ps: 配置文件需要分发到其他节点
mkdir -p /etc/clickhouse-server/config.d
vim metrika.xml
# 配置zk信息
<?xml version="1.0"?>
<yandex>
<zookeeper-servers>
<node index="1">
<host>hadoop01</host>
<port>2181</port>
</node>
<node index="2">
<host>hadoop02</host>
<port>2181</port>
</node>
<node index="3">
<host>hadoop03</host>
<port>2181</port>
</node>
</zookeeper-servers>
</yandex>
vim /etc/clickhouse-server/config.xml
# 添加
<include_from>/etc/clickhouse-server/config.d/metrika.xml</include_from>
5. 分片副本配置
配置文件需要复制到其他节点,修改副本位置 以及宏命令配置
/etc/clickhouse-server/config.d目录下创建metrika-shard.xml文件
<yandex>
<remote_servers> <!-- 旧版本 clickhouse_remote_server -->
<duoduo_cluster> <!-- 集群名称-->
<shard> <!--集群的第一个分片-->
<internal_replication>true</internal_replication>
<!--该分片的第一个副本-->
<replica>
<host>hadoop01</host>
<port>9000</port>
</replica>
<!--该分片的第二个副本-->
<replica>
<host>hadoop02</host>
<port>9000</port>
</replica>
</shard>
<shard> <!--集群的第二个分片-->
<internal_replication>true</internal_replication>
<replica> <!--该分片的第一个副本-->
<host>hadoop03</host>
<port>9000</port>
</replica>
</shard>
</duoduo_cluster>
</remote_servers>
<zookeeper-servers>
<node index="1">
<host>hadoop01</host>
<port>2181</port>
</node>
<node index="2">
<host>hadoop02</host>
<port>2181</port>
</node>
<node index="3">
<host>hadoop03</host>
<port>2181</port>
</node>
</zookeeper-servers>
<!--宏命令-->
<macros>
<shard>01</shard> <!--不同机器放的分片数不一样-->
<replica>rep_1_1</replica> <!--不同机器放的副本数不一样-->
</macros>
</yandex>
6. 创建mergetree
on cluseter * 就会在所有的节点上建立 本地表
7. 创建分布式表
8. 其他相关的配置调优
8.1 cpu
8.2 内存
本文链接:
/archives/1709605091387
版权声明:
本站所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自
DTL!
喜欢就支持一下吧
打赏
微信
支付宝