- MySQL?∫?c??iki?吾?????潟?
- MySQL
- MySQL/5.5
- MySQL/InnoDB
- MySQL/?????
- MySQL/?????鴻?帥???潟?
- MySQL/?泣?若??腱糸??
- MySQL/???ャ?若???潟?
- MySQL/???若?吾?с?
- MySQL/???????≪????
- MySQL/???????<?ゃ???潟?
- MySQL/???潟?????若?
- MySQL/???????宴?若?激?с?
- MySQL/?????
- MySQL/?狗??
?????????? †
?泣?若?????? †
荐???ゃ??腆肴? †
mysql> show variables;
腟沿????宴?????? †
- ???若?????????潟?若???違?????若?帥?泣?ゃ?冴???ゃ?潟???????鴻?泣?ゃ?冴??????茯炊?
select table_name, engine,
table_rows as tbl_rows,
avg_row_length as rlen,
floor((data_length+index_length)/1024/1024) as allMB,
floor((data_length)/1024/1024) as dMB,
floor((index_length)/1024/1024) as iMB
from information_schema.tables
where table_schema=database()
order by (data_length+index_length) desc;
?鴻???若?祉???????若?????違?????с??? †
?ョ??倶???∈茯? †
$ mysqladmin -p extended-status | grep -E 'Max|Threads'
Enter password:
| Max_used_connections | 51 |
| Threads_cached | 4 |
| Threads_connected | 21 |
| Threads_created | 18015 |
| Threads_running | 11 |
???若?帥?泣?ゃ?冴??????<?≪?????????? †
- ?????若?帥?泣?ゃ?削??<?≪????????綽???????
- ???c?鴻?????<?≪??????炊?吾????綺???00筝?????勲??????
- B?????若?ゃ?潟???????鴻??「膣≪?????若?????鴻???c?恰????ぇ????激?若?????榊?????????????c?鴻????с?????????<?≪????с???????с????????勲???冴??
- MySQL??S?????<?ゃ?????c???激?ャ???若?????????????т???????????
- OS?????<?ゃ?????c???激?ャ??MySQL絨????????????<?????<???с??????
- ???若?帥?????????<?≪??????障???????翫???????ゃ?潟???????鴻?????с???<?≪??????障????????????
???若????┃荐???SQL????眼?? †
- MySQL???ゃ?潟???????鴻???狗????絵?????
- ?>散???????絎??????????ч??荐???綽?荀????????篁倶?違????????????若??????????????菴遵????????????????????荀?????????????
- ?≪???????剛信???????若?????贋?井????幻??申???????????????ゃ???贋?違??????????????
???ャ?若???潟? †
篏睡???<?≪?????? †
???<?ゃ?????若???恰?違???? †
蕭?莢??激????????札筝????潟???潟????絎?茵?
$ mysqladmin -u root -p extended-status | grep Open
Enter password:
| Open_files | 515 |
| Open_streams | 0 |
| Open_tables | 256 |
| Opened_tables | 45281 |
Open_files, Open_tables???違??紊????翫??? /etc/my.cnf ??札筝???茯炊?眼??open_files???ゃ????鴻??able_cache???ゃ??紊с????????????Error in accept: Too many open files???????若???榊??????MySQL??罘??巡??????ャ?????ц?羈????
[mysqld]
open_files=2048
table_cache=512
筝?荐????違??紜????????????????若?吟?????????<?ゃ?????c?鴻???????炊?違??????羈????綽?荀?????紜???????
????????
I/O????? †
- ???若?帥???c?????????????
- ???c?????????????????若???c?激?с?潟???????潟??????
- ???c???????????激?潟???????????潟???????????若?帥?????????若???c?激?с?潟??舟?
- MyISAM???<?ゃ???с???????若?帥???<?ゃ??MYD)???ゃ?潟???????鴻???<?ゃ??MYI)??臀?????c????????????絎??с????
InnoDB?劫?? †
my.cnf †
MyISAM/InnoDB?演?? †
- query_cache_size
- ?????????茵?腟????????c???激?ャ??????Query?????c???激?ャ???????翫????QL??絎?茵??????????c???激?ャ????絎鴻??菴??????с???泣?ゃ?冴??ぇ?????鴻????????
- 荅峨????????若????????絎鴻??紊??眼???????翫???????????c???激?ャ????????????с?????c???激?ャ??????筝??桁????????????????????
MyISAM?∫? †
- key_buffer_size
- MyISAM?????若?????c???激?ャ???????????<???泣?ゃ?
- MyISAM???帥??ySQL絨????泣?若??????RAM??/4腮?綺??蚊??綵???????????
- max_connections
- ?泣?若????荐怨???????紊у?????ョ??
InnoDB?∫? †
- innodb_file_per_table
- ???若??????篏?? .ibd ???<?ゃ????篏???
- 綽???鐚?鐚???絎????????
- innodb_buffer_pool_size
- InnoDB ???若?????????若?帥???ゃ?潟???????鴻??篆?絖??????????????????<??ぇ????
- MySQL????nnoDB絨????泣?若??????RAM? 70-80% 篏??障?т???????????????荐??????????????絎????????????純?<???????????????с??50%???????????
- innodb_log_file_size
- ???若?帥???吾??莨若?帥??緇???ぇ?????泣?ゃ?冴?????若?帥???吾??莨若?炊?ц?純??襲?帥????
- 紊с?????泣?ゃ?冴?祉?????若?帥????????????????荀?????
- ?泣?ゃ?冴??紊??眼?????翫????罩e幻??罩√???篏???羝??帥?????違???<?ゃ????????????? /var/lib/mysql/ib_logfile**)?????ゃ????mysql?泣?若????莎桁??????????綽?荀?????
- innodb_flush_method
???若?帥???<?ゃ?????? †
???ャ?若???潟?違?????? †
- ??????????ySQL???ャ?若???潟?
???若?????х軒 †
myisampack †
- MyISAM??YD???<?ゃ?????х軒
- ?????<?ゃ????0??70%
???若? †
茲??医?茵? †