Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Several Monitoring script commands commonly used in mysql

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Next, let's learn about several commonly used monitoring script commands in mysql. I believe you will benefit a lot after reading it. There are not many words in the text. I hope the short content of several commonly used monitoring script commands in mysql is what you want.

[java]

# / bin/sh

# check whether mysql server provides services normally

Mysqladmin-u sky-ppwd-h localhost ping

# get several current status values of mysql

Mysqladmin-u sky-ppwd-h localhost status

# get the current connection information of the database

Mysqladmin-u sky-ppwd-h localhost processlist

# mysql dump data Export

Mysqldump-uroot-T/tmp/mysqldump test test_outfile-fields-enclosed-by=\ "- fields-terminated-by=

# mysql data Import

Mysqlimport-user=name-password=pwd test-fields-enclosed-by=\ "- fields-terminated-by=, / tmp/test_outfile.txt

LOAD DATA INFILE'/ tmp/test_outfile.txt' INTO TABLE test_outfile FIELDS TERMINATED BY'"'ENCLOSED BY','

# mysql process Monitoring

Ps-ef | grep "mysqld_safe" | grep-v "grep"

Ps-ef | grep "mysqld" | grep-v "mysqld_safe" | grep-v "grep"

# View the status of the current database

Mysql-u root-p123456-e 'show status'

# mysqlcheck tool program can check (check), repair (repair), analyze (analyze) and optimize (optimize) tables in MySQL Server

Mysqlcheck-u root-p123456-- all-databases

# mysql qps query QPS = Questions (or Queries) / Seconds

Mysql-u root-p123456-e 'SHOW / *! 50000 GLOBAL * / STATUS LIKE "Questions"'

Mysql-u root-p123456-e 'SHOW / *! 50000 GLOBAL * / STATUS LIKE "Queries"'

# mysql Key Buffer hit rate key_buffer_read_hits = (1-Key_reads / Key_read_requests) * 100% key_buffer_write_hits= (1-Key_writes / Key_write_requests) * 100%

Mysql-u root-p123456-e 'SHOW / *! 50000 GLOBAL * / STATUS LIKE "Key%"'

# mysql Innodb Buffer hit rate innodb_buffer_read_hits= (1-Innodb_buffer_pool_reads/Innodb_buffer_pool_read_requests) * 100%

Mysql-u root-p123456-e 'SHOW / *! 50000 GLOBAL * / STATUS LIKE "Innodb_buffer_pool_read%"'

# mysql Query Cache hit rate Query_cache_hits= (Qcache_hits / (Qcache_hits + Qcache_inserts)) * 100%

Mysql-u root-p123456-e 'SHOW / *! 50000 GLOBAL * / STATUS LIKE "Qcache%"'

# mysql Table Cache status quantity

Mysql-u root-p123456-e 'SHOW / *! 50000 GLOBAL * / STATUS LIKE "Open%"'

# mysql Thread Cache hit rate Thread_cache_hits = (1-Threads_created / Connections) * 100% normally, it is reasonable for Thread Cache hit rate to be above 90%.

Mysql-u root-p123456-e 'SHOW / *! 50000 GLOBAL * / STATUS LIKE "Thread%"'

# mysql lock status: lock states include table locks and row locks. We can obtain the total number of locks, the number of times other threads wait caused by locks, and the lock waiting time information through the system state variables.

Mysql-u root-p123456-e 'SHOW / *! 50000 GLOBAL * / STATUS LIKE "% lock%"'

# mysql replication delay is executed on the slave node

Mysql-u root-p123456-e 'SHOW SLAVE STATUS'

# mysql Tmp table status Tmp Table is mainly used to monitor whether MySQL uses too many temporary tables and whether any temporary tables are so large that they have to be swapped out of memory to disk files

Mysql-u root-p123456-e 'SHOW / *! 50000 GLOBAL * / STATUS LIKE "Created_tmp%"'

# mysql Binlog Cache usage: Binlog Cache is used to store Binlog messages that have not been written to disk.

Mysql-u root-p123456-e 'SHOW / *! 50000 GLOBAL * / STATUS LIKE "Binlog_cache%"'

# mysql nnodb_log_waits quantity: the Innodb_log_waits status variable directly reflects the number of waits caused by insufficient Innodb Log Buffer space

Mysql-u root-p123456-e 'SHOW / *! 50000 GLOBAL * / STATUS LIKE "Innodb_log_waits'

After reading this article on several commonly used monitoring script commands in mysql, many readers will certainly want to know more about it. For more industry information, you can follow our industry information section.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report