1. Download Druid
2. Put the druid you just downloaded into the Lib directory under Tomcat
3. Configure the service startup file to be monitored, add:-djava.net.preferipv4stack=true-dcom.sun.management.jmxremote- dcom.sun.management.jmxremote.port=4090-dcom.sun.management.jmxremote.rmi.port=4090- Dcom.sun.management.jmxremote.ssl=false-dcom.sun.management.jmxremote.authenticate=false- djava.rmi.server.hostname=192.168.9.135
The IP and port are changed according to the actual situation and the service is restarted after the addition.
Such as:
4. Modify the Webapps/root/web-inf/web.xml file under Tomcat and add it to the Web-app tag:
<!--driud monitoring--><servlet><servlet-name>druidstatview</servlet-name><servlet-class>com.alibaba.druid.support.http.statviewservlet</servlet-class><!--Remote Access Javase project using JMX connection--><init-param><param-name>jmxurl</param-name>< Param-value>service:jmx:rmi:///Jndi/rmi://192.168.9.135:4090/jmxrmi</param-value></init-param><init-param><param-name>loginUsername</param-name><param-value> Admin</param-value></init-param><init-param><param-name>loginpassword</param-name ><param-value>admin</param-value></init-param></servlet><servlet-mapping>< Servlet-name>druidstatview</servlet-name><url-pattern>/druid/*</url-pattern></servlet-mapping>
Restart Tomcat when you are finished adding.
5, browser access to Tomcat address, such as: http://192.168.1.131:8081/druid/login.html, Default user name: admin Password: admin
6, data source monitoring situation
7, SQL monitoring situation
Druid monitoring the number of connections per service database and SQL execution efficiency