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 MySQLexample config file for systems with 4GB of memory
# running mostlyMySQL using InnoDB only tables and performing complex
# queries with fewconnections.

# MySQL programslook for option files in a set of
# locations whichdepend on the deployment platform.
# You can copy thisoption file to one of those
# locations. Forinformation about these locations, see:
#http://dev.mysql.com/doc/mysql/en/option-files.html
#
# In this file, youcan use all long options that a program supports.
# If you want toknow which options a program supports, run the program
# with the"--help" option.
#
# More detailedinformation about the individual options can also be
# found in themanual.
#


#
# The followingoptions will be read by MySQL client applications.
# Note that onlyclient applications shipped by MySQL are guaranteed
# to read thissection. If you want your own MySQL client program to
# honor thesevalues, you need to specify it as an option during the
# MySQL clientlibrary initialization.
#
# 以下選項會被MySQL客戶端應用讀取, 注意只有MySQL附帶的客戶端應用程序保證可以讀取這段內容,如果你想你自己的MySQL應用程序獲取這些值,需要在MySQL客戶端庫初始化的時候指定這些選項

[client]
#password = [your_password]  #mysql客戶端連接mysql時的密碼 

port = 3306  #mysql客戶端連接時的默認端口 

socket = /tmp/mysqld.sock #mysql服務器本地通信所使用的socket文件路徑

# ***Application-specific options follow here ***
#
# The MySQL server
#
[mysqld]
# genericconfiguration options #一般配置選項

port = 3306   #mysql服務器監聽的默認端口 

socket = /tmp/mysqld.sock  #socket本地通信文件路徑

# back_log is thenumber of connections the operating system can keep in
# the listen queue,before the MySQL connection manager thread has
# processed them.If you have a very high connection rate and experience
# "connectionrefused" errors, you might need to increase this value.
# Check your OSdocumentation for the maximum value of this parameter.
# Attempting to setback_log higher than your operating system limit
# will have noeffect.


#################################################
back_log = 50
# back_log 是操作系統在監聽隊列中所能保持的連接數,

# 隊列保存了在MySQL連接管理器線程處理之前的連接

# 如果你有非常高的連接率並且出現“connection refused”報錯

# 你就應該增加此處的值

# 檢查你的操作系統能打開文件數來獲取這個變量的最大值

# 如果將back_log設定到比你操作系統限制更高的值,將會沒有效果

###########################################################


# Don't listen on aTCP/IP port at all. This can be a security
# enhancement, if allprocesses that need to connect to mysqld run
# on the same host. All interaction with mysqld must be made via Unix
# sockets or namedpipes.
# Note that usingthis option without enabling named pipes on Windows
# (via the"enable-named-pipe" option) will render mysqld useless!
#skip-networking
# 不在TCP/IP端口上進行監聽.

# 如果所有的進程都是在同一臺服務器連接到本地的mysqld, 

# 這樣設置將是增強安全的方法 

# 所有mysqld的連接都是通過Unix sockets 或者命名管道進行的

# 注意在windows下如果沒有打開命名管道選項而只是用此項 

# (通過 “enable-named-pipe” 選項) 將會導致mysql服務沒有任何作用!

# skip-networking #默認是沒有開啓的



# The maximumamount of concurrent sessions the MySQL server will
# allow. One ofthese connections will be reserved for a user with
# SUPER privilegesto allow the administrator to login even if the
# connection limithas been reached.
max_connections =100
# MySQL 服務器所允許的同時會話數的上限

# 其中一個連接將被SUPER權限保留作爲管理員登錄

# 即便已經達到了連接數的上限



# Maximum amount oferrors allowed per host. If this limit is reached,
# the host will beblocked from connecting to the MySQL server until
# "FLUSHHOSTS" has been run or the server was restarted. Invalid
# passwords andother errors during the connect phase result in
# increasing thisvalue. See the "Aborted_connects" status variable for
# global counter.
max_connect_errors= 10
# 每個客戶端連接最大的錯誤允許數量,如果達到了此限制.

# 這個客戶端將會被MySQL服務阻止直到執行了”FLUSH HOSTS” 或者服務重啓 

# 非法的密碼以及其他在鏈接時的錯誤會增加此值

# 查看 “Aborted_connects” 狀態來獲取全局計數器



# The number ofopen tables for all threads. Increasing this value
# increases thenumber of file descriptors that mysqld requires.
# Therefore youhave to make sure to set the amount of open files
# allowed to atleast 4096 in the variable "open-files-limit" in
# section[mysqld_safe]
table_open_cache =2048
# 所有線程所打開表的數量.

# 增加此值就增加了mysqld所需要的文件描述符的數量 

# 這樣你需要確認在[mysqld_safe] “open-files-limit” 變量設置打開文件數量允許至少2048



# Enable externalfile level locking. Enabled file locking will have a
# negative impacton performance, so only use it in case you have
# multiple databaseinstances running on the same files (note some
# restrictionsstill apply!) or if you use other software relying on
# locking MyISAMtables on file level.
#external-locking
# 允許外部文件級別的鎖. 打開文件鎖會對性能造成負面影響

# 所以只有在你在同樣的文件上運行多個數據庫實例時才使用此選項(注意仍會有其他約束!) 

# 或者你在文件層面上使用了其他一些軟件依賴來鎖定MyISAM

# external-locking#默認是沒有開啓的





# The maximum sizeof a query packet the server can handle as well as
# maximum querysize server can process (Important when working with
# large BLOBs). enlarged dynamically, for each connection.
max_allowed_packet= 16M
# 服務所能處理的請求包的最大大小以及服務所能處理的最大的請求大小(當與大的BLOB字段一起工作時相當必要)

# 每個連接獨立的大小.大小動態增加 



# The size of thecache to hold the SQL statements for the binary log
# during atransaction. If you often use big, multi-statement
# transactions youcan increase this value to get more performance. All
# statements fromtransactions are buffered in the binary log cache and
# are being writtento the binary log at once after the COMMIT.  If the
# transaction islarger than this value, temporary file on disk is used
# instead. This buffer is allocated per connection on first update
# statement intransaction
binlog_cache_size =1M
# 在一個事務中binlog爲了記錄SQL狀態所持有的cache大小

# 如果你經常使用大的,多聲明的事務,你可以增加此值來獲取更大的性能

# 所有從事務來的狀態都將被緩衝在binlog緩衝中然後在提交後一次性寫入到binlog 

# 如果事務比此值大, 會使用磁盤上的臨時文件來替代

# 此緩衝在每個連接的事務第一次更新狀態時被創建



# Maximum allowedsize for a single HEAP (in memory) table. This option
# is a protectionagainst the accidential creation of a very large HEAP
# table which couldotherwise use up all memory resources.
max_heap_table_size= 64M
# 獨立的內存表所允許的最大容量.

# 此選項爲了防止意外創建一個超大的內存表導致耗盡所有的內存資源



# Size of thebuffer used for doing full table scans.
# Allocated perthread, if a full scan is needed.
read_buffer_size =2M
# MySql讀入緩衝區大小。對錶進行順序掃描的請求將分配一個讀入緩衝區,MySql會爲它分配一段內存緩衝區。read_buffer_size變量控制這一緩衝區的大小。如果對錶的順序掃描請求非常頻繁,並且你認爲頻繁掃描進行得太慢,可以通過增加該變量值以及內存緩衝區大小提高其性能。



# When reading rowsin sorted order after a sort, the rows are read
# through thisbuffer to avoid disk seeks. You can improve ORDER BY
# performance alot, if set this to a high value.
# Allocated perthread, when needed.
read_rnd_buffer_size= 16M
# MySql的隨機讀緩衝區大小。當按任意順序讀取行時(例如,按照排序順序),將分配一個隨機讀緩存區。進行排序查詢時,MySql會首先掃描一遍該緩衝,以避免磁盤搜索,提高查詢速度,如果需要排序大量數據,可適當調高該值。但MySql會爲每個客戶連接發放該緩衝空間,所以應儘量適當設置該值,以避免內存開銷過大。



# Sort buffer isused to perform sorts for some ORDER BY and GROUP BY
# queries. Ifsorted data does not fit into the sort buffer, a disk
# based merge sortis used instead - See the "Sort_merge_passes"
# status variable.Allocated per thread if sort is needed.
sort_buffer_size =8M
# 排序緩衝被用來處理類似ORDER BY以及GROUP BY隊列所引起的排序

# 如果排序後的數據無法放入排序緩衝

# 一個用來替代的基於磁盤的合併分類會被使用 

# 查看 “Sort_merge_passes” 狀態變量

# 在排序發生時由每個線程分配 



# This buffer isused for the optimization of full JOINs (JOINs without
# indexes). SuchJOINs are very bad for performance in most cases
# anyway, but settingthis variable to a large value reduces the
# performanceimpact. See the "Select_full_join" status variable for a
# count of fullJOINs. Allocated per thread if full join is found
join_buffer_size =8M
# 此緩衝被使用來優化全聯合(full JOINs 不帶索引的聯合).

# 類似的聯合在極大多數情況下有非常糟糕的性能表現

# 但是將此值設大能夠減輕性能影響

# 通過 “Select_full_join” 狀態變量查看全聯合的數量 

# 當全聯合發生時,在每個線程中分配 



# How many threadswe should keep in a cache for reuse. When a client
# disconnects, theclient's threads are put in the cache if there aren't
# more than thread_cache_sizethreads from before.  This greatly reduces
# the amount ofthread creations needed if you have a lot of new
# connections.(Normally this doesn't give a notable performance
# improvement ifyou have a good thread implementation.)
thread_cache_size =8
# 我們在cache中保留多少線程用於重用

# 當一個客戶端斷開連接後,如果cache中的線程還少於thread_cache_size, 

# 則客戶端線程被放入cache

# 這可以在你需要大量新連接的時候極大的減少線程創建的開銷 

# (一般來說如果你有好的線程模型的話,這不會有明顯的性能提升.) 



# This permits theapplication to give the threads system a hint for the
# desired number ofthreads that should be run at the same time.  This
# value only makessense on systems that support the thread_concurrency()
# function call(Sun Solaris, for example).
# You should try[number of CPUs]*(2..4) for thread_concurrency
thread_concurrency= 8
# 此允許應用程序給予線程系統一個提示在同一時間給予渴望被運行的線程的數量.

# 此值只對於支持 thread_concurrency() 函數的系統有意義( 例如Sun Solaris). 

# 你可可以嘗試使用 [CPU數量]*(2..4) 來作爲thread_concurrency的值 



# Query cache isused to cache SELECT results and later return them
# without actualexecuting the same query once again. Having the query
# cache enabled mayresult in significant speed improvements, if your
# have a lot ofidentical queries and rarely changing tables. See the
#"Qcache_lowmem_prunes" status variable to check if the current value
# is high enoughfor your load.
# Note: In caseyour tables change very often or if your queries are
# textuallydifferent every time, the query cache may result in a
# slowdown insteadof a performance improvement.
query_cache_size =64M
# 查詢緩衝常被用來緩衝 SELECT 的結果並且在下一次同樣查詢的時候不再執行直接返回結果.

# 打開查詢緩衝可以極大的提高服務器速度, 如果你有大量的相同的查詢並且很少修改表

# 查看 "Qcache_lowmem_prunes" 狀態變量來檢查是否當前值對於你的負載來說是否足夠高

# 注意: 在你表經常變化的情況下或者如果你的查詢原文每次都不同

# 查詢緩衝也許引起性能下降而不是性能提升



# Only cache resultsets that are smaller than this limit. This is to
# protect the querycache of a very large result set overwriting all
# other queryresults.
query_cache_limit =2M
# 只有小於此設定值的結果纔會被緩衝

# 此設置用來保護查詢緩衝,防止一個極大的結果集將其他所有的查詢結果都覆蓋.



# Minimum wordlength to be indexed by the full text search index.
# You might wish todecrease it if you need to search for shorter words.
# Note that youneed to rebuild your FULLTEXT index, after you have
# modified thisvalue.
ft_min_word_len = 4
# 被全文檢索索引的最小的字長.

# 你也許希望減少它,如果你需要搜索更短字的時候

# 注意在你修改此值之後

# 你需要重建你的 FULLTEXT 索引 



# If your systemsupports the memlock() function call, you might want to
# enable thisoption while running MySQL to keep it locked in memory and
# to avoidpotential swapping out in case of high memory pressure. Good
# for performance.
#memlock
# 如果你的系統支持 memlock() 函數,你也許希望打開此選項用以讓運行中的mysql在在內存高度緊張的時候,數據在內存中保持鎖定並且防止可能被swapping out

# 此選項對於性能有益,默認沒有開啓.



# Table type whichis used by default when creating new tables, if not
# specifieddifferently during the CREATE TABLE statement.
default-storage-engine= MYISAM
# 當創建新表時作爲默認使用的表類型,

# 如果在創建表示沒有特別執行表類型,將會使用此值 



# Thread stack sizeto use. This amount of memory is always reserved at
# connection time.MySQL itself usually needs no more than 64K of
# memory, while ifyou use your own stack hungry UDF functions or your
# OS requires morestack for some operations, you might need to set this
# to a higher value.
thread_stack = 192K
# 線程使用的堆大小. 此容量的內存在每次連接時被預留.

# MySQL 本身通常不會需要超過64K的內存 

# 如果你使用你自己的需要大量堆的UDF函數 

# 或者你的操作系統對於某些操作需要更多的堆

# 你也許需要將其設置的更高一點



# Set the defaulttransaction isolation level. Levels available are:
# 設定默認的事務隔離級別.可用的級別如下:

# READ-UNCOMMITTED,READ-COMMITTED, REPEATABLE-READ, SERIALIZABLE
transaction_isolation= REPEATABLE-READ


# Maximum size forinternal (in-memory) temporary tables. If a table
# grows larger thanthis value, it is automatically converted to disk
# based table Thislimitation is for a single table. There can be many
# of them.
tmp_table_size = 64M
# 內部(內存中)臨時表的最大大小

# 如果一個表增長到比此值更大,將會自動轉換爲基於磁盤的表

# 此限制是針對單個表的,而不是總和



# Enable binarylogging. This is required for acting as a MASTER in a
# replicationconfiguration. You also need the binary log if you need
# the ability to dopoint in time recovery from your latest backup.
log-bin=mysql-bin
# 打開二進制日誌功能.

# 在複製(replication)配置中,作爲MASTER主服務器必須打開此項 

# 如果你需要從你最後的備份中做基於時間點的恢復,你也同樣需要二進制日誌



# binary loggingformat - mixed recommended
binlog_format=mixed
# 設定記錄二進制日誌的格式,有三種格式,基於語句 statement基於行 row混合方式 mixed





# If you're usingreplication with chained slaves (A->B->C), you need to
# enable thisoption on server B. It enables logging of updates done by
# the slave threadinto the slave's binary log.
#log_slave_updates
# 如果你在使用鏈式從服務器結構的複製模式 (A->B->C),

# 你需要在服務器B上打開此項

# 此選項打開在從線程上重做過的更新的日誌

# 並將其寫入從服務器的二進制日誌





# Enable the fullquery log. Every query (even ones with incorrect
# syntax) that theserver receives will be logged. This is useful for
# debugging, it isusually disabled in production use.
#log
# 打開查詢日誌. 所有的由服務器接收到的查詢 (甚至對於一個錯誤語法的查詢)

# 都會被記錄下來. 這對於調試非常有用, 在生產環境中常常關閉此項

# log 默認是沒有開啓的,會影響服務器性能



# Print warnings tothe error log file.  If you have any problem with
# MySQL you shouldenable logging of warnings and examine the error log
# for possibleexplanations. 
#log_warnings
# 將警告打印輸出到錯誤log文件. 如果你對於MySQL有任何問題

# 你應該打開警告log並且仔細審查錯誤日誌,查出可能的原因

# log_warnings 默認沒有開啓



# Log slow queries.Slow queries are queries which take more than the
# amount of timedefined in "long_query_time" or which do not use
# indexes well, iflog_short_format is not enabled. It is normally good idea
# to have thisturned on if you frequently add new queries to the
# system.
slow_query_log
# 記錄慢速查詢. 慢速查詢是指消耗了比 “long_query_time” 定義的更多時間的查詢.

# 如果 log_long_format 被打開,那些沒有使用索引的查詢也會被記錄

# 如果你經常增加新查詢到已有的系統內的話. 一般來說這是一個好主意 



# All queriestaking more than this amount of time (in seconds) will be
# trated as slow.Do not use "1" as a value here, as this will result in
# even very fastqueries being logged from time to time (as MySQL
# currentlymeasures time with second accuracy only).
long_query_time = 2
# 所有的使用了比這個時間(以秒爲單位)更多的查詢會被認爲是慢速查詢

# 不要在這裏使用1, 否則會導致所有的查詢,甚至非常快的查詢頁被記錄下來(由於MySQL 目前時間的精確度只能達到秒的級別).





# *** Replication related settings 




# Unique serveridentification number between 1 and 2^32-1. This value
# is required forboth master and slave hosts. It defaults to 1 if
#"master-host" is not set, but will MySQL will not function as a master
# if it is omitted.
server-id = 1
# 唯一的服務辨識號,數值位於 1 2^32-1之間.

# 此值在masterslave上都需要設置

# 如果 “master-host” 沒有被設置,則默認爲1, 但是如果忽略此選項,MySQL不會作爲master生效

# Replication Slave(comment out master section to use this) #複製的Slave (去掉master段的註釋來使其生效)

#
# To configure thishost as a replication slave, you can choose between
# two methods : 爲了配置此主機作爲複製的slave服務器,你可以選擇兩種方法:

#
# 1) Use the CHANGEMASTER TO command (fully described in our manual) -
#    thesyntax is: 使用 CHANGE MASTER TO 命令 (在我們的手冊中有完整描述) - 

#    # 語法如下:

#
#   CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
#   MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
#   where you replace <host>, <user>, <password> by quotedstrings and
#   <port> by the master's port number (3306 by default).
#    你需要替換掉被尖括號包圍的字段以及使用master的端口號替換 (默認3306). 

#   Example: 例子如下:

#
#   CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
#   MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) Set thevariables below. However, in case you choose this method, then
#   start replication for the first time (even unsuccessfully, for example
#    ifyou mistyped the password in master-password and the slave fails to
#   connect), the slave will create a master.info file, and any later
#   changes in this file to the variable values below will be ignored and
#   overridden by the content of the master.info file, unless you shutdown
#    theslave server, delete master.info and restart the slaver server.
#    Forthat reason, you may want to leave the lines below untouched
#   (commented) and instead use CHANGE MASTER TO (see above)
#    設置以下的變量. 不論如何, 在你選擇這種方法的情況下, 然後第一次啓動複製(甚至不成功的情況下,

#    例如如果你輸入錯密碼在master-password字段並且slave無法連接), 

#   slave會創建一個 master.info 文件,並且之後任何對於包含在此文件內的參數的變化都會被忽略 

#    並且由 master.info 文件內的內容覆蓋, 除非你關閉slave服務, 刪除 master.info 並且重啓slave 服務

#    由於這個原因,你也許不想碰一下的配置(註釋掉的) 並且使用 CHANGE MASTER TO (查看上面) 來代替

#
# required uniqueid between 2 and 2^32 - 1
# (and differentfrom the master)
# defaults to 2 ifmaster-host is set
# but will notfunction as a slave if omitted
#server-id = 2
# 所需要的唯一id號位於2 2^32 – 1之間

# (並且和master不同

# 如果master-host被設置了.則默認值是

# 但是如果省略,則不會生效 



# The replicationmaster for this slave - required
#master-host =<hostname>
# 複製結構中的master – 必須

#
# The username theslave will use for authentication when connecting
# to the master -required
# 當連接到master上時slave所用來認證的用戶名必須

#master-user =<username>
#
# The password theslave will authenticate with when connecting to
# the master -required
# 當連接到master上時slave所用來認證的密碼必須

#master-password =<password>
#
# The port themaster is listening on.
# optional -defaults to 3306
# master監聽的端口.

# 可選默認是3306 

#master-port =<port>


# Make the slaveread-only. Only users with the SUPER privilege and the
# replication slavethread will be able to modify data on it. You can
# use this toensure that no applications will accidently modify data on
# the slave insteadof the master
#read_only
# 使得slave只讀.只有用戶擁有SUPER權限和在上面的slave線程能夠修改數據.

# 你可以使用此項去保證沒有應用程序會意外的修改slave而不是master上的數據



#*** MyISAMSpecific options  MyISAM 相關選項





# Size of the KeyBuffer, used to cache index blocks for MyISAM tables.
# Do not set itlarger than 30% of your available memory, as some memory
# is also requiredby the OS to cache rows. Even if you're not using
# MyISAM tables,you should still set it to 8-64M as it will also be
# used for internaltemporary disk tables.
key_buffer_size =32M
# 關鍵詞緩衝的大小, 一般用來緩衝MyISAM表的索引塊.

# 不要將其設置大於你可用內存的30%, 

# 因爲一部分內存同樣被OS用來緩衝行數據 

# 甚至在你並不使用MyISAM 表的情況下, 你也需要仍舊設置起 8-64M 內存由於它同樣會被內部臨時磁盤表使用



# MyISAM usesspecial tree-like cache to make bulk inserts (that is,
# INSERT ...SELECT, INSERT ... VALUES (...), (...), ..., and LOAD DATA
# INFILE) faster.This variable limits the size of the cache tree in
# bytes per thread.Setting it to 0 will disable this optimisation.  Do
# not set it largerthan "key_buffer_size" for optimal performance.
# This buffer isallocated when a bulk insert is detected.
bulk_insert_buffer_size= 64M
# MyISAM 使用特殊的類似樹的cache來使得突發插入

# (這些插入是,INSERT … SELECT, INSERT … VALUES (…), (…), …, 以及 LOAD DATA 

# INFILE) 更快. 此變量限制每個進程中緩衝樹的字節數

# 設置爲 0 會關閉此優化

# 爲了最優化不要將此值設置大於 “key_buffer_size”. 

# 當突發插入被檢測到時此緩衝將被分配



# This buffer isallocated when MySQL needs to rebuild the index in
# REPAIR, OPTIMIZE,ALTER table statements as well as in LOAD DATA INFILE
# into an emptytable. It is allocated per thread so be careful with
# large settings.
myisam_sort_buffer_size= 128M
# 此緩衝當MySQL需要在 REPAIR, OPTIMIZE, ALTER 以及 LOAD DATA INFILE 到一個空表中引起重建索引時被分配.

# 這在每個線程中被分配.所以在設置大值時需要小心



# The maximum sizeof the temporary file MySQL is allowed to use while
# recreating theindex (during REPAIR, ALTER TABLE or LOAD DATA INFILE.
# If the file-sizewould be bigger than this, the index will be created
# through the keycache (which is slower).
myisam_max_sort_file_size= 10G
# MySQL重建索引時所允許的最大臨時文件的大小 ( REPAIR, ALTER TABLE 或者 LOAD DATA INFILE).

# 如果文件大小比此值更大,索引會通過鍵值緩衝創建(更慢



# If a table hasmore than one index, MyISAM can use more than one
# thread to repairthem by sorting in parallel. This makes sense if you
# have multipleCPUs and plenty of memory.
myisam_repair_threads= 1
# 如果一個表擁有超過一個索引, MyISAM 可以通過並行排序使用超過一個線程去修復他們.

# 這對於擁有多個CPU以及大量內存情況的用戶,是一個很好的選擇



# Automaticallycheck and repair not properly closed MyISAM tables.
myisam_recover
# 自動檢查和修復沒有適當關閉的 MyISAM .



# *** INNODBSpecific options *** 
# *** INNODB 相關選項 ***



# Use this optionif you have a MySQL server with InnoDB support enabled
# but you do notplan to use it. This will save memory and disk space
# and speed up somethings.
#skip-innodb
# 如果你的MySQL服務包含InnoDB支持但是並不打算使用的話,

# 使用此選項會節省內存以及磁盤空間,並且加速某些部分,默認沒有開啓.



# Additional memorypool that is used by InnoDB to store metadata
# information. If InnoDB requires more memory for this purpose it will
# start to allocateit from the OS.  As this is fast enough on most
# recent operatingsystems, you normally do not need to change this
# value. SHOWINNODB STATUS will display the current amount used.
innodb_additional_mem_pool_size= 16M
# 附加的內存池被InnoDB用來保存metadata 信息

# 如果InnoDB爲此目的需要更多的內存,它會開始從OS這裏申請內存

# 由於這個操作在大多數現代操作系統上已經足夠快, 你一般不需要修改此值

# SHOW INNODBSTATUS 命令會顯示當先使用的數量



# InnoDB, unlikeMyISAM, uses a buffer pool to cache both indexes and
# row data. Thebigger you set this the less disk I/O is needed to
# access data intables. On a dedicated database server you may set this
# parameter up to80% of the machine physical memory size. Do not set it
# too large,though, because competition of the physical memory may
# cause paging inthe operating system.  Note that on 32bit systems you
# might be limitedto 2-3.5G of user level memory per process, so do not
# set it too high.
innodb_buffer_pool_size= 2G
# InnoDB使用一個緩衝池來保存索引和原始數據, 不像 MyISAM. 

# 這裏你設置越大,你在存取表裏面數據時所需要的磁盤I/O越少

# 在一個獨立使用的數據庫服務器上,你可以設置這個變量到服務器物理內存大小的80% 

# 不要設置過大,否則,由於物理內存的競爭可能導致操作系統的內存換頁頻繁,影響系統性能

# 注意在32位系統上你每個進程可能被限制在 2-3.5G 用戶層面內存限制

# 所以不要設置的太高.



# InnoDB storesdata in one or more data files forming the tablespace.
# If you have asingle logical drive for your data, a single
# autoextendingfile would be good enough. In other cases, a single file
# per device isoften a good choice. You can configure InnoDB to use raw
# disk partitionsas well - please refer to the manual for more info
# about this.
innodb_data_file_path= ibdata1:10M:autoextend
# InnoDB 將數據保存在一個或者多個數據文件中成爲表空間.

# 如果你只有單個邏輯驅動保存你的數據,一個單個的自增文件就足夠好了

# 其他情況下.每個設備一個文件一般都是個好的選擇

# 你也可以配置InnoDB來使用裸盤分區請參考手冊來獲取更多相關內容 



# Set this optionif you would like the InnoDB tablespace files to be
# stored in anotherlocation. By default this is the MySQL datadir.
#innodb_data_home_dir= <directory>
# 設置此選項如果你希望InnoDB表空間文件被保存在其他分區.

# 默認保存在MySQLdatadir



# Number of IOthreads to use for async IO operations. This value is
# hardcoded to 8 onUnix, but on Windows disk I/O may benefit from a
# larger number.
innodb_write_io_threads= 8
innodb_read_io_threads= 8
# 用來同步IO操作的IO線程的數量

# 此值在Unix下被硬編碼爲8,但是在Windows磁盤I/O可能在一個大數值下表現的更好



# If you run intoInnoDB tablespace corruption, setting this to a nonzero
# value will likelyhelp you to dump your tables. Start from value 1 and
# increase it untilyou're able to dump the table successfully.
#innodb_force_recovery=1
# 如果你發現InnoDB表空間損壞, 設置此值爲一個非零值可能幫助你導出你的表.

# 1開始並且增加此值直到你能夠成功的導出表



# Number of threadsallowed inside the InnoDB kernel. The optimal value
# depends highly onthe application, hardware as well as the OS
# schedulerproperties. A too high value may lead to thread thrashing.
innodb_thread_concurrency= 16
# InnoDB核心內的允許線程數量.

# 最優值依賴於應用程序,硬件以及操作系統的調度方式

# 過高的值可能導致線程的互斥頻繁



# If set to 1,InnoDB will flush (fsync) the transaction logs to the
# disk at eachcommit, which offers full ACID behavior. If you are
# willing tocompromise this safety, and you are running small
# transactions, youmay set this to 0 or 2 to reduce disk I/O to the
# logs. Value 0means that the log is only written to the log file and
# the log fileflushed to disk approximately once per second. Value 2
# means the log iswritten to the log file at each commit, but the log
# file is onlyflushed to disk approximately once per second.
innodb_flush_log_at_trx_commit= 1
# 如果設置爲1 ,InnoDB會在每次提交後刷新(fsync)事務日誌到磁盤上,

# 這提供了完整的ACID行爲

# 如果你願意對事務安全折衷, 並且你正在運行一個小的事務, 你可以設置此值到0或者2來減少由事務日誌引起的磁盤I/O 

# 值爲0意味着該日誌只寫入到日誌文件和日誌文件大約每秒一次刷新到磁盤

# 值爲2意味着每次提交日誌將被寫入到日誌文件,但日誌文件只有大約每秒一次刷新到磁盤。



# Speed up InnoDBshutdown. This will disable InnoDB to do a full purge
# and insert buffermerge on shutdown. It may increase shutdown time a
# lot, but InnoDBwill have to do it on the next startup instead.
#innodb_fast_shutdown
# 加速InnoDB的關閉. 這會阻止InnoDB在關閉時做全清除以及插入緩衝合併.

# 這可能極大增加關機時間, 但是取而代之的是InnoDB可能在下次啓動時做這些操作.



# The size of thebuffer InnoDB uses for buffering log data. As soon as
# it is full,InnoDB will have to flush it to disk. As it is flushed
# once per secondanyway, it does not make sense to have it very large
# (even with longtransactions). 
innodb_log_buffer_size= 8M
# 用來緩衝日誌數據的緩衝區的大小.

# 當此值快滿時, InnoDB將必須刷新數據到磁盤上

# 由於基本上每秒都會刷新一次,所以沒有必要將此值設置的太大(甚至對於長事務而言



# Size of each logfile in a log group. You should set the combined size
# of log files toabout 25%-100% of your buffer pool size to avoid
# unneeded bufferpool flush activity on log file overwrite. However,
# note that alarger logfile size will increase the time needed for the
# recovery process.
innodb_log_file_size= 256M
# 在日誌組中每個日誌文件的大小.

# 你應該設置日誌文件總合大小到你緩衝池大小的25%~100% 

# 來避免在日誌文件覆寫上不必要的緩衝池刷新行爲

# 不論如何, 請注意一個大的日誌文件大小會增加恢復進程所需要的時間



# Total number offiles in the log group. A value of 2-3 is usually good
# enough.
innodb_log_files_in_group= 3
# 在日誌組中的文件總數.

# 通常來說2~3是比較好的



# Location of theInnoDB log files. Default is the MySQL datadir. You
# may wish to pointit to a dedicated hard drive or a RAID1 volume for
# improvedperformance
#innodb_log_group_home_dir
# InnoDB的日誌文件所在位置. 默認是MySQLdatadir.

# 你可以將其指定到一個獨立的硬盤上或者一個RAID1捲上來提高其性能 



# Maximum allowedpercentage of dirty pages in the InnoDB buffer pool.
# If it is reached,InnoDB will start flushing them out agressively to
# not run out ofclean pages at all. This is a soft limit, not
# guaranteed to beheld.
innodb_max_dirty_pages_pct= 90
# InnoDB緩衝池中最大允許的髒頁面的比例.

# 如果達到限額, InnoDB會開始刷新他們防止他們妨礙到乾淨數據頁面

# 這是一個軟限制,不被保證絕對執行



# The flush methodInnoDB will use for Log. The tablespace always uses
# doublewrite flushlogic. The default value is "fdatasync", another
# option is"O_DSYNC".
#innodb_flush_method=O_DSYNC
# InnoDB用來刷新日誌的方法.

# 表空間總是使用雙重寫入刷新方法 

# 默認值是 "fdatasync",另一個是 "O_DSYNC". 



# How long anInnoDB transaction should wait for a lock to be granted
# before beingrolled back. InnoDB automatically detects transaction
# deadlocks in itsown lock table and rolls back the transaction. If you
# use the LOCKTABLES command, or other transaction-safe storage engines
# than InnoDB inthe same transaction, then a deadlock may arise which
# InnoDB cannotnotice. In cases like this the timeout is useful to
# resolve thesituation.
innodb_lock_wait_timeout= 120
# 在被回滾前,一個InnoDB的事務應該等待一個鎖被批准多久.

# InnoDB在其擁有的鎖表中自動檢測事務死鎖並且回滾事務

# 如果你使用 LOCK TABLES 指令, 或者在同樣事務中使用除了InnoDB以外的其他事務安全的存儲引擎 

# 那麼一個死鎖可能發生而InnoDB無法注意到

# 這種情況下這個鎖超時值對於解決這種問題就非常有幫助





[mysqldump]
# Do not buffer thewhole result set in memory before writing it to
# file. Requiredfor dumping very large tables
quick
# 不要在將內存中的整個結果寫入磁盤之前緩存. 在導出非常巨大的表時需要此項



max_allowed_packet= 16M


[mysql]
no-auto-rehash
#自動補全表名以及數據庫名。默認開啓就是禁止了。



# Only allowUPDATEs and DELETEs that use keys.
#safe-updates
# 僅僅允許使用鍵值的 UPDATEs DELETEs .如果沒有指定where相關條件,MySQL不會執行相關刪除或者清空命令.



[myisamchk]
key_buffer_size =512M
sort_buffer_size =512M
read_buffer = 8M
write_buffer = 8M


[mysqlhotcopy]
interactive-timeout


[mysqld_safe]
# Increase theamount of open files allowed per process. Warning: Make
# sure you have setthe global system limit high enough! The high value
# is required for alarge number of opened tables
open-files-limit =8192
# 增加每個進程的可打開文件數量.

# 警告: 確認你已經將全系統限制設定的足夠高

# 打開大量表需要將此值設大 


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章