pinpoint installation deployment (2)

Explanation: I don't know why the editor suddenly got stuck. It can only be divided into two pieces

4. Install pinpoint-web

4.1 Deploy the war package
Unzip Tomcat and move the Tomcat rename to the specified location

cd /home/pp_res/
tar -zxvf apache-tomcat-8.0.36.tar.gz
mv apache-tomcat-8.0.36/ /data/service/pp-web

Modify the configuration of Tomcat for pp-web, mainly modifying the port to avoid port conflicts with Tomcat for pp-col.I've added 2 before the default port, and here's the replacement shell command

[Note] The last one is to open tomcat's private ip and need to replace the cost machine's ip with localhost. My local network card is the default. If your local network card is not eth0, you need to modify it accordingly.Or go in directly with "vi" and modify the localhost

cd /data/service/pp-web/conf/
sed -i 's/port="8005"/port="28005"/g' server.xml
sed -i 's/port="8080"/port="28080"/g' server.xml
sed -i 's/port="8443"/port="28443"/g' server.xml
sed -i 's/port="8009"/port="28009"/g' server.xml
sed -i 's/redirectPort="8443"/redirectPort="28443"/g' server.xml
sed -i "s/localhost/`ifconfig eth0 | grep 'inet addr' | awk '{print $2}' | awk -F: '{print $2}'`/g" server.xml

Deploy pinpoint-collector.war package

[Note: If there is no unzip command, you can "yum install unzip"]

cd /home/pp_res/
rm -rf /data/service/pp-web/webapps/*
unzip pinpoint-web-1.5.2.war -d /data/service/pp-web/webapps/ROOT

Check if the war package was successfully decompressed

[root@localhost conf]# ll /data/service/pp-web/webapps/ROOT/WEB-INF/classes/
total 88
-rw-rw-r--. 1 root root 2164 Apr  7  2016 applicationContext-cache.xml
-rw-rw-r--. 1 root root 3649 Apr  7  2016 applicationContext-dao-config.xml
-rw-rw-r--. 1 root root 1490 Apr  7  2016 applicationContext-datasource.xml
-rw-rw-r--. 1 root root 6680 Apr  7  2016 applicationContext-hbase.xml
-rw-rw-r--. 1 root root 1610 Apr  7  2016 applicationContext-websocket.xml
-rw-rw-r--. 1 root root 6576 Apr  7  2016 applicationContext-web.xml
drwxrwxr-x. 2 root root 4096 Apr  7  2016 batch
-rw-rw-r--. 1 root root  106 Apr  7  2016 batch.properties
drwxrwxr-x. 3 root root 4096 Apr  7  2016 com
-rw-rw-r--. 1 root root  682 Apr  7  2016 ehcache.xml
-rw-rw-r--. 1 root root 1001 Apr  7  2016 hbase.properties
-rw-rw-r--. 1 root root  153 Apr  7  2016 jdbc.properties
-rw-rw-r--. 1 root root 3338 Apr  7  2016 log4j.xml
drwxrwxr-x. 2 root root 4096 Apr  7  2016 mapper
-rw-rw-r--. 1 root root 1420 Apr  7  2016 mybatis-config.xml
drwxrwxr-x. 3 root root 4096 Apr  7  2016 org
-rw-rw-r--. 1 root root  630 Apr  7  2016 pinpoint-web.properties
-rw-rw-r--. 1 root root  141 Apr  7  2016 project.properties
-rw-rw-r--. 1 root root 3872 Apr  7  2016 servlet-context.xml
drwxrwxr-x. 2 root root 4096 Apr  7  2016 sql

Here is a description:

  • hbase.properties configures which data source our pp-web collects data from. Here we only specify the zookeeper address of Hbase.
  • List Content
  • Configuration of connection authentication for jdbc.properties pp-web connections to their Mysql databases.
  • The sql directory pp-web itself has some data to store in the MySQL database, where you need to initialize the table structure.
  • pinpoint-web.properties Here is the configuration file for the pp-web cluster, if you need a pp-web cluster.
  • ApplicationContext-*.xml These files will be used in subsequent tuning efforts.
  • log4j.xml log-related configuration.

Start Tomcat

cd /data/service/pp-web/bin/
./startup.sh

Check the log to see if Tocmat started successfully

tail -f ../logs/catalina.out

The following sentence appears in the log indicating that the boot has been successful

org.apache.catalina.startup.Catalina.start Server startup in 79531 ms

Now we can visit this address and enter it in the browser" http://10.244.76.136:28080 ". The main page will appear

Close the firewall if it is not accessible

[root@localhost conf]# /etc/init.d/iptables stop
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]

4.2 Configuration Quick Start
You need to modify "pp-web.init" to match the steps above

cd /home/pp_res
sed -i "s/JAVA_HOME=\/usr\/java\/default\//JAVA_HOME=\/usr\/java\/jdk17\//g" pp-web.init
sed -i "s/CATALINA_HOME=\/data\/service\/pinpoint-web\//CATALINA_HOME=\/data\/service\/pp-web\//g" pp-web.init
sed -i "s/CATALINA_BASE=\/data\/service\/pinpoint-web\//CATALINA_BASE=\/data\/service\/pp-web\//g" pp-web.init

Give the file execute permission and put it in init.d.You can restart it quickly later.

chmod 711 pp-web.init
mv pp-web.init /etc/init.d/pp-web


# Test restart
[root@localhost pp_res]# /etc/init.d/pp-web restart
Stoping Tomcat
Using CATALINA_BASE:   /data/service/pp-web/
Using CATALINA_HOME:   /data/service/pp-web/
Using CATALINA_TMPDIR: /data/service/pp-web//temp
Using JRE_HOME:        /usr/java/jdk17/
Using CLASSPATH:       /data/service/pp-web//bin/bootstrap.jar:/data/service/pp-web//bin/tomcat-juli.jar

waiting for processes to exitStarting tomcat
Using CATALINA_BASE:   /data/service/pp-web/
Using CATALINA_HOME:   /data/service/pp-web/
Using CATALINA_TMPDIR: /data/service/pp-web//temp
Using JRE_HOME:        /usr/java/jdk17/
Using CLASSPATH:       /data/service/pp-web//bin/bootstrap.jar:/data/service/pp-web//bin/tomcat-juli.jar
Tomcat started.
Tomcat is running with pid: 22745

5. Deploy pp-agent to collect monitoring data

Deploying the collector is easy, just add three sentences.I'll do a test of Tomcat here to simulate a deployment.

First, create a folder to place the packages you need to test

mkdir /home/pp_test
cd /home/test

Pull the pp-agent needed for testing onto the server

Check to see if the package was successfully uploaded

[root@localhost pp_test]# ll
total 16820
-rw-r--r--. 1 root root 9277365 Nov  9 02:25 apache-tomcat-8.0.36.tar.gz
-rw-r--r--. 1 root root 6621915 Nov  9 02:25 pinpoint-agent-1.5.2.tar.gz
-rw-r--r--. 1 root root 1320206 Nov  9 02:25 test.war

5.2 Configuring a simulated Tomcat test environment
For your convenience, configure a fake system and unzip Tomcat to the specified directory

cd /home/pp_test
mkdir /data
tar -zxvf apache-tomcat-8.0.36.tar.gz

Configure localhost for external access

cd /data/pp-test/conf/
sed -i "s/localhost/`ifconfig eth0 | grep 'inet addr' | awk '{print $2}' | awk -F: '{print $2}'`/g" server.xml

Unzip the war package for testing

cd /home/pp_test/
rm -rf /data/pp-test/webapps/*
unzip test.war -d /data/pp-test/webapps/ROOT

5.3 Configure pp-agent collector
Unzip pp-agent

cd /home/pp_test
tar -zxvf pinpoint-agent-1.5.2.tar.gz
mv pinpoint-agent-1.5.2 /data/pp-agent

Edit Profile

cd /data/pp-agent/
vi pinpoint.config

Major IP modification, just specify the IP to install pp-col. After installing pp-col, the port 9994, 9995, 9996 is automatically opened.There's no need to worry about this. If you have port requirements, modify these ports in the pp-col configuration file ("pp-col/webapps/ROOT/WEB-INF/classes/pinpoint-collector.properties")

profiler.collector.ip=10.244.76.136

Modify the Tomcat startup file "catalina.sh" under the test project simply to monitor Tomcat in the test environment and add probes

cd /data/pp-test/bin
vi catalina.sh

Add the following fields to 20 rows

  • The first line is the jar package location of the pp-agent
  • The second line is the ID of the agent. This ID is unique. I named it with pp + today's date, as long as it doesn't repeat with the ID of other projects
  • The third line is the name of the collection project, which is optional, as long as each project does not repeat itself
CATALINA_OPTS="$CATALINA_OPTS -javaagent:/data/pp-agent/pinpoint-bootstrap-1.5.2.jar"
CATALINA_OPTS="$CATALINA_OPTS -Dpinpoint.agentId=pp20161122"
CATALINA_OPTS="$CATALINA_OPTS -Dpinpoint.applicationName=MyTestPP

5.4 Monitoring Tomcat

Configured.Now that monitoring is started, let's start Tomcat's server for testing

cd /data/pp-test/bin/
./startup.sh

Check the startup log to make sure Tomcat starts

tail -f ../logs/catalina.out

When we visit pp-web at this time, we can see that there are more app options in its drop-down box.

Select one

After several visits, several request records are displayed, and details can be viewed in the box in the upper right corner.

[Note] Click on the arrow position in the upper right corner of the mouse, hold down the left mouse button, and pull the box to see.I was forced by this pit, so I write it clearly.

A new page pops up and you can see that I visited the home page a few times and the servlet of the newportal a few times.Details are also recorded in the table below.

summary
At this point, the entire deployment process is complete.Notable points:

  • If Hbase is not installed with pp-web, pp-col is installed on one machine and zookeeper needs to be installed. As long as it is installed, port 2181 will start.
  • If zookeeper is installed on a separate machine, you need to modify pp-colletor and
    The pp-web configuration file pinpoint-collector.properties, pinpoint-web.properties, otherwise will cause the two modules to fail to start.
  • Pinpoint was found to be defective, and asynchronous operations could not be monitored. For example, I wrote a multithreaded request to send HttpClient4, but pinpoint could not be monitored.However, it describes requests that can be monitored for Httpclient4.Now they are all distributed systems, and it's not uncommon to get data asynchronously. If you can't monitor asynchronous operations, it's a chicken rib.See if pp1.6 will fix this problem
  • With pp1.6 deployment, the default fields in Hbase are increased, and if no default fields are added, you will get a fairly small amount of data.

Keywords: Tomcat xml HBase Apache

Added by bhonan on Wed, 12 Jun 2019 20:42:46 +0300