At (Central application Tracking) is a real-time application monitoring platform based on Java development, including real-time application monitoring and business monitoring. A detailed description of cat can be found on the cat website.
Environment checklist
CentOS 7 Java 8 Maven 3.5 MySQL 5.7 CAT 2.0.0 Tomcat 7.0
- Installing CAT
To download the Cat installation package:
# wget-o Cat-home-2.0.0.war http://unidal.org/nexus/service/local/repositories/releases/content/com/ Dianping/cat/cat-home/2.0.0/cat-home-2.0.0.war
Deploy Cat-home-2.0.0.war to Tomcat and rename to Cat.war:
$ m2.1 Configuring the CAT
The Cat app requires read and write access to the/data/appdatas/cat and/data/applogs/cat paths while the Linux system is installed.
# mkdir-p/data/appdatas/cat && mkdir-p/data/applogs/cat
The Cat server app reads and writes both directories, so you need to create both directories first. You should also ensure that users who start the Cat app have read and write access to both directories. V Cat-home-2.0.0.war Tomcat-7.0.90/webapps/cat.war
Download Cat's Source package:
$ wget-o cat-2.0.0.tar.gz https://codeload.github.com/dianping/cat/tar.gz/v2.0.0
Unzip:
# tar ZXVF cat-2.0.0.tar.gz
The cat-2.0.0 directory is obtained after the decompression is complete. Where the Cat-2.0.0/script directory contains some of the configuration files that are required for the cat client and server installation:
Copy the Client.xml, Datasources.xml, server.xml configuration files from the Cat-2.0.0/script directory to the directory/data/appdatas/cat:
$ cp client.xml server.xml datasources.xml /data/appdatas/cat/
The configuration of the client Client.xml is as follows:
<?xml version= "1.0" encoding= "Utf-8"?>
<config mode= "Client" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema" xsi:nonamespaceschemalocation= "config.xsd" >
<servers>
<!--IP: server IP for deploying cat apps
Port:cat port on the server that receives client data (changes are not allowed)
Http-port:cat Port of the container to which the application is deployed (Tomcat Port)
-
<server ip= "10.10.10.121" port= "2280" http-port= "8080"/>
</servers>
</config>
The configuration content of the server Server.xml is as follows:
<?xml version= "1.0" encoding= "Utf-8"?>
<!--Local-mode: is the local development mode. It is recommended that both the development environment and the production environment be set to False
Hdfs-machine: Whether to enable HDFs storage
Job-machine: Whether it is a report machine (turn on Generate summary report and statistic report, only need one server to turn on this function)
Alert-machine: Whether the alarm machine (open all kinds of alarm monitoring, only one service machine to turn on this function)
-
<config local-mode= "false" Hdfs-machine= "false" job-machine= "true" Alert-machine= "false" >
<!--local-base-dir: Local data storage directory, recommended not to modify
Local-report-storage-time: Local report file storage time in (days)
Local-logivew-storage-time: The local log file is stored for a length of (days)
-
<storage local-base-dir= "/data/appdatas/cat/bucket/" local-report-storage-time= "7" local-logivew-storage-time= "7"/>
<console default-domain= "Cat" show-cat-domain= "true" >
<!--a list of remote server HTTP services for synchronizing updates-
<remote-servers>10.10.10.121:8080</remote-servers>
</console>
</config>
The configuration of the data source Datasources.xml is as follows:
<?xml version= "1.0" encoding= "Utf-8"?>
<data-sources>
<data-source id= "Cat" >
<maximum-pool-size>8</maximum-pool-size>
<connection-timeout>3s</connection-timeout>
<idle-timeout>10m</idle-timeout>
<statement-cache-size>1000</statement-cache-size>
<properties>
<driver>com.mysql.jdbc.Driver</driver>
<!--database--
<url><! [cdata[jdbc:mysql://10.10.10.121:3306/cat_schema]]></url>
<!--user name--
<user>root</user>
<!--password--
<password>123654</password>
<connectionproperties><! [cdata[useunicode=true&characterencoding=utf-8&autoreconnect=true&sockettimeout=120000]]></ Connectionproperties>
</properties>
</data-source>
<data-source id= "App" >
<maximum-pool-size>8</maximum-pool-size>
<connection-timeout>3s</connection-timeout>
<idle-timeout>10m</idle-timeout>
<statement-cache-size>1000</statement-cache-size>
<properties>
<driver>com.mysql.jdbc.Driver</driver>
<!--database--
<url><! [cdata[jdbc:mysql://10.10.10.121:3306/cat_schema]]></url>
<!--user name--
<user>root</user>
<!--password--
<password>123654</password>
<connectionproperties><! [cdata[useunicode=true&characterencoding=utf-8&autoreconnect=true&sockettimeout=120000]]></ Connectionproperties>
</properties>
</data-source>
</data-sources>
To create a Cat_schema database:
CREATE DATABASE IF NOT EXISTS cat_schema DEFAULT CHARSET utf8 COLLATE utf8_general_ci
Select Database Cat_schema:
Use Cat_schema
Import Cat.sql to Cat_schema database:
Source/home/fanlychie/cat-2.0.0/script/cat.sql
To edit a Tomcat configuration file:
$ vim Tomcat-7.0.90/conf/server.xml
Locate the configuration line for Connector, and add uriencoding= "Utf-8". As follows:
<connector port= "8080" protocol= "http/1.1"
connectiontimeout= "20000"
Redirectport= "8443"
uriencoding= "Utf-8"/>
2.2 Start CAT
To start Tomcat:
$./tomcat-7.0.90/bin/startup.sh
Visit: Http://10.10.10.121:8080/cat
The configuration operation requires the user to log in to the system, each time the login account name and password remain consistent. such as Catadmin/catadmin.
2.3 Client Routing Settings
Turn on the configuration--Global alert configuration--The client route modifies the server IP that the ID is deployed for cat:
- Cluster construction
This is a single point mode deployment for CAT applications. Next, we introduce the CAT cluster mode Setup.
3.1 Overview of the deployment
10.10.10.121 as a front-end console, if a domain name is used, simply resolve the domain name to this IP address.
Based on the above-mentioned single-point mode, the CAT is deployed in 10.10.10.121, 10.10.10.122 and 10.10.10.123 respectively. Do not start Tomcat after deployment is complete. Next do the cluster configuration.
3.2 Client Client.xml Configuration
The Client.xml configuration of 10.10.10.121, 10.10.10.122, and 10.10.10.123 is as follows:
<?xml version= "1.0" encoding= "Utf-8"?>
<config mode= "Client" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema" xsi:nonamespaceschemalocation= "config.xsd" >
<servers>
<!--IP: server IP for deploying cat apps
Port:cat port on the server that receives client data (changes are not allowed)
Http-port:cat Port of the container to which the application is deployed (Tomcat Port)
-
<server ip= "10.10.10.121" port= "2280" http-port= "8080"/>
<server ip= "10.10.10.122" port= "2280" http-port= "8080"/>
<server ip= "10.10.10.123" port= "2280" http-port= "8080"/>
</servers>
</config>
3.3 Service-Side Server.xml configuration
10.10.10.121 's server.xml configuration, as follows:
<?xml version= "1.0" encoding= "Utf-8"?>
<!--Local-mode: is the local development mode. It is recommended that both the development environment and the production environment be set to False
Hdfs-machine: Whether to enable HDFs storage
Job-machine: Whether it is a report machine (turn on Generate summary report and statistic report, only need one server to turn on this function)
Alert-machine: Whether the alarm machine (open all kinds of alarm monitoring, only one service machine to turn on this function)
-
<config local-mode= "false" Hdfs-machine= "false" job-machine= "true" alert-machine= "true" >
<!--local-base-dir: Local data storage directory, recommended not to modify
Local-report-storage-time: Local report file storage time in (days)
Local-logivew-storage-time: The local log file is stored for a length of (days)
-
<storage local-base-dir= "/data/appdatas/cat/bucket/" local-report-storage-time= "7" local-logivew-storage-time= "7"/>
<console default-domain= "Cat" show-cat-domain= "true" >
<!--a list of remote server HTTP services for synchronizing updates-
<remote-servers>10.10.10.121:8080,10.10.10.122:8080,10.10.10.123:8080</remote-servers>
</console>
</config>
10.10.10.122, 10.10.10.123 's server.xml configuration, as follows:
<?xml version= "1.0" encoding= "Utf-8"?>
<!--Local-mode: is the local development mode. It is recommended that both the development environment and the production environment be set to False
Hdfs-machine: Whether to enable HDFs storage
Job-machine: Whether it is a report machine (turn on Generate summary report and statistic report, only need one server to turn on this function)
Alert-machine: Whether the alarm machine (open all kinds of alarm monitoring, only one service machine to turn on this function)
-
<config local-mode= "false" Hdfs-machine= "false" Job-machine= "false" Alert-machine= "false" >
<!--local-base-dir: Local data storage directory, recommended not to modify
Local-report-storage-time: Local report file storage time in (days)
Local-logivew-storage-time: The local log file is stored for a length of (days)
-
<storage local-base-dir= "/data/appdatas/cat/bucket/" local-report-storage-time= "7" local-logivew-storage-time= "7"/>
<console default-domain= "Cat" show-cat-domain= "true" >
<!--a list of remote server HTTP services for synchronizing updates-
<remote-servers>10.10.10.121:8080,10.10.10.122:8080,10.10.10.123:8080</remote-servers>
</console>
</config>
The configuration of the server-side server.xml is primarily different from the configuration of the Job-machine and Alert-machine property values.
3.4 Start CAT
Launch Tomcat for 10.10.10.121, 10.10.10.122, 10.10.10.123, respectively
1
$./tomcat-7.0.90/bin/startup.sh
10.10.10.121 as a console service, simply visit: http://10.10.10.121:8080/cat
3.5 Client Routing Settings
10.10.10.121 as a console service, just configure this one.
Turn on the configuration--Global alert configuration--The client route modifies the server IP that the ID is deployed for CAT:
Where 10.10.10.121 as a backup, normally not as a consumer (that is, the role of consumption data), only when the other nodes in the CAT cluster (such as the 10.10.10.122, 10.10.10.123 nodes) are hung up before the data consumption.
This configuration is automatically synced to other nodes in the cat cluster (10.10.10.122, 10.10.10.123 nodes, for example).
After the configuration is complete, restart the CAT application container for the 10.10.10.121 server (that is, restart Tomcat).
Building public reviews Cat Monitoring platform