[关闭]
@zhangyy 2021-09-01T16:49:10.000000Z 字数 2712 阅读 144

clickhouse 的集群配置

ClickHouse系列



一: clickhouse 集群配置:

1.1 系统初始化:

  1. 环境初始化参考单机版环境初始化:
  2. 系统: CentOS7.9x64
  3. cat /etc/hosts
  4. ----
  5. 192.168.100.11 node01.flyfish.cn
  6. 192.168.100.12 node02.flyfish.cn
  7. 192.168.100.13 node03.flyfish.cn
  8. 192.168.100.14 node04.flyfish.cn
  9. 192.168.100.15 node05.flyfish.cn
  10. 192.168.100.16 node06.flyfish.cn
  11. 192.168.100.17 node07.flyfish.cn
  12. 192.168.100.18 node08.flyfish.cn
  13. ----
  14. 本次安装:使用 前面6台虚拟机

  1. 集群配置好ansible
  2. vim /etc/ansible/hosts
  3. ---
  4. [clickhouse_all]
  5. 192.168.100.11
  6. 192.168.100.12
  7. 192.168.100.13
  8. 192.168.100.14
  9. 192.168.100.15
  10. 192.168.100.16
  11. [clickhouse_node]
  12. 192.168.100.12
  13. 192.168.100.13
  14. 192.168.100.14
  15. 192.168.100.15
  16. 192.168.100.16
  17. ----
  18. ansible clickhouse_node -m ping

image_1erc2kqni7s41pski5h1oe31bhn16.png-184.8kB

image_1erc2j4s8pv61uhsk6bvghbfmp.png-150.9kB


  1. 系统初始化:
  2. ansible clickhouse_node -m copy -a "src=/root/.bash_profile dest=/root/"
  3. ansible clickhouse_node -m copy -a "src=/etc/security/limits.conf dest=/etc/security/"
  4. ansible clickhouse_node -m copy -a "src=/etc/sysctl.conf dest=/etc/"
  5. ansible clickhouse_node -m copy -a "src=/etc/rc.d/rc.local dest=/etc/rc.d/"
  6. ansible clickhouse_node -m copy -a "src=/etc/localtime dest=/etc/"

  1. 创建安装用户:
  2. groupadd -g 60001 clickhouse
  3. useradd -u 61001 -g clickhouse clickhouse
  4. chown -R clickhouse:clickhouse /clickhouse
  5. chmod -R 775 /clickhouse
  6. echo "clickhouse" | passwd --stdin clickhouse
  7. 默认启动字符界面:
  8. systemctl set-default multi-user.target

1.2 clickhouse 配置准备

  1. vim /clickhouse/etc/clickhouse-server/config.xml
  2. ----
  3. 搜索:metrika
  4. <include_from>/clickhouse/etc/clickhouse-server/config.d/metrika.xml</include_from>
  5. ----

image_1erc3plj5hq811p9n9q40rpq09.png-109.6kB

  1. vim /clickhouse/etc/clickhouse-server/config.d/metrika.xml
  2. ---
  3. <?xml version="1.0"?>
  4. <yandex>
  5. <clickhouse_remote_servers>
  6. </clickhouse_remote_servers>
  7. </yandex>
  8. ---

image_1erc3qrco17v21m0h1rtn13411pr0m.png-60.9kB

  1. ----
  2. cp /clickhouse/etc/clickhouse-server/config.d/metrika.xml /clickhouse/etc/clickhouse-server/config.d/metrika9200.xml
  3. vim /clickhouse/etc/clickhouse-server/config9200.xml
  4. ----
  5. <include_from>/clickhouse/etc/clickhouse-server/config.d/metrika9200.xml</include_from>
  6. ----

image_1erc3udjn22mc351cgu45218kt13.png-124.9kB

image_1erc3vsgr6qpkd2pp21cog1ctc1g.png-180.6kB


  1. 测试启动:
  2. 杀掉之前的节点:

image_1erc43r784jmtvk13ip1ptb1eoh1t.png-218.1kB

  1. 查看 加载文件:
  2. clickhouse-server --config=/etc/clickhouse-server/config.xml

image_1erc4fqs8dfj19dfo3malnvpc2a.png-318.1kB

  1. clickhouse-server --config=/etc/clickhouse-server/config9200.xml

image_1erc4nu5s3p1170qcqltroctf2n.png-260.5kB


  1. 打包节点:
  2. su - clickhouse
  3. cd /clickhouse
  4. tar -zcvf clickhouse.tar.gz app data data9200 etc log log9200
  5. 然后同步所有主机:
  6. scp clickhouse.tar.gz clickhouse@192.168.100.12:/clickhouse/
  7. scp clickhouse.tar.gz clickhouse@192.168.100.13:/clickhouse/
  8. scp clickhouse.tar.gz clickhouse@192.168.100.14:/clickhouse/
  9. scp clickhouse.tar.gz clickhouse@192.168.100.16:/clickhouse/
  10. su - clickhosue
  11. cd /clickhouse/
  12. tar -zxvf clickhouse.tar.gz

image_1erc52f8r1iops881uaf7ro16h734.png-110.2kB


  1. root账号授权;(全部主机执行)
  2. /clickhouse/app/clickhouse-common-static/install/doinst.sh
  3. /clickhouse/app/clickhouse-common-static-dbg/install/doinst.sh
  4. /clickhouse/app/clickhouse-server/install/doinst.sh

image_1erc6ddag13hq4tr2f91vcbf713h.png-270.2kB

image_1erc6e3io74l3sdh3j1ntg15n23u.png-220.4kB

  1. /clickhouse/app//clickhouse-client/install/doinst.sh

image_1erc6eum4f0l1cqrigf7ea79c4b.png-29.4kB

image_1erc6fmtkh7p1nth15o634c1ldk58.png-31.8kB

image_1erc6gev3vvj19sms0l591e835l.png-66.1kB


  1. 将/clickhouse 目录授权
  2. chown -R clickhouse:clickhouse /clickhouse

image_1erc6hsdgob3m2b13843jg1unb62.png-39.1kB

image_1erc6i8uvgvc1mpmjig28t1rg16f.png-44.2kB```

  1. 全部主机:
  2. cd /etc/
  3. rm -rf /etc/clickhouse-*
  4. ln -sf /clickhouse/etc/* .
  5. ls -ld /etc/click*

image_1erc6s9tf2m8m9k1ldt17dv10qc6s.png-52.6kB

image_1erc6tio61i4k1tjn1rlt1jbh1d597c.png-56kB

image_1erc6u0ddb713lt3sf1jbvka77p.png-53.2kB

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注