一、Cat的项目背景

  CAT(Central Application Tracking),是美团点评基于 Java 开发的一套开源的分布式实时监控系统。美团点评基础架构部希望在基础存储、高性能通信、大规模在线访问、服务治理、实时监控、容器化及集群智能调度等领域提供业界领先的、统一的解决方案,CAT 目前在美团点评的产品定位是应用层的统一监控组件,在中间件(RPC、数据库、缓存、MQ 等)框架中得到广泛应用,为各业务线提供系统的性能指标、健康状况、实时告警等服务。

  Gthub链接:https://github.com/dianping/cat/blob/master/README.md

二、Cat集群部署

  1,需求  

    1.1  服务机器需求:3台。(172.17.16.27,172.17.16.25,172.17.16.19)使用的是内网地址,其中172.17.16.27为主服务端。

         1.2  服务需求:Centos 7,jdk1.8,Tomcat,Mysql 5.6+。其中Mysql部署一个即可。

    1.3  软件包下载:

        git clone https://github.com/dianping/cat.git

        wget http://unidal.org/nexus/service/local/repositories/releases/content/com/dianping/cat/cat-home/3.0.0/cat-home-3.0.0.war

        其中下载下来后,cat-home-3.0.0.war是cat的项目包,cat为配置文件包

  2,配置

    2.0  配置cat环境变量(红色区域为自己设置区域,根据服务器内存设置,建议生产10G+,其他2G+)

      export CAT_HOME=/data/appdatas/cat/

    2.1  创建/data目录(3台都要)

      mkdir /data/{appdatas,applogs} -p 

      mkdir /data/appdatas/cat -p

      其中/data/appdatas/cat为cat项目的配置目录

      需要在/data/appdatas/cat目录下创建3个配置文件(服务端配置文件server.xml,客户端配置文件client.xml,数据库配置文件datasources.xml)

      【注意:】我们的3个服务端配置,客户端配置文件和数据库配置文件一致,服务端配置文件不同

      client.xml文件内容:

        <?xml version="1.0" encoding="utf-8"?>

                            <config mode="client">

                            <servers>
                            <server ip="172.17.16.109" port="2280" http-port="8080"/>
                            <server ip="172.17.16.85" port="2280" http-port="8080"/>
                            <server ip="172.17.16.32" port="2280" http-port="8080"/>
                            </servers>
                            </config>

      datasources.xml文件内容:

         

                                <data-sources>
         <data-source >
                                <maximum-pool-size>3</maximum-pool-size>
                                <connection-timeout>1s</connection-timeout>
                                <idle-timeout>10m</idle-timeout>
                                <statement-cache-size>1000</statement-cache-size>
                                <properties>
                                <driver>com.mysql.jdbc.Driver</driver>
                                <url><![CDATA[jdbc:mysql://172.17.16.51:3306/cat]]></url> <!-- 请替换为真实数据库URL及Port -->
                               <user>xxxxxx</user> <!-- 请替换为真实数据库用户名 -->
                               <password>xxxxxxxxxxxxxxxxxxxx</password> <!-- 请替换为真实数据库密码 -->
                               <connectionProperties><![CDATA[useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&socketTimeout=120000]]></connectionProperties>
                               </properties>
                               </data-source>
                               </data-sources>

      主server的配置文件为:【主要是job-machine和alert-machine的不同,主为true,其余两个为false即可】       

                              <?xml version="1.0" encoding="utf-8"?>
                              <!-- Configuration for development environment-->
                              <config local-mode="false" hdfs-machine="false" job-machine="true" alert-machine="true">
                              <storage local-base-dir="/data/appdatas/cat/bucket/" max-hdfs-storage-time="15" local-report-storage-time="7" local-logivew-storage-time="7">
                              </storage>
                              <console default-domain="Cat" show-cat-domain="true">
                              <!--将172.16.90.114修改为部署CAT的内网IP,请不要写127.0.0.1和外网IP -->
                              <remote-servers>172.17.16.109:8080,172.17.16.85:8080,172.17.16.32:8080</remote-servers>
                              </console>
                              </config>

    2.2 授权目录(3台都要)

      chmod 777 -R /data

    2.3 导入sql

      将/cat/script/CatApplication.sql导入数据库即可,需要创建cat库

    2.4 启动服务

      将cat-home-3.0.0.war改名为cat.war,之后移动到tomcat/webapps/下

      sh tomcat/bin/startup.sh   启动即可

    2.5 访问服务

      浏览器输入server.xml中job-machine和alert-machine为true那台服务器的公网即x.x.x.x:8080/cat,用户名密码admin

  3,配置路由

    3.1  服务端路由配置

      监控-Cat项目部署

 

 

      3.2 客户端路由配置

    监控-Cat项目部署

 

 

  

 

    3.3 查看状态

 

      监控-Cat项目部署

 

   4,客户端集成

    创建/data/appdatas/cat目录,之后将服务端的client.xml文件放到这个目录底下即可,之后chmod 777 -R /data

  【注意:】客户端路由或其他服务端配置文件修改,重启cat

相关文章:

  • 2021-07-17
  • 2022-12-23
  • 2021-12-18
  • 2022-02-01
  • 2021-10-21
  • 2021-11-17
  • 2021-04-26
  • 2021-07-19
猜你喜欢
  • 2021-10-27
  • 2021-05-17
  • 2022-01-06
  • 2022-01-02
  • 2021-12-28
  • 2021-11-02
相关资源
相似解决方案