Deploy mongous and MySQL slow query Configurations Based on Docker
Deployment of Lepus In the Docker tutorial (MySQL Monitoring)
Introduction
Lepus is an enterprise-level database monitoring system developed by Python + PHP. It can be used in MySQL, Oracle, MongoDB, and Redis.
Download Image
Docker pull georce/lepus
View images
Docker images
Start container
Docker run-d -- name = lepus-p 32800: 80-p 32799: 3306 georce/lepus
View Processes
Docker ps
Go to docker bash
Sudo docker exec-it commands us/bin/bash
Configure Environment Variables
Echo $ TERM
Export TERM = dumb
Username and password
Admin
Lepusadmin
Common Errors
Perl: symbol lookup error:/usr/local/lib64/perl5/auto/DBD/mysql. so:
Undefined symbol: mysql \ _ init
Cause
Perl has multiple lib \ [/usr/local/lib64/perl5 \ |/usr/lib64/perl5 \]./usr/local/lib64/perl5 is selected by default during system calling, this perl has no related mysql module or module is incomplete.
Solution
Mv/usr/local/lib64/perl5/usr/local/lib64/perl5 \ _ cant \ _ use
Slow query script
Config us database server
Lepus_db_host = "192.168.100.106"
Lepus_db_port = 32799
Lepus_db_user = "lepus_user"
Lepus_db_password = "dd @2016"
Lepus_db_database = "lepus"
Config mysql server
Mysql_client = "/usr/bin/mysql"
Mysql_host = "127.0.0.1"
Mysql_port = 3306
Mysql_user = "root"
Mysql_password = "dd @2016"
Config slowqury
Slowquery_dir = "/ddhome/usr/mysql/slowquery /"
Slowquery_long_time = 3
Slowquery_file = '$ mysql_client-h $ mysql_host-P $ mysql_port-u $ mysql_user-p $ mysql_password-e "show variables like 'slow _ query_log_file'" | grep log | awk '{ print $2 }''
Pt_query_digest = "/usr/bin/pt-query-digest"
Config server_id
Lepus_server_id = 1
Collect mysql slowquery log into slave us database
$ Pt_query_digest -- user = $ lepus_db_user -- password = $ lepus_db_password -- port = $ login -- review h = $ login, D = $ lepus_db_database, t = login -- history h = $ lepus_db_host, D = $ lepus_db_database, t = mysql_slow_query_review_history -- no-report -- limit = 100% -- filter = "\ $ event-> {add_column} = length (\ $ event-> {arg }) and \ $ event-> {serverid} = $ lepus_server_id "$ slowquery_file>/tmp/lepus_slowquery.log
Set a new slow query log
Tmp_log = '$ mysql_client-h $ mysql_host-P $ mysql_port-u $ mysql_user-p $ mysql_password-e "select concat (' $ slowquery_dir ', 'slowquery _', date_format (now (), '% Y % m % d % H '),'. log'); "| grep log | sed-n-e '2p''
Config mysql slowquery
$ Mysql_client-h $ mysql_host-P $ mysql_port-u $ mysql_user-p $ mysql_password-e "set global slow_query_log = 1; set global long_query_time = $ slowquery_long_time ;"
$ Mysql_client-h $ mysql_host-P $ mysql_port-u $ mysql_user-p $ mysql_password-e "set global slow_query_log_file = '$ tmp_log ';"
Delete log before 7 days
Cd $ slowquery_dir
/Usr/bin/find./-name 'slowquery _ * '-mtime + 7 | xargs rm-rf;
Note: The value of lepus_server_id must be obtained from the system. Enter the MySQL server configuration, and query the current ID before the host where the script is deployed, that is, the server_id of the host.
Reference website
- Official Docker website
- Lepus Official Website
For more Docker tutorials, see the following:
Docker installation application (CentOS 6.5_x64) https://www.bkjia.com/Linux/2014-07/104595.htm
Configuration on Ubuntu 16.04 server using Docker https://www.bkjia.com/Linux/2017-06/145176.htm
Install Docker https://www.bkjia.com/Linux/2015-07/120444.htm in Ubuntu 15.04
Docker installation instance https://www.bkjia.com/Linux/2017-04/142666.htm
Docker create basic image https://www.bkjia.com/Linux/2017-05/144112.htm
How to install Docker and basic usage https://www.bkjia.com/Linux/2015-09/122885.htm on Ubuntu 15.04
Docker Use note https://www.bkjia.com/Linux/2016-12/138490.htm on Ubuntu 16.04
Use Docker to start https://www.bkjia.com/Linux/2017-04/142649.htm of frequently used applications in minutes
Ubuntu 16.04 Docker modify configuration file does not take effect solution https://www.bkjia.com/Linux/2017-05/143862.htm
Docker details: click here
Docker: click here
This article permanently updates link: https://www.bkjia.com/Linux/2018-03/151324.htm