当前位置: 首页 > 工具软件 > takeover.sh > 使用案例 >

mysql tuning primer_mysql检测工具tuning-primer.sh

薛焱
2023-12-01

mysql检测工具tuning-primer.sh

tuning-primer.sh帮助我们去查看一下mysql运行情况,产生报告,给出一些优化建议;

下载及使用:

1.wget http://www.day32.com/MySQL/tuning-primer.sh

2.将tuning-primer.sh拷贝到my.cnf同级目录

3.chmod +x tuning-primer.sh 执行:sh tuning-primer.sh

报告如下:

root@dbhostname:/opt/mysq/data> sh tuning-primer.sh all

Using login values from ~/.my.cnf

- INITIAL LOGIN ATTEMPT FAILED -

Testing for stored webmin passwords:

None Found

Could not auto detect login info!

Found potential sockets: /data/mysql/mysql.sock

/opt/mysql/data/mysql3307.sock

Using: /var/lib/mysql/mysql.sock

Would you like to provide a different socket?: [y/N] y   //指定mysql自己的socket目录

Socket: /opt/mysql/data/mysql3307.sock

Do you have your login handy ? [y/N] : y  //输入username/passwd

User: root

Password: 123456

Would you like me to create a ~/.my.cnf file for you? [y/N] : n    //不要再创建my.cnf 文件

-- MYSQL PERFORMANCE TUNING PRIMER --

- By: Matthew Montgomery -

MySQL Version 5.1.48-mysql5148-log x86_64

Uptime = 14 days 5 hrs 41 min 11 sec

Avg. qps = 0

Total Questions = 279

Threads Connected = 2

Server has been running for over 48hrs.

It should be safe to follow these recommendations

To find out more information on how each of these

runtime variables effects performance visit:

http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html

Visit http://www.mysql.com/products/enterprise/advisors.html

for info about MySQL's Enterprise Monitoring and Advisory Service

SLOW QUERIES

The slow query log is NOT enabled.

Current long_query_time = 1.000000 sec.

You have 0 out of 300 that take longer than 1.000000 sec. to complete

Your long_query_time seems to be fine

BINARY UPDATE LOG

The binary update log is enabled

WORKER THREADS

Current thread_cache_size = 0

Current threads_cached = 0

Current threads_per_sec = 1

Historic threads_per_sec = 0

Your thread_cache_size is fine

MAX CONNECTIONS

Current max_connections = 151

Current threads_connected = 2

Historic max_used_connections = 2

The number of used connections is 1% of the configured maximum.

You are using less than 10% of your configured max_connections.

Lowering max_connections could help to avoid an over-allocation of memory

See "MEMORY USAGE" section to make sure you are not over-allocating

INNODB STATUS

Current InnoDB index space = 52 M

Current InnoDB data space = 58 M

Current InnoDB buffer pool free = 77 %

Current innodb_buffer_pool_size = 16 M

Depending on how much space your innodb indexes take up it may be safe

to increase this value to up to 2 / 3 of total system memory

MEMORY USAGE

Max Memory Ever Allocated : 45 M

Configured Max Per-thread Buffers : 250 M

Configured Max Global Buffers : 42 M

Configured Max Memory Limit : 292 M

Physical Memory : 7.79 G

Max memory limit seem to be within acceptable norms

KEY BUFFER

Current MyISAM index space = 338 K

Current key_buffer_size = 16 M

Key cache miss rate is 1 : 2

Key buffer free ratio = 81 %

Your key_buffer_size seems to be fine

QUERY CACHE

Query cache is supported but not enabled

Perhaps you should set the query_cache_size

SORT OPERATIONS

Current sort_buffer_size = 512 K

Current read_rnd_buffer_size = 512 K

Sort buffer seems to be fine

JOINS

Current join_buffer_size = 132.00 K

You have had 0 queries where a join could not use an index properly

Your joins seem to be using indexes properly

OPEN FILES LIMIT

Current open_files_limit = 100001 files

The open_files_limit should typically be set to at least 2x-3x

that of table_cache if you have heavy MyISAM usage.

Your open_files_limit value seems to be fine

TABLE CACHE

Current table_open_cache = 64 tables

Current table_definition_cache = 256 tables

You have a total of 90 tables

You have 64 open tables.

Current table_cache hit rate is 3%

, while 100% of your table cache is in use

You should probably increase your table_cache

TEMP TABLES

Current max_heap_table_size = 16 M

Current tmp_table_size = 16 M

Of 2310 temp tables, 9% were created on disk

Created disk tmp tables ratio seems fine

TABLE SCANS

Current read_buffer_size = 256 K

Current table scan ratio = 5 : 1

read_buffer_size seems to be fine

TABLE LOCKING

Current Lock Wait ratio = 0 : 558

Your table locking seems to be fine

zz:

 类似资料: