采樣率:每一個請求為都進行記錄,或者100次請求為記錄50次
各個開源框架都滿足opentracing的標准,只要使用opentracing標准埋點的客戶端,可以使用不同的客戶端去展示,opentracing對客戶端調用的標准、tracing的標准進行了規范化
69.調用鏈監控產品和比較~1.mp4
1、調用鏈的可視化,上面三款產品都支持
2、服務之間的依賴關系,Pinpoint做的最好,圖形化展示直觀形象
3、埋點 cat和zipnkin都是侵入式的,Pinpoint的是aop的不需要修改代碼
4、實例的cpu、內存的情況,Pinpoint有
71.CAT 典型報表~1.mp4
cat的 報表豐富是cat的最大的優點
cat會把它接入的應用程序對於的報錯情況,實時的做成一個報錯大盤,以1分鍾為單位展示出來
cat是支持業務監控的,例如支付成功次數等,但是對於業務指標,最好使用專門的metris監控工具去做,cat最大的長處是調用鏈監控
cat除了全鏈路追蹤功能之外,還有其他功能
transaction報表
整個應用在1小時內發生了多少次調用,有多少次是失敗的,整個應用的最小延遲,最大延遲,平均值,如果95line和99line和平均值相差不大,說明該系統很穩定,qps就是服務的調用頻率
點擊該應用可以看到該應用下接口的性能統計情況
例如一個url請求超過了50毫秒。我們可以進行搜索,查看對於的具體信息
72.CAT 告警簡介~1.mp4
73.CAT 架構設計~1.mp4
原始的調用鏈trace數據存儲在hdfs中,聚合的報表數據存儲在mysql中,按照分鍾、小時的報表聚合數據是存儲在mysql中的
74.【實驗】CAT 本地部署~1.mp4
cat的安裝,第一步首先安裝cat的源碼
這里按照視頻上的,我們安裝2.0.0版本
進入改目錄執行下面的操作:進行maven打包的操作
mvn clean install -DskipTests
打包成功之后war包位於cat-home目錄下,我們將cat-alpha-2.0.0.war重新命名為cat.war
打包完成之后接下來要進行數據庫的操作
數據庫的腳本在這個目錄下
創建一個cat的數據庫
然后執行cat.sql 的腳本
我們cat運行在d盤,這里需要強調的是在tomcat所在的盤根目錄需要有data文件夾,這里我們把tomcat放在d盤目錄,因此我們在d盤建立下面的目錄D:\data\appdatas\cat
我們將下面的三個xml文件拷貝到D:\data\appdatas\cat目錄下
接下來修改client.xml的配置文件
<?xml version="1.0" encoding="utf-8"?> <config mode="client" xmlns:xsi="http://www.w3.org/2001/XMLSchema" xsi:noNamespaceSchemaLocation="config.xsd"> <servers> <!-- Local mode for development --> <server ip="192.168.43.80" port="2280" http-port="2281" /> <!-- If under production environment, put actual server address as list. --> <!-- <server ip="192.168.7.71" port="2280" /> <server ip="192.168.7.72" port="2280" /> --> </servers> </config>
這里client要配置server的地址,port是上傳文件到server的TCP端口是2280,2281是cat頁面訪問的端口,這里要寫本地機器的IP地址,不要寫成127.0.0.1
<!-- ip:部署CAT應用的服務器IP
port:CAT服務端接收客戶端數據的端口(不允許更改)
http-port:CAT應用部署到的容器的端口(tomcat的端口)
-->
<server ip="10.10.10.121" port="2280" http-port="8080" />
瀏覽器打開http://localhost:2281/cat 可以看到cat監控的界面
只有客戶端配置了這個配置文件,客戶端才能正確連接到CAT服務器端
接下來配置datasources.xml,這里是cat訪問mysql數據的配置
<?xml version="1.0" encoding="utf-8"?>
<data-sources>
<data-source id="cat">
<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://192.168.43.80:3306/cat]]></url>
<user>root</user>
<password>123456</password>
<connectionProperties><![CDATA[useUnicode=true&autoReconnect=true]]></connectionProperties>
</properties>
</data-source>
<data-source id="app">
<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://192.168.43.80:3306/cat]]></url>
<user>root</user>
<password>123456</password>
<connectionProperties><![CDATA[useUnicode=true&autoReconnect=true]]></connectionProperties>
</properties>
</data-source>
</data-sources>
接下來我們要配置server.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- local-mode:是否為本地開發模式。建議在開發環境以及生產環境都設置為false
hdfs-machine:是否啟用HDFS存儲
job-machine:是否為報告工作機(開啟生成匯總報告和統計報告,只需要一台服務機開啟此功能)
alert-machine:是否為報警機(開啟各類報警監聽, 只需要一台服務機開啟此功能)
-->
控制台 - 提供給業務人員進行數據查看【默認所有的cat節點都可以作為控制台,不可配置】
消費機 - 實時接收業務數據,實時處理,提供實時分析報表【默認所有的cat節點都可以作為消費機,不可配置】
任務機(job-machine) - 做一些離線的任務,合並天、周、月等報表 【可以配置】
告警端(alert-machine) - 啟動告警線程,進行規則匹配,發送告警(目前僅支持單點部署)【可以配置】
local-mode: 建議在開發環境以及生產環境時,都設置為false
hdfs-machine: 定義是否啟用 HDFS 存儲方式,默認為 false
job-machine: 定義當前服務是否為報告工作機(開啟生成匯總報告和統計報告的任務,只需要一台服務機開啟此功能),默認為 false
alert-machine: 定義當前服務是否為報警機(開啟各類報警監聽,只需要一台服務機開啟此功能),默認為 false;
storage: 定義數據存儲配置信息
local-report-storage-time: 定義本地報告文件存放時長,單位為(天)
local-logivew-storage-time: 定義本地日志文件存放時長,單位為(天)
local-base-dir: 定義本地數據存儲目錄,建議直接使用/data/appdatas/cat/bucket目錄
hdfs: 定義HDFS配置信息
server-uri: 定義HDFS服務地址
console: 定義服務控制台信息
remote-servers: 定義HTTP服務列表,(遠程監聽端同步更新服務端信息即取此值)
<?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"> <remote-servers>192.168.43.80:2281</remote-servers> </console> </config>
這里本地開發模式,不適用hdfs存儲,啟動聚合,啟動報警,遠程頁面來訪問server進行數據查詢的短路時2281
接下來我們要將打包出來的cat.war包部署到tomcat中
這里因為上面配置的頁面訪問http-port端口是2281,這里tomcat中server.xml的端口地址也要配置為2281
接下來,我們把cat.war包部署到webapps目錄下
接下來我們啟動tomcat,我們在D:\data\applogs\cat下可以看到啟動對於的目錄,這個日志目錄一定要保證具有可讀寫的權限
啟動tomcat的時候要查看日志里面沒有錯誤的信息
[08-26 15:28:28.598] [INFO] [ServerConfigManager] Loading configuration file(D:\data\appdatas\cat\server.xml) ... [08-26 15:28:28.696] [INFO] [ServerConfigManager] CAT server is running with hdfs,false [08-26 15:28:31.585] [INFO] [ServerConfigManager] CAT server is running with alert,false [08-26 15:28:31.585] [INFO] [ServerConfigManager] CAT server is running with job,true [08-26 15:28:31.590] [INFO] [ServerConfigManager] <?xml version="1.0" encoding="utf-8"?> <config local-mode="false" job-machine="true" alert-machine="false" hdfs-machine="false" send-machine="true"> <storage local-base-dir="/data/appdatas/cat/bucket/" upload-thread="5" max-hdfs-storage-time="15" local-report-storage-time="7" local-logivew-storage-time="7"> </storage> <consumer> <long-config default-url-threshold="1000" default-sql-threshold="100" default-service-threshold="50"> </long-config> </consumer> <console default-domain="Cat" show-cat-domain="true"> <remote-servers>192.168.43.80:2281</remote-servers> </console> </config> [08-26 15:28:33.287] [INFO] [TcpSocketReceiver] start netty server! [08-26 15:28:33.295] [INFO] [CatClientModule] Current working directory is D:\apache-tomcat-8.5.45\bin [08-26 15:28:33.340] [INFO] [DefaultClientConfigManager] Global config file(\data\appdatas\cat\client.xml) found. [08-26 15:28:33.344] [INFO] [DefaultClientConfigManager] Find domain name cat from app.properties. [08-26 15:28:33.381] [INFO] [DefaultTransportManager] Remote CAT servers: [/127.0.0.1:2280] [08-26 15:28:35.683] [INFO] [ChannelManager] Connected to CAT server at /127.0.0.1:2280 [08-26 15:28:35.686] [INFO] [ChannelManager] success when init CAT server, new active holderactive future :/127.0.0.1:2280 index:0 ip:127.0.0.1 server config:null [08-26 15:28:35.690] [INFO] [CatThreadListener] Thread group(cat) created. [08-26 15:28:35.692] [INFO] [TcpSocketSender] Starting thread(cat-TcpSocketSender) ... [08-26 15:28:35.693] [INFO] [TcpSocketSender] Starting thread(cat-TcpSocketSender-ChannelManager) ... [08-26 15:28:35.695] [INFO] [TcpSocketSender] Starting thread(cat-merge-atomic-task) ... [08-26 15:28:35.737] [INFO] [CatClientModule] Starting thread(cat-StatusUpdateTask) ... [08-26 15:28:36.008] [INFO] [DefaultDataSourceProvider] Loading data sources from \data\appdatas\cat\datasources.xml ... [08-26 15:28:36.707] [INFO] [JdbcDataSource] Connecting to JDBC data source(cat) with properties(driver=com.mysql.jdbc.Driver, url=jdbc:mysql://127.0.0.1:3306/cat?useUnicode=true&autoReconnect=true, user=root) ... [08-26 15:28:37.729] [INFO] [JdbcDataSource] Connected to JDBC data source(cat). [08-26 15:28:37.932] [INFO] [ServerFilterConfigManager] Starting thread(cat-Server-Filter-Config-Reload) ... [08-26 15:28:38.290] [INFO] [LocalMessageBucketManager] Starting thread(cat-LocalMessageBucketManager-BlockDumper) ... [08-26 15:28:38.294] [INFO] [LocalMessageBucketManager] Starting thread(cat-LocalMessageBucketManager-OldMessageMover) ... [08-26 15:28:38.304] [INFO] [LocalMessageBucketManager] Starting thread(cat-Message-Gzip-0) ... [08-26 15:28:38.304] [INFO] [LocalMessageBucketManager] Starting thread(cat-Message-Gzip-4) ... [08-26 15:28:38.305] [INFO] [LocalMessageBucketManager] Starting thread(cat-Message-Gzip-8) ... [08-26 15:28:38.306] [INFO] [LocalMessageBucketManager] Starting thread(cat-Message-Gzip-12) ... [08-26 15:28:38.306] [INFO] [LocalMessageBucketManager] Starting thread(cat-Message-Gzip-3) ... [08-26 15:28:38.306] [INFO] [LocalMessageBucketManager] Starting thread(cat-Message-Gzip-7) ... [08-26 15:28:38.307] [INFO] [LocalMessageBucketManager] Starting thread(cat-Message-Gzip-11) ... [08-26 15:28:38.307] [INFO] [LocalMessageBucketManager] Starting thread(cat-Message-Gzip-16) ... [08-26 15:28:38.308] [INFO] [LocalMessageBucketManager] Starting thread(cat-Message-Gzip-15) ... [08-26 15:28:38.308] [INFO] [LocalMessageBucketManager] Starting thread(cat-Message-Gzip-1) ... [08-26 15:28:38.308] [INFO] [LocalMessageBucketManager] Starting thread(cat-Message-Gzip-5) ... [08-26 15:28:38.309] [INFO] [LocalMessageBucketManager] Starting thread(cat-Message-Gzip-9) ... [08-26 15:28:38.309] [INFO] [LocalMessageBucketManager] Starting thread(cat-Message-Gzip-17) ... [08-26 15:28:38.310] [INFO] [LocalMessageBucketManager] Starting thread(cat-Message-Gzip-13) ... [08-26 15:28:38.310] [INFO] [LocalMessageBucketManager] Starting thread(cat-Message-Gzip-19) ... [08-26 15:28:38.311] [INFO] [LocalMessageBucketManager] Starting thread(cat-Message-Gzip-2) ... [08-26 15:28:38.311] [INFO] [LocalMessageBucketManager] Starting thread(cat-Message-Gzip-6) ... [08-26 15:28:38.312] [INFO] [LocalMessageBucketManager] Starting thread(cat-Message-Gzip-10) ... [08-26 15:28:38.312] [INFO] [LocalMessageBucketManager] Starting thread(cat-Message-Gzip-14) ... [08-26 15:28:38.313] [INFO] [LocalMessageBucketManager] Starting thread(cat-Message-Gzip-18) ... [08-26 15:28:38.845] [INFO] [Period] Starting 10 tasks in period [2019-08-26 15:00:00, 2019-08-26 15:59:59] [08-26 15:28:38.846] [INFO] [CatThreadListener] Thread group(Cat-RealtimeConsumer) created. [08-26 15:28:38.848] [INFO] [Period] Starting thread(Cat-RealtimeConsumer-ProblemAnalyzer-15-0) ... [08-26 15:28:38.850] [INFO] [Period] Starting thread(Cat-RealtimeConsumer-TopAnalyzer-15-0) ... [08-26 15:28:38.850] [INFO] [Period] Starting thread(Cat-RealtimeConsumer-MetricAnalyzer-15-0) ... [08-26 15:28:38.851] [INFO] [Period] Starting thread(Cat-RealtimeConsumer-HeartbeatAnalyzer-15-0) ... [08-26 15:28:38.852] [INFO] [Period] Starting thread(Cat-RealtimeConsumer-ProblemAnalyzer-15-1) ... [08-26 15:28:38.860] [INFO] [Period] Starting thread(Cat-RealtimeConsumer-CrossAnalyzer-15-0) ... [08-26 15:28:38.860] [INFO] [Period] Starting thread(Cat-RealtimeConsumer-StorageAnalyzer-15-0) ... [08-26 15:28:38.861] [INFO] [Period] Starting thread(Cat-RealtimeConsumer-TransactionAnalyzer-15-0) ... [08-26 15:28:38.861] [INFO] [Period] Starting thread(Cat-RealtimeConsumer-CrossAnalyzer-15-1) ... [08-26 15:28:38.861] [INFO] [Period] Starting thread(Cat-RealtimeConsumer-DumpAnalyzer-15-1) ... [08-26 15:28:38.862] [INFO] [Period] Starting thread(Cat-RealtimeConsumer-StateAnalyzer-15-0) ... [08-26 15:28:38.862] [INFO] [Period] Starting thread(Cat-RealtimeConsumer-EventAnalyzer-15-1) ... [08-26 15:28:38.862] [INFO] [Period] Starting thread(Cat-RealtimeConsumer-DumpAnalyzer-15-0) ... [08-26 15:28:38.862] [INFO] [Period] Starting thread(Cat-RealtimeConsumer-EventAnalyzer-15-0) ... [08-26 15:28:38.862] [INFO] [Period] Starting thread(Cat-RealtimeConsumer-TransactionAnalyzer-15-1) ... [08-26 15:28:38.863] [INFO] [RealtimeConsumer] Starting thread(cat-RealtimeConsumer-PeriodManager) ... [08-26 15:28:38.961] [INFO] [CatHomeModule] Starting thread(cat-Config-Reload) ... [08-26 15:28:39.891] [INFO] [CatHomeModule] Starting thread(cat-Task-Consumer) ... [08-26 15:28:39.897] [INFO] [MVC] MVC is starting at /cat [08-26 15:28:40.131] [INFO] [CatThreadListener] Thread pool(Cat-ModelService) created. [08-26 15:28:41.129] [INFO] [TopologyGraphManager] Starting thread(cat-TopologyGraphReload) ... [08-26 15:28:41.358] [INFO] [UrlPatternConfigManager] Starting thread(cat-UrlPattern-Config-Reload) ... [08-26 15:28:41.960] [INFO] [AggregationConfigManager] Starting thread(cat-Aggreation-Config-Reload) ... [08-26 15:28:42.434] [INFO] [MVC] MVC started at /cat [08-26 15:29:00.515] [INFO] [Worker] Starting thread(Cat-ModelService-0) ... [08-26 15:29:45.770] [WARN] [TcpSocketSender] Netty write buffer is full! Attempts: 1 [08-26 15:30:00.501] [INFO] [Worker] Starting thread(Cat-ModelService-1) ... [08-26 15:30:05.745] [INFO] [TcpSocketSender] success when init CAT server, new active holderactive future :/127.0.0.1:2280 index:0 ip:127.0.0.1 server config:127.0.0.1:2280; [08-26 15:31:00.502] [INFO] [Worker] Starting thread(Cat-ModelService-2) ... [08-26 15:32:00.502] [INFO] [Worker] Starting thread(Cat-ModelService-3) ... [08-26 15:33:00.503] [INFO] [Worker] Starting thread(Cat-ModelService-4) ...
上面沒有錯誤的信息
我們在頁面上可以看到訪問的信息為:
這樣cat就已經啟動成功了,接下來我們要進行全局路由的設置
點擊頁面上的配置按鈕
需要進行登錄,登錄的密碼默認是用戶名是catadmin,密碼是admin
點擊客戶端路由
這里客戶端能夠訪問的server地址只有一台,我們只需要將127.0.0.1替換成當前機器的IP地址就可以了
<?xml version="1.0" encoding="utf-8"?> <router-config backup-server="192.168.43.80" backup-server-port="2280"> <default-server id="192.168.43.80" weight="1.0" port="2280" enable="true"/> </router-config>
點擊cat'上面的state
如果看到
這才說明我們的cat服務器安裝成功。