本篇內(nèi)容主要講解“MySQL tools中的orzdba舉例分析”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實(shí)用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“Mysql tools中的orzdba舉例分析”吧!
創(chuàng)新互聯(lián)公司主營金鄉(xiāng)網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營網(wǎng)站建設(shè)方案,App定制開發(fā),金鄉(xiāng)h5微信小程序定制開發(fā)搭建,金鄉(xiāng)網(wǎng)站營銷推廣歡迎金鄉(xiāng)等地區(qū)企業(yè)咨詢
mysql工具集:orzdba
修改代碼160行左右配置MySQL的相關(guān)驗(yàn)證信息,如username,password,host,port,sock等
安裝tcprstat
安裝orzdba_rt_depend_perl_module.tar.gz依賴包(version模塊、Class-Data-Inheritable模塊、Module-Build模塊、File-Lockfile模塊)
cd Perl_Module/
perl Makefile.PL
make
make install
cd Module-Build-0.31
perl Makefile.PL
make
make install
cd File-Lockfile-v1.0.5
perl Build.PL
perl ./Build
perl ./Build test
perl ./Build install
cd version-0.99
perl Makefile.PL
make
make install
mv orzdba.txt orzdba
./orzdba.sh --help
grep -n 'my $MYSQL' orzdba
root@pts/1 # 修改代碼:
160 my $MYSQL = qq{mysql -s –skip-column-names -uroot -P$port };
161 $MYSQL .= qq{-S$socket } if defined $socket;
162 my $TCPRSTAT = “/usr/bin/tcprstat –no-header -t 1 -n 0 -p $port”;
修改為:
這個(gè)步驟可以不用,主要是因?yàn)橛忻艽a報(bào)警
160 my $MYSQL = qq{mysql -s –skip-column-names -uroot -P$port -h227.0.0.1 -p12345678 };
161 $MYSQL .= qq{-S$socket } if defined $socket;
162 my $TCPRSTAT = “/usr/bin/tcprstat –no-header -t 1 -n 0 -p $port”;
報(bào)錯(cuò)處理:
ERROR 1054 (42S22) at line 1: Unknown column 'Com_select' in 'where clause'
修改代碼如下:
-e 'show variables where Variable_name in ("sync_binlog","max_connections","max_user_connections","max_connect_errors","table_open_cache","table_definition_cache","thread_cache_size","binlog_format","open_files_limit","max_binlog_size","max_binlog_cache_size")'
改成:
-e "show variables where Variable_name in ('sync_binlog','max_connections','max_user_connections','max_connect_errors','table_open_cache','table_definition_cache','thread_cache_size','binlog_format','open_files_limit','max_binlog_size','max_binlog_cache_size')"
錯(cuò)誤代碼
-e 'show variables where Variable_name in ("innodb_flush_log_at_trx_commit","innodb_flush_method","innodb_buffer_pool_size","innodb_max_dirty_pages_pct","innodb_log_buffer_size","innodb_log_fil e_size","innodb_log_files_in_group","innodb_thread_concurrency","innodb_file_per_table","innodb_adaptive_hash_index","innodb_open_files","innodb_io_capacity","innodb_read_io_threads","innodb_write_io_threads","innodb_adaptive_fl ushing","innodb_lock_wait_timeout","innodb_log_files_in_group")'
改成
-e "show variables where Variable_name in ('innodb_flush_log_at_trx_commit','innodb_flush_method','innodb_buffer_pool_size','innodb_max_dirty_pages_pct','innodb_log_buffer_size','innodb_log_fil e_size','innodb_log_files_in_group','innodb_thread_concurrency','innodb_file_per_table','innodb_adaptive_hash_index','innodb_open_files','innodb_io_capacity','innodb_read_io_threads','innodb_write_io_threads','innodb_adaptive_fl ushing','innodb_lock_wait_timeout','innodb_log_files_in_group')"
錯(cuò)誤代碼
-e 'show global status where Variable_name in ("Com_select","Com_insert","Com_update","Com_delete","Innodb_buffer_pool_read_requests","Innodb_buffer_pool_reads","Innodb_rows_inserted","Innodb_rows_updated","Innodb_rows_deleted","Innodb_rows_read","Threads_running","Threads_connected","Threads_cached","Threads_created","Bytes_received","Bytes_sent","Innodb_buffer_pool_pages_data","Innodb_buffer_pool_pages_free","Innodb_buffer_pool_pages_dirty","Innodb_buffer_pool_pages_flushed","Innodb_data_reads","Innodb_data_writes","Innodb_data_read","Innodb_data_written","Innodb_os_log_fsyncs","Innodb_os_log_written")'
改成
-e "show global status where Variable_name in ('Com_select','Com_insert','Com_update','Com_delete','Innodb_buffer_pool_read_requests','Innodb_buffer_pool_reads','Innodb_rows_inserted','Innodb_rows_updated','Innodb_rows_deleted','Innodb_rows_read','Threads_running','Threads_connected','Threads_cached','Threads_created','Bytes_received','Bytes_sent','Innodb_buffer_pool_pages_data','Innodb_buffer_pool_pages_free','Innodb_buffer_pool_pages_dirty','Innodb_buffer_pool_pages_flushed','Innodb_data_reads','Innodb_data_writes','Innodb_data_read','Innodb_data_written','Innodb_os_log_fsyncs','Innodb_os_log_written')"
去掉密碼告警信息
Warning: Using a password on the command line interface can be insecure.
創(chuàng)建加密密碼:
mysql_config_editor set --user=root --password
ls -alh .my*
mysql_config_editor print --all
或
cd root
[root@server11 ~]# more .my.cnf
[client]
user=root
password=123456
查看Linux主機(jī)指標(biāo)
./orzdba -sys -C 10 -i 1 -t -d sda3
-sys:打印系統(tǒng)信息,包括-t(打印當(dāng)前時(shí)間)、-l(打印負(fù)載信息,分1分鐘、5分鐘、15分鐘)、-c(打印cpu信息)、-s(打印交換分區(qū)信息)
-d:打印磁盤信息,需要指點(diǎn)磁盤設(shè)備名
-n:打印網(wǎng)絡(luò)信息,接收和發(fā)送大小,需要指點(diǎn)網(wǎng)卡設(shè)備名
查看MySQL響應(yīng)時(shí)間(rt)
通過調(diào)用tcprstat來監(jiān)控MySQL的響應(yīng)時(shí)間。
./orzdba -rt -C 10 -i 1 -t -d sda
監(jiān)控InnoDB的性能指標(biāo)
./orzdba -innodb -C 10 -i 1
監(jiān)控MySQL Server性能
./orzdba -mysql -C 10 -i 1
懶人模式:
nohup ./orzdba -lazy -d sda -C 5 -i 2 -L /tmp/orzdba.log > /dev/null 2>&1 &
-----------------
orzdba報(bào)表
1、運(yùn)行orzdba 收集mysql相關(guān)性能數(shù)據(jù),生成log.xxxx-xx-xx收集數(shù)據(jù)文件
這邊我對orzdba稍微做了些修改,為了獲得更加連續(xù)的數(shù)據(jù)
原:if ( $mycount%15 == 0 ) {
修改 193 行為 if ( $mycount%100000000 == 0 ) {
1 2 3 | ./orzdba -mysql -innodb_rows -C 500000 -i 5 \ -S /u01/tmp/mysql.sock \ -L /tmp/orzdba.log -logfile_by_day & |
2、使用orzdba_report.py分析orzdba.log.xxxx-xx-xx文件生成報(bào)表
orzdba_report.py源碼:orzdba_report
1 | python orzdba_report.py orzdba.log.2016-02-21 |
到此,相信大家對“Mysql tools中的orzdba舉例分析”有了更深的了解,不妨來實(shí)際操作一番吧!這里是創(chuàng)新互聯(lián)網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!
當(dāng)前題目:Mysqltools中的orzdba舉例分析
分享地址:http://muchs.cn/article48/jpdpep.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站內(nèi)鏈、響應(yīng)式網(wǎng)站、手機(jī)網(wǎng)站建設(shè)、全網(wǎng)營銷推廣、品牌網(wǎng)站建設(shè)、外貿(mào)網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)