美团点评CAT监控平台学习
1、安装步骤
初始化Mysql数据库,一套CAT集群需要部署一个数据库
,数据库脚本script/CatApplication.sql
下载war包,或者根据源码自己打包
放到Tomcat里面运行war包
特别说明:/data/appdatas/cat和/data/applogs/cat有读写权限,存放数据库配置文件
docker部署方法
FROM xxx/tomcat:jdk8-openjdk RUN rm -rf /usr/local/tomcat/webapps/ROOT RUN mkdir /usr/local/tomcat/cat/ COPY ["cat.war", "/usr/local/tomcat/cat/cat.war"] COPY ["cat.war", "/usr/local/tomcat/cat.war"] EXPOSE 8080 CMD ["catalina.sh","run"]
参考官方网站:https://github.com/dianping/cat/wiki/readme_server
api学习
transaction基本使用
event的api
metric使用
可以参考:https://ld246.com/article/1574674549156
https://github.com/dianping/cat/tree/master/integration?utm_source=ld246.com
使用过程遇到的问题Unable to get instance of MessageManager, please make sure the environment was setup correctly!
解决方法:使用jettly容器启动项目
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jetty</artifactId> </dependency>
cat客户端集成,部署到服务端
FROM registry1.cosmoplat.com/cosmoplat/openjdk:8-jdk-alpine #FROM registry1.cosmoplat.com/cosmoplat/jetty:9.4.18 RUN apk add --update curl --force ADD cat-client-1.0-SNAPSHOT.jar cat-client-1.0-SNAPSHOT.jar #RUN mkdir /data/appdatas/cat/ ADD client.xml /data/appdatas/cat/ RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime RUN echo 'Asia/Shanghai' >/etc/timezone ENV CAT_HOME /data/appdatas/cat/ ENTRYPOINT ["java","-jar","/cat-client-1.0-SNAPSHOT.jar"] EXPOSE 8081