일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- DML
- slack
- vacuum
- zabbix
- jmeter
- Maria
- NOSQL
- ncloud
- OD
- InnoDB
- mysql
- online ddl
- NCP
- postgresql
- Docker
- autovacuum
- MyISAM
- 6.2.7
- Replication
- RDBMS
- opensource
- mongo
- 성능테스트
- ROLLBACK
- Cloud DB for MySQL
- Connection
- RDS
- maxclients
- REDIS
- cdb
- Today
- Total
개인 공부
MySQLTunner.pl - MySQL 성능 진단 툴 본문
MySQLTunner 는 MySQL 설치를 빠르게 검토하고 성능과 안전성을 높이기 위해 조정할 수 있는 Perl로 작성된 스크립트이다.
현재 구성 변수 및 상태 데이터가 검색되어 몇가지 기본 성능 제안 함께 간단한 형식으로 표시된다.
MySQLTuner 는 이 마지막 버전에서 MySQL/MariaDB/Percona Server에 대해 ~300개의 표시기를 지원합니다.
0.사전 환경
OS : CentOS 7.7
Database : MySQL 5.7
[root:LEE:/root > cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
mysql> status
--------------
mysql Ver 14.14 Distrib 5.7.33, for linux-glibc2.12 (x86_64) using EditLine wrapper
Connection id: 1448
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.7.33-log MySQL Community Server (GPL)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: latin1
Conn. characterset: latin1
UNIX socket: /tmp/mysql.sock
Uptime: 1 day 20 hours 47 min 10 sec
Threads: 1 Questions: 3014024 Slow queries: 0 Opens: 1278 Flush tables: 2 Open tables: 927 Queries per second avg: 18.693
--------------
[root:LEE:/root > cat /etc/my5.7.cnf
[mysqld]
basedir=/mysql5.7
user=mysql
datadir=/data/data5.7
socket=/tmp/mysql.sock
port=3306
server-id=1
log-bin=/data/data5.7/binlog
relay-log=/log/log5.7/relaylog
relay_log_purge=0
# Disabling symbolic-links is recommended to prevent assorted security risks
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
log-error=/log/log5.7/mariadb.log
pid-file=/log/log5.7/mariadb.pid
query_cache_type = ON
[mysqld_safe]
basedir=/mysql5.7
user=mysql
port=3306
datadir=/data/data5.7
socket=/tmp/mysql.sock
log-error=/log/log5.7/mariadb.log
pid-file=/log/log5.7/mariadb.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
1.Download & Installation
wget http://mysqltuner.pl/ -O mysqltuner.pl
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/basic_passwords.txt -O basic_passwords.txt
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/vulnerabilities.csv -O vulnerabilities.csv
2.MySQLTunner.pl 실행
1) 최소한의 정보 점검 명령어
- perl mysqltuner.pl
[root:LEE:/root > perl mysqltuner.pl
>> MySQLTuner 1.8.1 - Major Hayden <major@mhtx.net>
>> Bug reports, feature requests, and downloads at http://mysqltuner.pl/
>> Run with '--help' for additional options and output filtering
[--] Skipped version check for MySQLTuner script
Please enter your MySQL administrative login: root ## Adminuser
Please enter your MySQL administrative password: ## Password
2) 디버깅 없이 모든 환경 설정을 점검하는 명령어
* 해당 명령어는 많은 내용이 출력되기 때문에 output 을 지정하여 파일로 저장해서 봐야한다.
- perl mysqltuner.pl --buffers --dbstat --idxstat --sysstat --pfstat --tbstat --outputfile /tmp/result_mysqltuner.txt
[root:LEE:/root > perl mysqltuner.pl --buffers --dbstat --idxstat --sysstat --pfstat --tbstat --outputfile /tmp/result_mysqltuner.txt
[root:LEE:/root > ll /tmp
total 108
srwxrwxrwx. 1 mysql mysql 0 Aug 3 13:20 mysql.sock
-rw-------. 1 mysql mysql 5 Aug 3 13:20 mysql.sock.lock
-rw-r--r--. 1 root root 104694 Aug 5 10:04 result_mysqltuner.txt
3) perl mysqltuner.pl 실행 결과
*실제 운영에서 Maximum 점검을 하게되면 많은 결과값이 나와 Minimal 결과로 예시를 올립니다..
결과에서 [!!] 표시가 되어 있는 부분은 문제가 된다고 보여주는 부분이기 때문에 정정할 방안을 찾아야한다. 또한 맨 아래 MySQLTunner.pl에서 제안하는 'Recommendations'를 적극 활용하면 된다.
4) perl mysqltuner.pl --buffers --dbstat --idxstat --sysstat --pfstat --tbstat --outputfile /tmp/result_mysqltuner.txt
#Github 참고
'MySQL & Maria' 카테고리의 다른 글
Slow Query 분석 Website (0) | 2021.08.24 |
---|---|
[MySQL] RENAME DATABASE (0) | 2021.08.10 |
Query Cache (1) | 2021.08.05 |
Maria DB Binary Install (0) | 2021.08.04 |
MySQL 과도한 CPU 사용 Thread 확인 ( Pidstat ) (6) | 2021.08.03 |