部署日期 参与人员 部署目标 版本
Mon 19 Sep 2022 @devops 部署一套本地化的分布式持久存储的Clickhouse集群 v0.1
集群信息安装Clickhouse服务sudo apt-get updatesudo apt-get install -y apt-transport-https ca-certificates dirmngrsudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 8919F6BD2B48D754echo "deb https://packages.clickhouse.com/deb stable main" | sudo tee /etc/apt/sources.list.d/clickhouse.listsudo apt-get updateapt-cache madison clickhouse-server | head -n5sudo apt-get install -y clickhouse-server=22.8.5.29 clickhouse-client=22.8.5.29# 修改clickhouse的家目录以及相关属主组mkdir /home/clickhousechown -R clickhouse.clickhouse /home/clickhouseusermod -d /home/clickhouse clickhouse# 准备clickhouse的数据存储目录mkdir /data/clickhouse_bigdatachown -R clickhouse.clickhouse /data/clickhouse_bigdata# 在clickhouse的默认配置文件中修改clickhouse的数据目录sed -e 's#/var/lib/clickhouse#/data/clickhouse_bigdata#g' /etc/clickhouse-server/config.xml |grep -i '/data/clickhouse_bigdata'sed -i 's#/var/lib/clickhouse#/data/clickhouse_bigdata#g' /etc/clickhouse-server/config.xml |grep -i '/data/clickhouse_bigdata'# sudo service clickhouse-server start# clickhouse-client # or "clickhouse-client --password" if you've set up a password.配置节点域名解析
⚠️ 每个节点都需要配置
[x] 本地host配置cat >> /etc/hosts << EOF10.0.10.195 cknode1.devopsman.cn bigdata1 10.0.10.194 cknode2.devopsman.cn bigdata210.0.10.196 cknode3.devopsman.cn bigdata3EOFDNS解析平台上进行解析ClickHouse 的集群配置配置切片和副本remote-servers.xml
bigdata /clickhouse/tables/{cluster}/{shard}/{database}/{table} {replica} cknode1.devopsman.cn
9000 cknode2.devopsman.cn
9000 cknode3.devopsman.cn
9000 配置集群需要的zookeeper信息zookeeper.xml
zookeeper-1.devopsman.cn
2181 zookeeper-2.devopsman.cn
2181 zookeeper-3.devopsman.cn
2181 30000 10000
/clickhouse/bigdata/task_queue/ddl 宏macros.xml
bigdata bigdata 2 1 监听配置信息listen.xml
1 0.0.0.0 127.0.0.1ClickHouse 账号认证授权管理员账号:clickhouse_manager.xml
1 10.0.10.0/24 127.0.0.1 ::/0
ff3ebe0b384ba70a48ef866d0e4e8bfcc3104709f3858d95e51111111110e2e683cbb3da4
clickhouse_manager default
1 1 10
1 维护账号: clickhouse_operator.xml
10.0.10.0/24 127.0.0.1 ::/0
716b36073a90c6fe1d445ac1af85f4777c5b7a155cea35911111111111111
clickhouse_operator default
1 1 10
在所有的配置文件配置完成后,切记要修改xml文件的所属属性
chown clickhouse.clickhouse /etc/clickhouse-server/config.d/*.xml /etc/clickhouse-server/users.d/*.xml
FQA安装日志Creating clickhouse group if it does not exist.groupadd -r clickhouseCreating clickhouse user if it does not exist.useradd -r --shell /bin/false --home-dir /nonexistent -g clickhouse clickhouseWill set ulimits for clickhouse user in /etc/security/limits.d/clickhouse.conf.Creating config directory /etc/clickhouse-server/config.d that is used for tweaks of main server configuration.Creating config directory /etc/clickhouse-server/users.d that is used for tweaks of users configuration.Config file /etc/clickhouse-server/config.xml already exists, will keep it and extract path info from it./etc/clickhouse-server/config.xml has /var/lib/clickhouse/ as data path./etc/clickhouse-server/config.xml has /var/log/clickhouse-server/ as log path.Users config file /etc/clickhouse-server/users.xml already exists, will keep it and extract users info from it.Creating log directory /var/log/clickhouse-server/.Creating data directory /var/lib/clickhouse/.Creating pid directory /var/run/clickhouse-server.chown -R clickhouse:clickhouse '/var/log/clickhouse-server/'chown -R clickhouse:clickhouse '/var/run/clickhouse-server'chown clickhouse:clickhouse '/var/lib/clickhouse/'groupadd -r clickhouse-bridgeuseradd -r --shell /bin/false --home-dir /nonexistent -g clickhouse-bridge clickhouse-bridgechown -R clickhouse-bridge:clickhouse-bridge '/usr/bin/clickhouse-odbc-bridge'chown -R clickhouse-bridge:clickhouse-bridge '/usr/bin/clickhouse-library-bridge'Enter password for default user: # 》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》此处是配置default的密码Password for default user is saved in file /etc/clickhouse-server/users.d/default-password.xml.Setting capabilities for clickhouse binary. This is optional.chown -R clickhouse:clickhouse '/etc/clickhouse-server'ClickHouse has been successfully installed.Start clickhouse-server with:sudo clickhouse startStart clickhouse-client with:clickhouse-client --passwordSynchronizing state of clickhouse-server.service with SysV service script with /lib/systemd/systemd-sysv-install.Executing: /lib/systemd/systemd-sysv-install enable clickhouse-serverCreated symlink /etc/systemd/system/multi-user.target.wants/clickhouse-server.service → /lib/systemd/system/clickhouse-server.service.Setting up clickhouse-client (22.8.5.29) ...Processing triggers for systemd (245.4-4ubuntu3.13) ...服务无法启动,通过debug方式启动clickhouse服务查看debug日志
sudo -u clickhouse clickhouse-server --config-file=/etc/clickhouse-server/config.xml参考信息ClickHouse分布式集群部署[2]ClickHouse实例部署[3]ClickHouse配置文件[4]大数据ClickHouse进阶(五):副本与分片[5]资料参考
[1]
clickhouse-v22.8.5.29-lts: https://github.com/ClickHouse/ClickHouse/releases/tag/v22.8.5.29-lts
[2]
ClickHouse分布式集群部署: https://clickhouse.com/docs/zh/getting-started/tutorial#cluster-deployment
[3]
单机部署: https://clickhouse.com/docs/zh/getting-started/install/
[4]
ClickHouse配置文件: https://clickhouse.com/docs/zh/operations/configuration-files/
[5]
大数据ClickHouse进阶: https://bbs.huaweicloud.com/blogs/375043#:~:text=例如一个Clic,个分片设置副本。
花粉社群VIP加油站
猜你喜欢