91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

【MySQL】數據庫慢查詢日志分析--Lepus

發布時間:2020-06-26 19:07:43 來源:網絡 閱讀:540 作者:NOGYMS 欄目:MySQL數據庫
[root@wallet04?~]#?wget?https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
[root@wallet04?~]#?rpm?-ivh?epel-release-latest-6.noarch.rpm
[root@wallet04?~]#?rpm?-ivh?https://mirror.webtatic.com/yum/el6/latest.rpm?

[root@wallet04?~]#?yum?install?-y?httpd?php56w.x86_64?php56w-cli.x86_64?php56w-common.x86_64?php56w-devel.x86_64?\
php56w-gd.x86_64?php56w-ldap.x86_64?php56w-mbstring.x86_64?php56w-bcmath.x86_64?php56w-xml.x86_64?\
php56w-mysqlnd.x86_64?php56w-pdo.x86_64

[root@wallet04?~]#?vi?/etc/httpd/conf/httpd.conf?
ServerName?192.168.1.204:80

[root@wallet04?~]#?service?httpd?start
Starting?httpd:????????????????????????????????????????????[??OK??]
[root@wallet04?~]#?service?httpd?status
httpd?(pid??1424)?is?running...

[root@wallet04?~]#?vi?/etc/php.ini?
date.timezone?=?Asia/Shanghai

[root@wallet04?~]#?php?-v
PHP?5.6.40?(cli)?(built:?Jan?12?2019?09:19:57)?
Copyright?(c)?1997-2016?The?PHP?Group
Zend?Engine?v2.6.0,?Copyright?(c)?1998-2016?Zend?Technologies

安裝MySQL?5.6
https://blog.51cto.com/13598811/2349351

[root@wallet04?~]#?python?-V
Python?2.6.6

[root@wallet04?~]#?yum?install?-y?python-pip

[root@wallet04?~]#?pip?-V
pip?7.1.0?from?/usr/lib/python2.6/site-packages?(python?2.6)

[root@wallet04?~]#?pip?install?MySQL-python

[root@wallet04?~]#?cd?lepus/python
[root@wallet04?python]#?python?test_driver_mysql.py?
MySQL?python?drivier?is?ok!

[root@wallet04?~]#?cd?lepus/sql
[root@wallet04?sql]#?mysql?-u?root?-pabcd.1234
mysql>?create?database?lepus?default?character?set?utf8;
Query?OK,?1?row?affected?(0.00?sec)

mysql>?grant?all?on?lepus.*?to?'lepus'@'%'?identified?by?'lepus';
Query?OK,?0?rows?affected?(0.00?sec)

mysql>?flush?privileges;
Query?OK,?0?rows?affected?(0.00?sec)

mysql>?use?lepus
Database?changed

mysql>?source?lepus_table.sql
mysql>?source?lepus_data.sql

mysql>?alter?table?mysql_slow_query_review?modify?checksum?varchar(100)?not?null;
Query?OK,?0?rows?affected?(0.95?sec)

mysql>?alter?table?mysql_slow_query_review_history?modify?checksum?varchar(100)?not?null;?
Query?OK,?0?rows?affected?(0.73?sec)

[root@wallet04?~]#?cd?lepus/python
[root@wallet04?python]#?chmod?+x?install.sh
[root@wallet04?python]#?./install.sh
[note]?lepus?will?be?install?on?basedir:?/usr/local/lepus
[note]?/usr/local/lepus?directory?does?not?exist,will?be?created.
[note]?/usr/local/lepus?directory?created?success.
[note]?wait?copy?files.......
[note]?change?script?permission.
[note]?create?links.
[note]?install?complete.

[root@wallet04?~]#?cd?/usr/local/lepus
[root@wallet04?lepus]#?vim?etc/config.ini
###監控機MySQL數據庫連接地址###
[monitor_server]
host="localhost"
port=3306
user="lepus"
passwd="lepus"
dbname="lepus"

[root@wallet04?~]#?cd?lepus
[root@wallet04?lepus]#?cp?-rf?php/*?/var/www/html/

[root@wallet04?~]#?cd?/var/www/html/application/config
[root@wallet04?config]#?vim?database.php?
$db['default']['hostname']?=?'localhost';
$db['default']['port']?????=?'3306';
$db['default']['username']?=?'lepus';
$db['default']['password']?=?'lepus';
$db['default']['database']?=?'lepus';
$db['default']['dbdriver']?=?'mysql';
$db['default']['dbprefix']?=?'';
$db['default']['pconnect']?=?TRUE;
$db['default']['db_debug']?=?TRUE;
$db['default']['cache_on']?=?FALSE;
$db['default']['cachedir']?=?'';
$db['default']['char_set']?=?'utf8';
$db['default']['dbcollat']?=?'utf8_general_ci';
$db['default']['swap_pre']?=?'';
$db['default']['autoinit']?=?TRUE;
$db['default']['stricton']?=?FALSE;

[root@wallet04?~]#?cd?/usr/local/lepus
[root@wallet04?lepus]#?lepus?start
lepus?server?start?success!
[root@wallet04?lepus]#?lepus?status
lepus?server?is?running...

[root@wallet04?~]#?vim?/var/www/html/application/controllers/lp_mysql.php
337行
parent::check_privilege('mysql/replication')修改為parent::check_privilege()


[root@wallet01?~]#?wget?https://repo.percona.com/yum/percona-release-latest.noarch.rpm
[root@wallet01?~]#?rpm?-ivh?percona-release-latest.noarch.rpm

[root@wallet01?~]#?yum?install?-y?percona-toolkit

[root@wallet01?~]#?pt-query-digest?--version
pt-query-digest?3.1.0

[root@wallet01?~]#?cd?/usr/local/sbin
[root@wallet01?sbin]#?vi?lepus_slowquery.sh
#!/bin/bash
#config?lepus?database?server
lepus_db_host="192.168.1.204"
lepus_db_port=3306
lepus_db_user="lepus"
lepus_db_password="lepus"
lepus_db_database="lepus"

#config?mysql?server
mysql_client=`which?mysql`
mysql_host="192.168.1.201"
mysql_port=3306
mysql_user="root"
mysql_password="abcd.1234"

#config?slowqury
slowquery_dir="/var/lib/mysql/"
slowquery_long_time=2
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}'`

#config?server_id
lepus_server_id=274

#collect?mysql?slowquery?log?into?lepus?database
/usr/local/bin/pt-query-digest?--user=$lepus_db_user?--password=$lepus_db_password?--port=$lepus_db_port?--charset=utf8?--review?h=$lepus_db_host,D=$lepus_db_database,t=mysql_slow_query_review??--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

#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?;

[root@wallet01?sbin]#?chmod?a+x?lepus_slowquery.sh

[root@wallet01?~]#?crontab?-l
*/5?*?*?*?*?sh?/usr/local/sbin/lepus_slowquery.sh?>?/dev/null?2>&1


[root@wallet01?~]#?ls?-l?oracle-instantclient11.2*
-rw-r--r--?1?root?root?59865008?Dec??3?11:06?oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
-rw-r--r--?1?root?root???610222?Dec??3?11:04?oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm
-rw-r--r--?1?root?root???828333?Dec??3?11:04?oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm

[root@wallet01?~]#?rpm?-ivh?oracle-instantclient11.2-*

[root@wallet01?~]#?vim?/root/.bash_profile
export?ORACLE_HOME=/usr/lib/oracle/11.2/client64
export?PATH=$PATH:$ORACLE_HOME/bin
export?LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:/usr/local/lib

[root@wallet04?~]#?source?/root/.bash_profile

[root@wallet01?~]#?vim?/etc/ld.so.conf?
include?ld.so.conf.d/*.conf
/usr/lib/oracle/11.2/client64/lib

[root@wallet01?~]#?ldconfig

[root@wallet01?~]#?pip?install?cx-Oracle

[root@wallet01?~]#?cd?/usr/local/lepus

[root@wallet01?lepus]#?python?test_driver_oracle.py
Oracle?python?drivier?is?ok!









向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

新竹市| 扎赉特旗| 会泽县| 泗阳县| 石渠县| 吴忠市| 通海县| 贵德县| 平舆县| 赞皇县| 香港| 吴旗县| 德保县| 巴林左旗| 达孜县| 阿拉善左旗| 武夷山市| 都匀市| 阿合奇县| 安福县| 那曲县| 合作市| 江西省| 诸城市| 紫阳县| 兰州市| 贵南县| 南木林县| 全州县| 武城县| 蕲春县| 禹州市| 呼玛县| 杭锦旗| 聂拉木县| 亚东县| 齐河县| 饶阳县| 娄烦县| 陕西省| 抚松县|