Mysql database optimization series (2) ------AWK script statistics database performance parameters

WBOY
Release: 2016-08-08 09:32:03
Original
1000 people have browsed it

1. Check the database performance:

Show status;

Select a few more important parameters

2. AWK simple script programming to implement database performance statistics 1. Create a new Vi score.txt

2 .Write the following data:

3. Refresh once every second and write to a file for analysis

3. Introduction to AWK syntax

Awk

is a simple literal text processing The tool

. is good at processing --data with multiple rows and columns. Processing process

:

While(

There is also the next row

) {1:

Read the next row

,and assign the next row to $0,each column Assign to $1,$2...$Nvariable 2:

Use the specified command to process the line

}

How to process

1

line data?Answer

:

points2part, pattern (condition) + action(processing action)The 1st simple

awk scriptawk '{printf "%sn" , $1}' xx.txt // Output each line of

xx.txtth 2

A simple awkscript statisticsmysql Server informationmysqladmin -uroot ext|awk 'Queries/{q=$4}/Threads_connected/{c=$4}/Threads_running/{r=$4}END{printf("%d %d %dn" ,q,c,r)}'


The above introduces the Mysql database optimization series (2)------AWK script statistics database performance parameters, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template