my-innodb-heavy-4G参数内容介绍


#BEGIN CONFIG INFO

#DESCR: 4GB RAM, InnoDB only, ACID, few connections, heavy queries

#系统需要4GB内存

#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.

# MySQL programs look for option files in a set of

# locations which depend on the deployment platform.

# You can copy this option file to one of those

# locations. For information about these locations, see:

# http://dev.mysql.com/doc/mysql/en/option-files.html

#

# In this file, you can use all long options that a program supports.

# If you want to know which options a program supports, run the program

# with the "--help" option.

#

# More detailed information about the individual options can also be

# found in the manual.

#


#

# The following options will be read by MySQL client applications.

# Note that only client applications shipped by MySQL are guaranteed

# to read this section. If you want your own MySQL client program to

# honor these values, you need to specify it as an option during the

# MySQL client library initialization.

# 客户端配置,用来指定端口号和socket

[client]

#password = [your_password]

port = 3306

socket = /tmp/mysql.sock


# *** Application-specific options follow here ***


#

# The MySQL server

# 服务端配置  

[mysqld]


# generic configuration options //默认配置选项的端口号和socket

port = 3306

socket = /tmp/mysql.sock


# back_log is the number 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

# "connection refused" errors, you might need to increase this value.

# Check your OS documentation for the maximum value of this parameter.

# Attempting to set back_log higher than your operating system limit

# will have no effect. 

# 保持在操作系统监听队列中的连接数量

back_log = 50


# Don't listen on a TCP/IP port at all. This can be a security

# enhancement, if all processes that need to connect to mysqld run

# on the same host.  All interaction with mysqld must be made via Unix

# sockets or named pipes.

# Note that using this option without enabling named pipes on Windows

# (via the "enable-named-pipe" option) will render mysqld useless!

# 忽略监听

# skip-networking    


# The maximum amount of concurrent sessions the MySQL server will

# allow. One of these connections will be reserved for a user with

# SUPER privileges to allow the administrator to login even if the

# connection limit has been reached.MySQL 允许的并发会话的最大数量。

# 最大会话连接数

max_connections = 100 


# Maximum amount of errors allowed per host. If this limit is reached,

# the host will be blocked from connecting to the MySQL server until

# "FLUSH HOSTS" has been run or the server was restarted. Invalid

# passwords and other errors during the connect phase result in

# increasing this value. See the "Aborted_connects" status variable for

# global counter.  

# 每个主机允许的最大错误数量

max_connect_errors = 10    


# The number of open tables for all threads. Increasing this value

# increases the number of file descriptors that mysqld requires.

# Therefore you have to make sure to set the amount of open files

# allowed to at least 4096 in the variable "open-files-limit" in

# section [mysqld_safe]   

# 提高该值将提高 mysqld 需要的文件描述符的数量。 最小为4096

table_open_cache = 2048


# Enable external file level locking. Enabled file locking will have a

# negative impact on performance, so only use it in case you have

# multiple database instances running on the same files (note some

# restrictions still apply!) or if you use other software relying on

# locking MyISAM tables on file level.

# 外部文件锁表

# external-locking  


# The maximum size of a query packet the server can handle as well as

# maximum query size server can process (Important when working with

# large BLOBs).  enlarged dynamically, for each connection.

# 服务器可以处理的一个查询包的最大容量

max_allowed_packet = 16M   


# The size of the cache to hold the SQL statements for the binary log

# during a transaction. If you often use big, multi-statement

# transactions you can increase this value to get more performance. All

# statements from transactions are buffered in the binary log cache and

# are being written to the binary log at once after the COMMIT.  If the

# transaction is larger than this value, temporary file on disk is used

# instead.  This buffer is allocated per connection on first update

# statement in transaction  

# 在一个事务中能够为二进制日志 SQL 语句保持的缓存大小

binlog_cache_size = 1M


# Maximum allowed size for a single HEAP (in memory) table. This option

# is a protection against the accidential creation of a very large HEAP

# table which could otherwise use up all memory resources.  

# 一个单一的 HEAP(在内存中)表的最大允许大小

max_heap_table_size = 64M


# Size of the buffer used for doing full table scans.

# 用于进行 MyISAM 表全表扫描的缓冲区大小

# Allocated per thread, if a full scan is needed.

# 全部扫描的缓冲区大小

read_buffer_size = 2M           


# When reading rows in sorted order after a sort, the rows are read

# through this buffer to avoid disk seeks. You can improve ORDER BY

# performance a lot, if set this to a high value.

# Allocated per thread, when needed.

# 当在一个有序的排序中读取行时,可以通过该缓冲区来读取行,以避免对磁盘的查找

# 如果将该值设置为一个很高的值,你可以大幅度提高 ORDER BY 的性能

# 当需要时,分配给每个线程


read_rnd_buffer_size = 16M


# Sort buffer is used to perform sorts for some ORDER BY and GROUP BY

# queries. If sorted data does not fit into the sort buffer, a disk

# based merge sort is 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 is used for the optimization of full JOINs (JOINs without

# indexes). Such JOINs are very bad for performance in most cases

# anyway, but setting this variable to a large value reduces the

# performance impact. See the "Select_full_join" status variable for a

# count of full JOINs. Allocated per thread if full join is found

join_buffer_size = 8M

# 该缓冲被用来优化 FULL JOIN(没有索引的 JOIN)

# 无论如何,该 JOIN 在大多数情况下对性能是非常坏的,但是设置该变量为一个大值将减少对性能的影响

# 请看针对一定数量的 FULL JOIN 的“Select_full_join”状态变量

# 如果 FULL JOIN 被发现,将分配给每个线程


# How many threads we should keep in a cache for reuse. When a client

# disconnects, the client's threads are put in the cache if there aren't

# more than thread_cache_size threads from before.  This greatly reduces

# the amount of thread creations needed if you have a lot of new

# connections. (Normally this doesn't give a notable performance

# improvement if you have a good thread implementation.)

thread_cache_size = 8

# 我们保持在一个缓存中的可重用的线程有好多

# 当一个客户端断开连接时,如果在这之前的线程没有超过 thread_cache_size,客户端的线程将放在缓存中

# 如果你有很多新的连接,这将大幅减少创建所需线程的数量

# (如果你有一个很好的线程实现,这通常不会给出一个显著的性能改善。)


# This permits the application to give the threads system a hint for the

# desired number of threads that should be run at the same time.  This

# value only makes sense 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)

# 你应该对 thread_concurrency 尝试 CPU 数量的 2/4/6/... 倍



# Query cache is used to cache SELECT results and later return them

# without actual executing the same query once again. Having the query

# cache enabled may result in significant speed improvements, if your

# have a lot of identical queries and rarely changing tables. See the

# "Qcache_lowmem_prunes" status variable to check if the current value

# is high enough for your load.

# Note: In case your tables change very often or if your queries are

# textually different every time, the query cache may result in a

# slowdown instead of a performance improvement.

query_cache_size = 64M


#查询缓存被用来缓存 SELECT 结果并在稍后返回它们,不会再次实际执行相同的查询

# 如果你有很多相同的查询并且很少改变表的话,查询缓存的启用将导致显著的速度改善

# 请看“Qcache_lowmem_prunes”状态变量,以检查当前值对于你的加载是否足够高

# 注意:如果你的表经常改变,或者如果你的查询每次是不同的原文,那么查询缓存将导致变慢,替代性能的改善

# Only cache result sets that are smaller than this limit. This is to

# protect the query cache of a very large result set overwriting all

# other query results.

query_cache_limit = 2M

# 只有缓存结果集是小于该限制的

# 这可以保护一个非常大结果集的查询缓存覆盖所有其它查询结果

query_cache_limit = 2M


# Minimum word length to be indexed by the full text search index.

# You might wish to decrease it if you need to search for shorter words.

# Note that you need to rebuild your FULLTEXT index, after you have

# modified this value.

ft_min_word_len = 4

# 编制到全文检索索引的最小单词长度

# 如果你需要检索更短的单词,你可能希望减小它

# 注意,在你修改了该值以后,你需要重建你的 FULLINDEX 索引


# If your system supports the memlock() function call, you might want to

# enable this option while running MySQL to keep it locked in memory and

# to avoid potential swapping out in case of high memory pressure. Good

# for performance.

# memlock

# 如果你的系统支持 memlock() 函数调用,你可能想要启用该选项

(运行 MySQL 以保持它锁定到内存,并在出现高内存压力时避免潜在的交换输出)

# 这对性能是很有益的

# Table type which is used by default when creating new tables, if not

# specified differently during the CREATE TABLE statement.    

default-storage-engine = MYISAM

# 如果在 CREATE TABLE 语句期间没有指定数据库采用的数据库引擎,当创建一个新表时所使用的默认类型



# Thread stack size to use. This amount of memory is always reserved at

# connection time. MySQL itself usually needs no more than 64K of

# memory, while if you use your own stack hungry UDF functions or your

# OS requires more stack for some operations, you might need to set this

# to a higher value.

thread_stack = 192K

# 使用的线程堆栈大小

# 该内存量总是在连接时间被保留的

# MySQL 自己通常需要不超过 64K 的内存,然而如果你使用的是你自己的堆栈 

# UDF 函数或者你的系统针对某些操作需要更多堆栈,你可能需要设置该值为一个更高的值




# Set the default transaction isolation level. Levels available are:

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

transaction_isolation = REPEATABLE-READ

# 设置默认的事务隔离等级。事物隔离级别有 READ-UNCOMMITTED(读取未提交内容),

# READ-COMMITTED(读取提交内容), REPEATABLE-READ(重读), SERIALIZABLE(可串行话)


# Maximum size for internal (in-memory) temporary tables. If a table

# grows larger than this value, it is automatically converted to disk

# based table This limitation is for a single table. There can be many

# of them. 内部(内存中)临时表最大的容量,如果一个表的容量增长超过这个值

# 他将自动转换到基于磁盘上,这个限制是针对单表,这里可以有很多这样的表

tmp_table_size = 64M

# 内部(内存中的)临时表的最大容量


# Enable binary logging. This is required for acting as a MASTER in a

# replication configuration. You also need the binary log if you need

# the ability to do point in time recovery from your latest backup.

log-bin=mysql-bin

# 启用二进制日志

# 这在一个主从复制配置中,对于充当 MASTER 的是必要的

# 如果你需要及时从你最后的备份点中进行恢复,你也需要二进制日志


# binary logging format - mixed recommended   # 二进制日志格式

binlog_format=mixed

#推荐的二进制日志格式 - mixed


# If you're using replication with chained slaves (A->B->C), you need to

# enable this option on server B. It enables logging of updates done by

# the slave thread into the slave's binary log.

# log_slave_updates

# 如果你正在使用级联从服务器(A-〉B-〉C)进行复制,你需要在服务器 B 上启用该选项

# 它允许通过从服务器线程将日志记录到从服务器的二进制日志中来实现日志的更新


# Enable the full query log. Every query (even ones with incorrect

# syntax) that the server receives will be logged. This is useful for

# debugging, it is usually disabled in production use.

# log

# 开启所有日志查询,服务器接收到每个查询都会被记录

#(包括哪些错误也都会被记录),这对调试是很有用的,但时在生产环境是关闭的

# Print warnings to the error log file.  If you have any problem with

# MySQL you should enable logging of warnings and examine the error log

# for possible explanations.   

# 打印所有的警告道错误日志文件,如果任何问题关于mysql 你可以开启日志警告,并检查错误日志

log_warnings

#日志打印警告到日志文件里去

# Log slow queries. Slow queries are queries which take more than the

# amount of time defined in "long_query_time" or which do not use

# indexes well, if log_short_format is not enabled. It is normally good idea

# to have this turned on if you frequently add new queries to the

# system.  

# 日志慢查询,慢查询是超过我们设置的最长的查询时间,或者是没有使用索引 

# 开启 log_short_format ,通常打开慢查询这样做是一个好的注意,如果你频繁地添加新查询到系统中

slow_query_log

#慢查询日志

# All queries taking 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 fast queries being logged from time to time (as MySQL

# currently measures time with second accuracy only).

#所有查询在你设置的时间内没有返回结果,我们就认为是慢,在这里不要使用1 

#然而返回结果里非常快的查询都会记录到慢查询日志里(mysql是一秒来计算单位)

long_query_time = 2

超过2秒就被认为慢查询


# ***  Replication related settings 



# Unique server identification number between 1 and 2^32-1. This value

# is required for both 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. #标识服务器唯一表示号数字范围从 1 -2^32 

# 这个值在主 和从都是需要的,它默认是1 如果你的主服务器,没有设置,MYSQL就不会作为主服务器

server-id = 1


# Replication Slave (comment out master section to use this)

# 从服务器

# To configure this host as a replication slave, you can choose between

# two methods :

# 配置从服务器,你可以选择下面两种方法

# 1) Use the CHANGE MASTER TO command (fully described in our manual) -

#    the syntax 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 quoted strings and

#    <port> by the master's port number (3306 by default).

#

#    Example: 举例

#

#    CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,

#    MASTER_USER='joe', MASTER_PASSWORD='secret';

#

# OR

# 第二种方法 设置一下变量 ,万一你选择这种方法,请在第一时间启动复制

# 从服务器将创建一个 master.info 文件,稍后在该文件中对下面变量值的任何改变都将被忽略

# 并被 master.info 文件中的连接所覆盖,除非你关闭从服务器、删除 master.info 

# 并重新启动从服务器基于这种因素,你可能想要离开下面未接触的行(已注释的)并替代使用 CHANGE MASTER TO(看上面)

# 2) Set the variables below. However, in case you choose this method, then

#    start replication for the first time (even unsuccessfully, for example

#    if you 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

#    the slave server, delete master.info and restart the slaver server.

#    For that reason, you may want to leave the lines below untouched

#    (commented) and instead use CHANGE MASTER TO (see above)

# 需要唯一标识符 从2-2^32 -1  (不同于Master)如果master已设置,默认从2开始 如果忽略,将不会设置从服务功能

# required unique id between 2 and 2^32 - 1

# (and different from the master)

# defaults to 2 if master-host is set

# but will not function as a slave if omitted

# server-id = 2

#

# The replication master for this slave - required

# master-host = <hostname>        #设置master主机(可以用 ip)

#

# The username the slave will use for authentication when connecting

# to the master - required

# master-user = <username>    #这个用户是用于从服务和主服务认证当连接的时候

#

# The password the slave will authenticate with when connecting to

# the master - required       #这个用户是用于从服务和主服务认证当连接的时候提供的密码

# master-password = <password>   

#

# The port the master is listening on.

# optional - defaults to 3306      #默认端口3306  指定主服务端口

# master-port = <port>

# 设置从服务只读,仅仅只有拥有 SUPER 特权的用户和复制从服务器线程能够修改它的数据

# 你可以使用这个来确保不会有应用程序在无意中替代主服务器修改从服务器上的数据

# Make the slave read-only. Only users with the SUPER privilege and the

# replication slave thread will be able to modify data on it. You can

# use this to ensure that no applications will accidently modify data on

# the slave instead of the master

# read_only



#*** MyISAM Specific options



# Size of the Key Buffer, used to cache index blocks for MyISAM tables.

# Do not set it larger than 30% of your available memory, as some memory

# is also required by 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 internal temporary disk tables.

key_buffer_size = 32M  #缓冲区的大小 ,缓存索引快用于MyISAM 表,不要设置超过你可用内存的30%

#同样你的操作系统也需要内存,即使你没有使用MyISAM 表,你仍然需要设置8-64M,由于它将被用于内部临时磁盘表


# MyISAM uses special 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 larger than "key_buffer_size" for optimal performance.

# This buffer is allocated when a bulk insert is detected.   

# MyISAM 用特殊类似树的缓存去大量插入

# 操作会变的更快,这个变量将限制缓存树的每个线程的字节大小

# 设置它为0 将失去这个优化 为了优化性能

# 不要设置超过 key_buffer_size 的大小 当探测到有大量的插入,这个缓冲将被分配

bulk_insert_buffer_size = 64M


# This buffer is allocated when MySQL needs to rebuild the index in

# REPAIR, OPTIMIZE, ALTER table statements as well as in LOAD DATA INFILE

# into an empty table. It is allocated per thread so be careful with

# large settings.  

# 当MYSQL通过REPAIR, OPTIMIZE, ALTER table statements以及LOAD DATA INFILE 

# 到一个空表重建索引,这个缓存将被分配,它是给每个线程分配的,注意比较大的设置

myisam_sort_buffer_size = 128M


# The maximum size of the temporary file MySQL is allowed to use while

# recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE.

# If the file-size would be bigger than this, the index will be created

# through the key cache (which is slower).

# 当重建索引(在 REPAIR、ALTER TABLE 或 LOAD DATA INFILE 期间)时,MySQL 允许使用的临时文件的最大大小

# 如果“file-size”比这个值大,索引将通过键缓存(更慢一些)创建

myisam_max_sort_file_size = 10G  #


# If a table has more than one index, MyISAM can use more than one

# thread to repair them by sorting in parallel. This makes sense if you

# have multiple CPUs and plenty of memory.

# 如果一个表有查过一个索引,MyISAM可以在排序的时候并行使用超过一个的线程来修复他们

# 这是很有有意义的,如果你有多个CPU和大量的内存

myisam_repair_threads = 1


# Automatically check and repair not properly closed MyISAM tables.

# 自动检查和修复不适当关闭的MyISAM 表

myisam_recover


# *** INNODB Specific options ***

INNODB 特殊选项

# Use this option if you have a MySQL server with InnoDB support enabled

# but you do not plan to use it. This will save memory and disk space

# and speed up some things. 

# 如果你有一个MySQL服务支持InnoDB ,但是你计划不使用它

# 你可以使用这个选项,这将节约你内存和磁盘空间并且提高你运行效率

#skip-innodb


# Additional memory pool that is used by InnoDB to store metadata

# information.  If InnoDB requires more memory for this purpose it will

# start to allocate it from the OS.  As this is fast enough on most

# recent operating systems, you normally do not need to change this

# value. SHOW INNODB STATUS will display the current amount used.  

# 将显示当前使用总量

# 额外添加一个内存池,它将被用于InnoDB 存储元数据信息,如果InnoDB 需要更多内存用于此

# 他将开始从操作系统分配资源,由于这在大多数最近的操作系统上是足够快的,通常你不需要改变着一值

innodb_additional_mem_pool_size = 16M


# InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and

# row data. The bigger you set this the less disk I/O is needed to

# access data in tables. On a dedicated database server you may set this

# parameter up to 80% of the machine physical memory size. Do not set it

# too large, though, because competition of the physical memory may

# cause paging in the operating system.  Note that on 32bit systems you

# might be limited to 2-3.5G of user level memory per process, so do not

# set it too high.

# InnoDB,不像 MyISAM,使用一个缓冲池来缓存索引和行数据

# 你将该值设得越大,在表中访问需要的数据时,磁盘 I/O 就越少

# 在一个专用的数据库服务器上,你可以设置该参数到机器物理内存大小的 80%

# 不要把它设置得太大,因为物理内存的竞争可能导致操作系统中的分页

# 注意,在32位的系统上,你可能在每个处理器的用户级内存上被限制在 2-3.5G,因此不要把它设置得太高

innodb_buffer_pool_size = 2G #设置innodb缓冲池大小



# InnoDB stores data in one or more data files forming the tablespace.

# If you have a single logical drive for your data, a single

# autoextending file would be good enough. In other cases, a single file

# per device is often a good choice. You can configure InnoDB to use raw

# disk partitions as well - please refer to the manual for more info

# about this.

# InnoDB 存储数据到一个或多个数据文件,形成表空间

# 如果你有一个单一的物理设备,来存储数据,那么一个单一的自动扩展文件就已经足够了

# 在其它情况下,每设备一个单一文件是一个非常好的选择

# 你也可以配置 InnoDB 来使用原始的磁盘分区 - 请参考手册以获取更多有关这个的信息

innodb_data_file_path = ibdata1:10M:autoextend


# Set this option if you would like the InnoDB tablespace files to be

# stored in another location. By default this is the MySQL datadir.

# 如果你希望 InnoDB 表空间文件存储到其它的地方,设置该选项

# 默认的是 MySQL 数据目录

#innodb_data_home_dir = <directory>


# Number of IO threads to use for async IO operations. This value is

# hardcoded to 8 on Unix, but on Windows disk I/O may benefit from a

# larger number.

# 一些IO线程用于异步IO操作

# 这个值是硬编码到8在Unix上,但在Windows磁盘I/O可能受益于一个更大数

innodb_write_io_threads = 8

innodb_read_io_threads = 8


# If you run into InnoDB tablespace corruption, setting this to a nonzero

# value will likely help you to dump your tables. Start from value 1 and

# increase it until you're able to dump the table successfully.

# 如果你遇到 InnoDB 表空间破坏,设置该值为一个非零值,将很容易地帮助你导出你的表

# 以值 1 开始并增加它,直到你能够成功地导出表

# innodb_force_recovery=1


# Number of threads allowed inside the InnoDB kernel. The optimal value

# depends highly on the application, hardware as well as the OS

# scheduler properties. A too high value may lead to thread thrashing.

# InnoDB 内核里面允许的线程数量。

# 最佳的值高度取决于应用程序、硬件以及操作系统的调度属性。

# 一个太高的值可能导致线程颠簸。

innodb_thread_concurrency = 16


# If set to 1, InnoDB will flush (fsync) the transaction logs to the

# disk at each commit, which offers full ACID behavior. If you are

# willing to compromise this safety, and you are running small

# transactions, you may set this to 0 or 2 to reduce disk I/O to the

# logs. Value 0 means that the log is only written to the log file and

# the log file flushed to disk approximately once per second. Value 2

# means the log is written to the log file at each commit, but the log

# file is only flushed to disk approximately once per second.

# 如果设置为 1,InnoDB 在每次提交(提供完整的 ACID 行为)时刷新事务日志到磁盘

# 如果你想安全地进行折中,并且你正在运行小事务,你可以为 0 或 2 来减少日志的磁盘 I/O

# 值 0 表示日志只被写入到日志文件,并且日志文件大约每秒一次刷新到磁盘

# 值 2 表示日志在每次提交时被写入到日志文件,但是日志文件只是大约每秒一次被刷新到磁盘

innodb_flush_log_at_trx_commit = 1


# Speed up InnoDB shutdown. This will disable InnoDB to do a full purge

# and insert buffer merge on shutdown. It may increase shutdown time a

# lot, but InnoDB will have to do it on the next startup instead.

# 加速 InnoDB 的关闭

# 这在关闭时将禁用 InnoDB 做一个完整的清除和插入缓冲合并

# 它可能会提高不少关闭的时间,但替代的是 InnoDB 将在下一次启动时来完成它

# innodb_fast_shutdown


# The size of the buffer 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 second anyway, it does not make sense to have it very large

# (even with long transactions). 

# InnoDB 缓冲日志数据所使用的缓冲区大小

# 一旦它满了,InnoDB 将刷新它到磁盘

# 因为不管怎么它都是每秒刷新一次,所以没有必要让它变得很大(甚至是很长的事务)

innodb_log_buffer_size = 8M


# Size of each log file in a log group. You should set the combined size

# of log files to about 25%-100% of your buffer pool size to avoid

# unneeded buffer pool flush activity on log file overwrite. However,

# note that a larger logfile size will increase the time needed for the

# recovery process.

#一个日志组中每个日志文件的大小

# 你可以设置日志文件的联合大小为你的缓冲池大小的 25%-100%,以避免对日志文件不必要的缓冲池动态刷新重写

# 然而,注意,一个更大的日志文件大小将增加恢复处理所需的时间

innodb_log_file_size = 256M


# Total number of files in the log group. A value of 2-3 is usually good

# enough.

# 日志组中文件的总数

# 通常值为 2-3 就已足够了

innodb_log_files_in_group = 3


# Location of the InnoDB log files. Default is the MySQL datadir. You

# may wish to point it to a dedicated hard drive or a RAID1 volume for

# improved performance

# InnoDB 日志文件的位置

# 默认为 MySQL 的数据目录

# 你可能希望指定它到一个专用的硬盘或一个 RAID1 卷标来改善性能

#innodb_log_group_home_dir


# Maximum allowed percentage of dirty pages in the InnoDB buffer pool.

# If it is reached, InnoDB will start flushing them out agressively to

# not run out of clean pages at all. This is a soft limit, not

# guaranteed to be held.

# InnoDB 缓冲池中允许的脏页面的最大百分比

# 如果它到达了,InnoDB 将开始积极地清理它们,以避免消耗完所有的干净页面

# 这是一个软限制,不保证能够一直保持

innodb_max_dirty_pages_pct = 90


# The flush method InnoDB will use for Log. The tablespace always uses

# doublewrite flush logic. The default value is "fdatasync", another

# option is "O_DSYNC".

# InnoDB 对日志使用的刷新方法

# 表空间总是使用双写刷新逻辑

# 默认值为“fdatasync”,其它选项是“O_DSYNC”

#innodb_flush_method=O_DSYNC


# How long an InnoDB transaction should wait for a lock to be granted

# before being rolled back. InnoDB automatically detects transaction

# deadlocks in its own lock table and rolls back the transaction. If you

# use the LOCK TABLES command, or other transaction-safe storage engines

# than InnoDB in the same transaction, then a deadlock may arise which

# InnoDB cannot notice. In cases like this the timeout is useful to

# resolve the situation.

# 一个 InnoDB 事务应等待的在回滚之前被授权锁定的时长

# InnoDB 在它自己的锁定表中自动地检测事务死锁,并回滚事务

# 如果你在相同的事务中使用 LOCK TABLES 命令,或者

# 其它比 InnoDB 更加事务安全的存储引擎,那么稍后会出现 InnoDB 不能提示的死锁

# 如果像这样,超时对于解决问题是很有用的。

innodb_lock_wait_timeout = 120



[mysqldump]

# Do not buffer the whole result set in memory before writing it to

# file. Required for dumping very large tables

quick


max_allowed_packet = 16M  #最大允许的包


[mysql]

no-auto-rehash            #自动进行重新哈希


# Only allow UPDATEs and DELETEs that use keys.  #只允许 UPDATE 和 DELETE 使用键。

# safe-updates      


[myisamchk]

key_buffer_size = 512M    #索引缓冲区

sort_buffer_size = 512M   #排序缓冲区

read_buffer = 8M          #读缓冲

write_buffer = 8M         # 写缓冲


[mysqlhotcopy]

interactive-timeout       #服务器关闭交互式连接前等待活动的秒数


[mysqld_safe]

# Increase the amount of open files allowed per process. Warning: Make

# sure you have set the global system limit high enough! The high value

# is required for a large number of opened tables

# 增加每次处理所允许打开的文件数量

# 警告:确保你已经设置全局系统限制足够高!

# 对于一个大数量的打开表,高值是必须的

open-files-limit = 8192



你可能感兴趣的:(example,Complex,running,programs,performing)