웹사이트 검색

Innotop을 설치하여 MySQL 서버 성능 모니터링


InnotopInnoDB 엔진에서 실행되는 로컬 및 원격 MySQL 서버를 모니터링하는 'top 명령'과 유사한 훌륭한 명령줄 프로그램입니다. Innotop에는 다양한 기능과 다양한 유형의 모드/옵션이 포함되어 있어 MySQL 성능의 다양한 측면을 모니터링하고 데이터베이스 관리자가 MySQL 서버에 어떤 문제가 있는지 찾는 데 도움이 됩니다.

예를 들어, Innotopmysql 복제 상태, 사용자 통계, 쿼리 목록, InnoDB 버퍼를 모니터링하는 데 도움이 됩니다. , InnoDB I/O 정보, 테이블 열기, 테이블 잠금 등은 정기적으로 데이터를 새로 고치므로 업데이트된 결과.

Innotop은 뛰어난 기능과 유연성을 제공하며 추가 구성이 필요하지 않으며 터미널에서 'innotop' 명령을 실행하기만 하면 실행할 수 있습니다.

Innotop 설치(MySQL 모니터링)

기본적으로 innotop 패키지는 RHEL, CentOS와 같은 Linux 배포판에 포함되지 않습니다. , FedoraScientific Linux. 아래와 같이 타사 epel 저장소를 활성화하고 yum 명령을 사용하여 설치해야 합니다.

yum install innotop
샘플 출력
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.mirror.net.in
 * epel: epel.mirror.net.in
 * epel-source: epel.mirror.net.in
 * extras: centos.mirror.net.in
 * updates: centos.mirror.net.in
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package innotop.noarch 0:1.9.0-3.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================
 Package			Arch		Version			Repository		Size
==========================================================================================================
Installing:
 innotop                        noarch          1.9.0-3.el6             epel                    149 k

Transaction Summary
==========================================================================================================
Install       1 Package(s)

Total download size: 149 k
Installed size: 489 k
Is this ok [y/N]: y
Downloading Packages:
innotop-1.9.0-3.el6.noarch.rpm                                                      | 149 kB    00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : innotop-1.9.0-3.el6.noarch							1/1 
  Verifying  : innotop-1.9.0-3.el6.noarch                                                       1/1 

Installed:
  innotop.noarch 0:1.9.0-3.el6                                                                                                                                 

Complete!

innotop을 시작하려면 “innotop”을 입력하고 -u(사용자 이름) 및 - 옵션을 지정하면 됩니다. p (password)를 각각 명령줄에서 입력하고 Enter를 누르세요.

innotop -u root -p 'tecm1nt'

MySQL 서버에 연결하면 다음 화면과 비슷한 내용이 표시됩니다.

[RO] Dashboard (? for help)                                                                    localhost, 61d, 254.70 QPS, 5/2/200 con/run/cac thds, 5.1.61-log
Uptime  MaxSQL  ReplLag  Cxns  Lock  QPS     QPS  Run  Run  Tbls  Repl   SQL
   61d                      4     0  254.70  _         _     462  Off 1
Innotop 도움말

명령줄 옵션 및 사용법 요약을 보려면 "?"를 누르세요.

Switch to a different mode:
   A  Dashboard         I  InnoDB I/O Info     Q  Query List
   B  InnoDB Buffers    K  InnoDB Lock Waits   R  InnoDB Row Ops
   C  Command Summary   L  Locks               S  Variables & Status
   D  InnoDB Deadlocks  M  Replication Status  T  InnoDB Txns
   F  InnoDB FK Err     O  Open Tables         U  User Statistics

Actions:
   d  Change refresh interval        p  Pause innotop
   k  Kill a query's connection      q  Quit innotop
   n  Switch to the next connection  x  Kill a query

Other:
 TAB  Switch to the next server group   /  Quickly filter what you see
   !  Show license and warranty         =  Toggle aggregation
   #  Select/create server groups       @  Select/create server connections
   $  Edit configuration settings       \  Clear quick-filters
Press any key to continue

이 섹션에는 innotop 사용에 대한 스크린샷이 포함되어 있습니다. 모드 간을 전환하려면 대문자 키를 사용하세요.

사용자 통계

이 모드는 읽기별로 정렬된 사용자 통계색인 통계를 표시합니다.

CXN        When   Load  QPS    Slow  QCacheHit  KCacheHit  BpsIn    BpsOut 
localhost  Total  0.00  1.07k   697      0.00%     98.17%  476.83k  242.83k
쿼리 목록

이 모드는 mytop의 쿼리 목록 모드와 유사하게 SHOW FULL PROCESSLIST의 출력을 표시합니다. 이 기능은 InnoDB 정보를 표시하지 않으며 일반적인 사용에 가장 유용합니다.

When   Load  Cxns  QPS   Slow  Se/In/Up/De%             QCacheHit  KCacheHit  BpsIn    BpsOut
Now    0.05     1  0.20     0   0/200/450/100               0.00%    100.00%  882.54   803.24
Total  0.00   151  0.00     0  31/231470/813290/188205      0.00%     99.97%    1.40k    0.22

Cmd      ID      State               User      Host           DB      Time      Query
Connect      25  Has read all relay  system u                         05:26:04
InnoDB I/O 정보

이 모드는 InnoDB의 I/O 통계, 보류 중인 I/O, I/O 스레드, 파일 I/O를 표시합니다. > 및 로그 통계 테이블은 기본적으로 제공됩니다.

____________________ I/O Threads ____________________
Thread  Purpose               Thread Status          
     0  insert buffer thread  waiting for i/o request
     1  log thread            waiting for i/o request
     2  read thread           waiting for i/o request
     3  write thread          waiting for i/o request

____________________________ Pending I/O _____________________________
Async Rds  Async Wrt  IBuf Async Rds  Sync I/Os  Log Flushes  Log I/Os
        0          0               0          0            0         0

________________________ File I/O Misc _________________________
OS Reads  OS Writes  OS fsyncs  Reads/Sec  Writes/Sec  Bytes/Sec
      26          3          3       0.00        0.00          0

_____________________ Log Statistics _____________________
Sequence No.  Flushed To  Last Checkpoint  IO Done  IO/Sec
0 5543709     0 5543709   0 5543709              8    0.00
InnoDB 버퍼

이 섹션에서는 InnoDB 버퍼 풀, 페이지 통계, 버퍼 삽입적응형 해시 인덱스에 대한 정보를 볼 수 있습니다. >. 데이터는 SHOW INNODB STATUS에서 가져옵니다.

__________________________ Buffer Pool __________________________
Size  Free Bufs  Pages  Dirty Pages  Hit Rate  Memory  Add'l Pool
 512        492     20            0  --        16.51M     841.38k

____________________ Page Statistics _____________________
Reads  Writes  Created  Reads/Sec  Writes/Sec  Creates/Sec
   20       0        0       0.00        0.00         0.00

______________________ Insert Buffers ______________________
Inserts  Merged Recs  Merges  Size  Free List Len  Seg. Size
      0            0       0     1              0          2

__________________ Adaptive Hash Index ___________________
Size    Cells Used  Node Heap Bufs  Hash/Sec  Non-Hash/Sec
33.87k                           0      0.00          0.00
InnoDB 행 작업

여기서는 InnoDB 행 작업, 기타 행 작업, 세마포어대기 배열 테이블의 출력을 볼 수 있습니다. 기본적으로.

________________ InnoDB Row Operations _________________
Ins  Upd  Read  Del  Ins/Sec  Upd/Sec  Read/Sec  Del/Sec
  0    0     0    0     0.00     0.00      0.00     0.00

________________________ Row Operation Misc _________________________
Queries Queued  Queries Inside  Rd Views  Main Thread State          
             0               0         1  waiting for server activity

_____________________________ InnoDB Semaphores _____________________________
Waits  Spins  Rounds  RW Waits  RW Spins  Sh Waits  Sh Spins  Signals  ResCnt
    2      0      41         1         1         2         4        5       5

____________________________ InnoDB Wait Array _____________________________
Thread  Time  File  Line  Type  Readers  Lck Var  Waiters  Waiting?  Ending?
명령 요약

명령 요약 모드는 아래와 유사한 모든 cmd_summary 테이블을 표시합니다.

_____________________ Command Summary _____________________
Name                    Value     Pct     Last Incr  Pct   
Com_update              11980303  65.95%          2  33.33%
Com_insert               3409849  18.77%          1  16.67%
Com_delete               2772489  15.26%          0   0.00%
Com_select                   507   0.00%          0   0.00%
Com_admin_commands           411   0.00%          1  16.67%
Com_show_table_status        392   0.00%          0   0.00%
Com_show_status              339   0.00%          2  33.33%
Com_show_engine_status       164   0.00%          0   0.00%
Com_set_option               162   0.00%          0   0.00%
Com_show_tables               92   0.00%          0   0.00%
Com_show_variables            84   0.00%          0   0.00%
Com_show_slave_status         72   0.00%          0   0.00%
Com_show_master_status        47   0.00%          0   0.00%
Com_show_processlist          43   0.00%          0   0.00%
Com_change_db                 27   0.00%          0   0.00%
Com_show_databases            26   0.00%          0   0.00%
Com_show_charsets             24   0.00%          0   0.00%
Com_show_collations           24   0.00%          0   0.00%
Com_alter_table               12   0.00%          0   0.00%
Com_show_fields               12   0.00%          0   0.00%
Com_show_grants               10   0.00%          0   0.00%
변수 및 상태

이 섹션에서는 초당 쿼리 수와 같은 통계를 계산하여 다양한 모드로 표시합니다.

QPS     Commit_PS     Rlbck_Cmt  Write_Commit     R_W_Ratio      Opens_PS   Tbl_Cch_Usd    Threads_PS  Thrd_Cch_Usd CXN_Used_Ever  CXN_Used_Now
  0             0             0      18163174             0             0             0             0             0          1.99          1.32
  0             0             0      18163180             0             0             0             0             0          1.99          1.32
  0             0             0      18163188             0             0             0             0             0          1.99          1.32
  0             0             0      18163192             0             0             0             0             0          1.99          1.32
  0             0             0      18163217             0             0             0             0             0          1.99          1.32
  0             0             0      18163265             0             0             0             0             0          1.99          1.32
  0             0             0      18163300             0             0             0             0             0          1.99          1.32
  0             0             0      18163309             0             0             0             0             0          1.99          1.32
  0             0             0      18163321             0             0             0             0             0          1.99          1.32
  0             0             0      18163331             0             0             0             0             0          1.99          1.32
복제 상태

이 모드에서는 슬레이브 SQL 상태, 슬레이브 I/O 상태마스터 상태의 출력을 볼 수 있습니다. 처음 두 섹션에는 슬레이브 상태슬레이브 I/O 스레드 상태가 표시되고 마지막 섹션에는 마스터 상태가 표시됩니다.

_______________________ Slave SQL Status _______________________
Master        On?  TimeLag  Catchup  Temp  Relay Pos  Last Error
172.16.25.125  Yes    00:00     0.00     0   41295853            

____________________________________ Slave I/O Status _____________________________________
Master        On?  File              Relay Size  Pos       State                           
172.16.25.125  Yes  mysql-bin.000025      39.38M  41295708  Waiting for master to send event

____________ Master Status _____________
File              Position  Binlog Cache
mysql-bin.000010  10887846         0.00%
비대화형

비대화형으로 "innotop"을 실행할 수 있습니다.

innotop --count 5 -d 1 -n
uptime	max_query_time	time_behind_master	connections	locked_count	qps	spark_qps	run	spark_run	open	slave_running	longest_sql
61d			2	0	0.000363908088893752				64	Yes 	
61d			2	0	4.96871146980749	_		_	64	Yes 	
61d			2	0	3.9633543857494	^_		__	64	Yes 	
61d			2	0	3.96701862656428	^__		___	64	Yes 	
61d			2	0	3.96574802684297	^___		____	64	Yes
원격 데이터베이스 모니터링

원격 시스템의 원격 데이터베이스를 모니터링하려면 특정 사용자 이름, 비밀번호호스트 이름을 사용하여 다음 명령을 사용합니다.

innotop -u username -p password -h hostname

'innotop' 사용법 및 옵션에 대한 자세한 내용은 터미널에서 'man innotop'을 눌러 매뉴얼 페이지를 참조하세요.

참조 링크

이노탑 홈페이지

추가 읽기:

  1. RHEL/CentOS/Fedora의 Mtop(MySQL 데이터베이스 모니터링)