In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article is about how to install and use mysqlsla. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Installation and use of mysqlsla
1. Mysqlsla
[root@localhost tmp] # wget http://hackmysql.com/scripts/mysqlsla-2.03.tar.gz
-- 19 45 Rose 45 Mustang-http://hackmysql.com/scripts/mysqlsla-2.03.tar.gz
Resolving hackmysql.com... 64.13.232.157
Connecting to hackmysql.com | 64.13.232.157 |: 80. Connected.
HTTP request sent, awaiting response... 200 OK
Length: 33674 (33K) [application/x-tar]
Saving to: `mysqlsla-2.03.tar.gz.2'
33674 50.2K/s in 0.7s
19:45:47 (50.2 KB/s)-`mysqlsla-2.03.tar.gz.2' saved [33674 Universe 33674]
two。 Decompression
[root@localhost tmp] # tar-zxvf mysqlsla-2.03.tar.gz
Mysqlsla-2.03/
Mysqlsla-2.03/Changes
Mysqlsla-2.03/INSTALL
Mysqlsla-2.03/README
Mysqlsla-2.03/Makefile.PL
Mysqlsla-2.03/bin/
Mysqlsla-2.03/bin/mysqlsla
Mysqlsla-2.03/META.yml
Mysqlsla-2.03/lib/
Mysqlsla-2.03/lib/mysqlsla.pm
Mysqlsla-2.03/MANIFEST
[root@localhost tmp] # cd mysqlsla-2.03
[root@localhost mysqlsla-2.03] # ls
Bin Changes INSTALL lib Makefile.PL MANIFEST META.yml README
3. Execute a perl script to check package dependencies
[root@localhost mysqlsla-2.03] # perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for mysqlsla
4. Installation
[root@localhost mysqlsla-2.03] # make & & make install
Cp lib/mysqlsla.pm blib/lib/mysqlsla.pm
Cp bin/mysqlsla blib/script/mysqlsla
/ usr/bin/perl "- MExtUtils::MY"-e "MY- > fixin (shift)" blib/script/mysqlsla
Manifying blib/man3/mysqlsla.3pm
Installing / usr/lib/perl5/site_perl/5.8.8/mysqlsla.pm
Installing / usr/share/man/man3/mysqlsla.3pm
Installing / usr/bin/mysqlsla
Writing / usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/mysqlsla/.packlist
Appending installation info to / usr/lib/perl5/5.8.8/i386-linux-thread-multi/perllocal.pod
[root@localhost mysqlsla-2.03] #
5. Easy to use
Syntax:
Slow log: mysqlsla-lt slow slow.log
General log: mysqlsla-lt general general.log
Binary log: mysqlbinlog bin.log | mysqlsla-lt binary-
Take slow log as an example:
[root@localhost mysqlsla-2.03] # mysqlsla- lt slow / tmp/127_slow.log | more
Report for slow logs: / tmp/127_slow.log
24 queries total, 6 unique
Sorted by'tasking summation'
Grand Totals: Time 16 s, Lock 1 s, Rows sent 18, Rows Examined 2.10M
_ 001 _
Count: 18 (75.00%)
Time: 15 s total, 833.333 ms avg, 0 to 8 s max (93.75%)
95% of Time: 7 s total, 411.765 ms avg, 0 to 4 s max
Lock Time (s): 0 total, 0 avg, 0 to 0 max (0.005%)
95% of Lock: 0 total, 0 avg, 0 to 0 max
Rows sent: 0 avg, 0 to 0 max (0.005%)
Rows examined: 116.51k avg, 8 to 1.05m max (99.99%)
Database:
Users:
Root@localhost: 100.00% (18) of query, 100.00% (24) of all users
Query abstract:
INSERT INTO T2 SELECT * FROM T2
Query sample:
Insert into T2 select * from T2
.
Option description:
Total number of queries (queries total), number of sql removed (unique)
Sort the contents of the output report (sorted by)
The most significant slow sql statistics, including average execution time, waiting lock time, total number of resulting rows, total number of rows scanned.
The number of Count, sql execution and its percentage in the total slow log.
Time, execution time, including total time, average time, minimum, maximum time, time as a percentage of total slow sql time.
95% of Time, removal of the fastest and slowest sql, coverage accounted for 95% of the sql execution time.
Lock Time, waiting time for the lock.
95% of Lock, 95% slow sql waiting lock time.
Rows sent, the number of result rows, including average, minimum, and maximum.
Rows examined, the number of rows scanned.
Database, which one does it belong to
Users, which user, IP, accounts for the percentage of sql executed by all users
Query abstract, abstract sql statement
Query sample, sql statement
Description of sla common parameters:
1)-log-type (- lt) type logs:
This parameter is used to determine the type of log, mainly slow, general, binary, msl, udl, and slow when analyzing slow log.
2)-sort:
Determine what parameters are used to sort the analysis results, which is sorted by t_sum by default.
T_sum: sort by total time
C_sum: sort by total number
C_sum_p: the percentage of the total number of times the sql statement was executed.
3)-top:
Displays the number of sql. The default is 10, indicating how many items are sorted by rule.
4)-statement-filter (- sf) [+ -] [TYPE]:
Filter the types of sql statements, such as select, update, drop.
[TYPE] there are SELECT, CREATE, DROP, UPDATE, INSERT, such as "+ SELECT,INSERT". If it does not appear, the default is -, that is, not included.
5) db: the log of which library to process:
For example, take only the select statement of the backup library and the first two records sorted by c_sum_p
[root@localhost mysqlsla-2.03] # mysqlsla- lt slow-sort c_sum_p-sf "+ select"-db backup-top 2 / tmp/127_slow.log
Report for slow logs: / tmp/127_slow.log
4 queries total, 3 unique
Sorted by 'caterpillar summed up p'
Grand Totals: Time 1 s, Lock 1 s, Rows sent 18, Rows Examined 195
_ 001 _
Count: 2 (50.005%)
Time: 0 total, 0 avg, 0 to 0 max (0.005%)
Lock Time (s): 0 total, 0 avg, 0 to 0 max (0.005%)
Rows sent: 1 avg, 1 to 1 max (11.11%)
Rows examined: 86 avg, 77 to 94 max (87.69%)
Database:
Users:
Root@localhost: 100.00% (2) of query, 100.00% (4) of all users
Query abstract:
SELECT SUM (format (duration,N)) AS duration FROM information_schema.profiling WHERE query_id=N
Query sample:
Select sum (format (duration,6)) as duration from information_schema.profiling where query_id=7
_ 002 _
Count: 1 (25.00%)
Time: 1 s total, 1 s avg, 1 s to 1 s max (100.00%)
Lock Time (s): 1 s total, 1 s avg, 1 s to 1 s max (100.00%)
Rows sent: 4 avg, 4 to 4 max (22.22%)
Rows examined: 12 avg, 12 to 12 max (6.15%)
Database:
Users:
Root@localhost: 100.00% (1) of query, 100.00% (4) of all users
Query abstract:
SELECT * FROM tt WHERE aura N
Query sample:
Select * from tt where axiom 2
[root@localhost mysqlsla-2.03] #
[root@localhost mysqlsla-2.03] #
Thank you for reading! This is the end of the article on "how to install and use mysqlsla". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.