大綱
一、設定檔說明
my-small.cnf
my-medium.cnf
my-large.cnf
my-huge.cnf
my-innodb-heavy-4G.cnf
二、詳解 my-innodb-heavy-4G.cnf
三、設定檔最佳化
註:環境說明,CentO5.5 x86_64+MySQL-5.5.32 相關軟體。
推薦閱讀:
詳解MySQL配置的最佳化
一、設定檔說明
Mysql-5.5.32是Mysql5.5系列中最後一個版本,也是最後一個有設定檔的版本,為什麼這麼說呢,用過5.6的博友都知道,在mysql5.6中已經不提供設定檔選擇,只有一個預設的設定檔,好了,我們今天說的是5.5.32這個版,就不和大家說5.6了,下面我們來具體說一下,mysql5.5.32中,提供可選的幾個設定檔,
my-small.cnf
my-medium.cnf
my-large.cnf
my-huge.cnf
my-innodb-heavy-4G.cnf
下面我們就來分別的看一下^_^……
1.my-small.cnf
| 12345 |
[root@mysql support-files]# vim my-small.cnf # Example MySQL config file for small systems. # This is for a system with little memory (<= 64M) where MySQL is only used # from time to time and it's important that the mysqld daemon # doesn't use much resources. |
這是my-small.cnf設定檔中開頭的簡介,它說明了,這個設定檔是在記憶體小於等於64M時使用的,小型資料庫系統,目的是不佔更多的系統資源!
2.my-medium.cnf
| 12345 |
[root@mysql support-files]# vim my-medium.cnf # Example MySQL config file for medium systems. # This is for a system with little memory (32M - 64M) where MySQL plays # an important part, or systems up to 128M where MySQL is used together with # other programs (such as a web server) |
這個設定檔是中型資料系統使用,記憶體在128M左右!
3.my-large.cnf
| 1234 |
[root@mysql support-files]# vim my-large.cnf # Example MySQL config file for large systems. # This is for a large system with memory = 512M where the system runs mainly # MySQL. |
這個設定檔是大型資料庫系統使用,記憶體在512M左右!
4.my-huge.cnf
| 1234 |
[root@mysql support-files]# vim my-huge.cnf # Example MySQL config file for very large systems. # This is for a large system with memory of 1G-2G where the system runs mainly # MySQL. |
這個設定檔是巨型資料庫系統使用,記憶體在1G-2G左右!
5.my-innodb-heavy-4G.cnf
| 12345678 |
[root@mysql support-files]# vim my-innodb-heavy-4G.cnf #BEGIN CONFIG INFO #DESCR: 4GB RAM, InnoDB only, ACID, few connections, heavy queries #TYPE: SYSTEM #END CONFIG INFO # This is a MySQL example config file for systems with 4GB of memory # running mostly MySQL using InnoDB only tables and performing complex # queries with few connections. |
這個設定檔主要作用是,支援4G記憶體,支援InnoDB引擎,支援事務(ACID)等特性所使用!
說明:ACID,指資料庫事務正確執行的四個基本要素的縮寫。包含:原子性(Atomicity)、一致性(Consistency)、隔離性(Isolation)、持久性(Durability)!
6.總結
從上面的說明我們可以出,基本是通過記憶體大小來選擇mysql的設定檔的,那有博友會說了,現在的伺服器動不動就是32G記憶體或者64G記憶體,甚至更大的記憶體,你那個設定檔最大隻支援4G記憶體是不是有點小了,確認會有這樣的問題,���mysql5.6以後,為了更大的發揮mysql的效能,已經去除了設定檔選擇,只有一個預設的設定檔,裡面只有一些基本配置,所有設定管理員都可以根據自己實際的需求進行自行設定,好了說了這麼多,我們就來說一說,在企業的用的最多的my-innodb-heavy-4G.cnf設定檔!