InnoDB
Configuration
1227
Caution
InnoDB
is a transaction-safe (ACID compliant) storage engine for MySQL
that has commit, rollback, and crash-recovery capabilities to protect user data.
However, it cannot do so if the underlying operating system or hardware
does not work as advertised. Many operating systems or disk subsystems may
delay or reorder write operations to improve performance. On some operating
systems, the very
fsync()
system call that should wait until all unwritten
data for a file has been flushed might actually return before the data has been
flushed to stable storage. Because of this, an operating system crash or a
power outage may destroy recently committed data, or in the worst case, even
corrupt the database because of write operations having been reordered. If
data integrity is important to you, you should perform some “pull-the-plug” tests
before using anything in production. On Mac OS X 10.3 and up,
InnoDB
uses
a special
fcntl()
file flush method. Under Linux, it is advisable to disable the
write-back cache.
On ATA/SATA disk drives, a command such
hdparm -W0 /dev/hda
may
work to disable the write-back cache. Beware that some drives or disk
controllers may be unable to disable the write-back cache.
Two important disk-based resources managed by the
InnoDB
storage engine are its tablespace
data files and its log files. If you specify no
InnoDB
configuration options, MySQL creates an
auto-extending data file, slightly larger than 10MB, named
ibdata1
and two log files named
ib_logfile0
and
ib_logfile1
in the MySQL data directory. Their size is given by the size of
the
innodb_log_file_size
[1247]
system variable. To get good performance, explicitly provide
InnoDB
parameters as discussed in the following examples. Naturally, edit the settings to suit your
hardware and requirements.
Caution
It is not a good idea to configure
InnoDB
to use data files or log files on NFS
volumes. Otherwise, the files might be locked by other processes and become
unavailable for use by MySQL.
The examples shown here are representative. See
Section 14.2.2, “
InnoDB
Startup Options and
System Variables”
for additional information about
InnoDB
-related configuration parameters.
To set up the
InnoDB
tablespace files, use the
innodb_data_file_path
[1240]
option in the
[mysqld]
section of the
my.cnf
option file. On Windows, you can use
my.ini
instead. The value of
innodb_data_file_path
[1240]
should be a list of one or more data file specifications. If you name
more than one data file, separate them by semicolon (“
;
”) characters:
innodb_data_file_path=
datafile_spec1
[;
datafile_spec2
]...
For example, the following setting explicitly creates a tablespace having the same characteristics as
the default:
[mysqld]
innodb_data_file_path=ibdata1:10M:autoextend
This setting configures a single 10MB data file named
ibdata1
that is auto-extending. No location for
the file is given, so by default,
InnoDB
creates it in the MySQL data directory.
Sizes are specified using
K
,
M
, or
G
suffix letters to indicate units of KB, MB, or GB.
A tablespace containing a fixed-size 50MB data file named
ibdata1
and a 50MB auto-extending file
named
ibdata2
in the data directory can be configured like this:
[mysqld]
innodb_data_file_path=ibdata1:50M;ibdata2:50M:autoextend
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...