clickhouse运维探索之ckman

clickhouse Manager(ckman) 部署


发现一款开源的ck运维软件,今天和大家分享下. ckman官网

环境准备

  1. 关闭防火墙

    systemctl stop firewalld.service
    systemctl disable firewalld.service
    
    systemctl status firewalld.service
    

安装ckman

安装go

  1. 安装包下载地址为:https://golang.org/dl/。

     go1.17.linux-amd64.tar.gz
    
  2. 安装

    tar -C /usr/local -xzf go1.17.linux-amd64.tar.gz
    
  3. 设置环境变量

    vim /etc/profile
    #加入
    export GOROOT=/usr/local/go/
    export GOPATH=//usr/local/gopath
    export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
    #加载profile
    source /etc/profile
    

安装git

yum install -y git

安装prometheus

  1. 下载 https://github.com/prometheus/prometheus/releases/download/v2.29.2/prometheus-2.29.2.linux-amd64.tar.gz

  2. 解压

    tar -zxvf  prometheus-2.29.2.linux-amd64.tar.gz -C /home/
    mv /home/prometheus-2.29.2.linux-amd64 /home/prometheus-2.29.2
    
  3. 创建用户

groupadd prometheus
useradd -g prometheus -m -d /home/ch/prometheus/ -s /sbin/nologin prometheus
chown -R prometheus:prometheus /home/prometheus-2.29.2/
  1. 自启脚本 vim /etc/systemd/system/prometheus.service
[Unit]
Description=prometheus
After=network.target
[Service]
Type=forking
ExecStart=/home/prometheus-2.29.2/prometheus --config.file=/home/prometheus-2.29.2/prometheus.yml --storage.tsdb.path=/home/prometheus-2.29.2/data
User=prometheus
Restart=on-failure
[Install]
WantedBy=multi-user.target
chmod +x /etc/systemd/system/prometheus.servic
systemctl enable prometheus.service
  1. 启动
service prometheus.service start
  1. web页面 http://192.168.30.10:9090/

安装node_exporter

  1. 下载https://github.com/prometheus/node_exporter/releases/download/v1.2.2/node_exporter-1.2.2.linux-amd64.tar.gz

    1. 解压

      tar -zxvf node_exporter-1.2.2.linux-amd64.tar.gz -C /home
      mv /home/node_exporter-1.2.2.linux-amd64/ /home/node_exporter-1.2.2
      chown -R prometheus:prometheus /home/node_exporter-1.2.2
      
    2. vim /etc/systemd/system/node_exporter.service

      [Unit]
      Description=node_exporter
      After=network.target
      [Service]
      Type=forking
      ExecStart=/home/ch/node_exporter/node_exporter-1.2.2/node_exporter
      User=prometheus
      Restart=on-failure
      [Install]
      WantedBy=multi-user.target
      
      chmod +x /etc/systemd/system/node_exporter.service
      systemctl enable node_exporter.service
      
    3. 启动

      service node_exporter start
      
    4. web

      http://192.168.30.10:9100/metrics

安装zookeeper

  1. 下载zookeeper https://mirrors.bfsu.edu.cn/apache/zookeeper/stable/apache-zookeeper-3.6.3-bin.tar.gz

  2. 安装

    tar -zxvf apache-zookeeper-3.6.3-bin.tar.gz -C /home/
    mv /home/apache-zookeeper-3.6.3-bin/conf/zoo_sample.cfg /home/apache-zookeeper-3.6.3-bin/conf/zoo.cfg
    

    vim /home/apache-zookeeper-3.6.3-bin/conf/zoo.cfg

    dataDir=/home/zookeeper
    
    metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
    metricsProvider.httpPort=7000
    metricsProvider.exportJvmInfo=true
    admin.enableServer=true
    admin.serverPort=8080
    
  3. 脚本

    创建用户

    groupadd zookeeper
    useradd -g zookeeper -m -d /home/zookeeper/ -s /sbin/nologin zookeeper
    chown -R zookeeper:zookeeper /home/apache-zookeeper-3.6.3-bin/
    

    vim /etc/systemd/system/zookeeper.service

    [Unit]
    # 服务描述
    Description=zookeeper.service
    # 在网络服务启动后运行
    After=network.target
    [Service]
    # 指定用户
    User=zookeeper
    # 指定用户组
    Group=zookeeper
    Type=forking
    # jdk环境变量
    Environment=JAVA_HOME=/usr/local/java/jdk1.8
    # 启动命令
    ExecStart=/home/apache-zookeeper-3.6.3-bin/bin/zkServer.sh start
    # 停止命令
    ExecStop=/home/apache-zookeeper-3.6.3-bin/bin/zkServer.sh stop
    # 重载命
    ExecReload=/home/apache-zookeeper-3.6.3-bin/bin/zkServer.sh restart
    [Install]
    WantedBy=multi-user.target
    
    chmod +x /etc/systemd/system/zookeeper.service
    systemctl enable zookeeper.service
    
  4. 启动

    service zookeeper start
    

配置prometheus

vim /home/prometheus-2.29.2/prometheus.yml

scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: "prometheus"
    static_configs:
      - targets: ["192.168.30.10:9090"]
    
  - job_name: "linux"
    static_configs:
      - targets: ["192.168.30.10:9100"]
      
  - job_name: 'clickhouse'
  	scrape_interval: 10s
  	static_configs:
  		- targets: ["192.168.30.10:9363"]
  		
 - job_name: 'zookeeper'
 	scrape_interval: 10s
  	static_configs:
  	- targets: ["192.168.30.10:7000"] 		

安装ckman

编译
  1. 下载源码包 https://codeload.github.com/housepower/ckman/tar.gz/refs/tags/v2.1.2

  2. 解压 ckman-2.1.2.tar.gz

    tar -zxvf ckman-2.1.2.tar.gz -C /home
    
  3. 编译,会生成一个 ckman-2.1.2-210906.Linux.x86_64.tar.gz 文件

    cd ckman-2.1.2
    make package VERSION=2.1.2
    
  4. 启动

    chown -R ckman:ckman /home/ckman
    sh /home/ckman/bin/start
    
  5. web页面 http://ip:8808/

    用户名:ckman

    密码:Ckman123456!

登录的首页

创建clickhouse集群

导入版本包
clickhouse-client-21.7.6.39-2.noarch.rpm
clickhouse-common-static-21.7.6.39-2.x86_64.rpm
clickhouse-server-21.7.6.39-2.noarch.rpm

在这里插入图片描述

创建集群

在这里插入图片描述

管理集群

在这里插入图片描述

总结

虽然ckman的组件比较多,但是使用起来比较方便,对CK集群的管理也比较全面,个人感觉已经很不错了。

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值