Summary of the use of MySQL database InnoDB introduction (i)

Source: Internet
Author: User

The installation package has recently been made on the server portion of the software being developed, but the server section needs to have MySQL database support. Therefore, a free-install version of the MySQL policy: the MySQL database needs to set up the files in the installer and packaging.    But also encountered a lot of problems, the following sections to summarize. Since we are using the InnoDB storage engine in MySQL, we will only introduce the InnoDB in this article, the details of which can be found on the official website of MySQL http://dev.mysql.com/.InnoDBOverviewInnoDBTo giveMySQLProvides transactional security with commit, rollback, and crash recovery capabilities (ACIDcompatible) storage engine.InnoDBLocked at the row level and also inSELECTStatement provides aOracleStyle consistent non-locking read. These features add to multi-user deployment and performance. Not inInnoDBThe need to expand the lock because theInnoDBRow-level locking is suitable for very small spaces.InnoDBalso supportsFOREIGN KEYForced. InSQLQuery, you are free toInnoDBTypes of tables and otherMySQLTypes of tables can be mixed even in the same query.InnoDBis designed for maximum performance when dealing with large amounts of data. It'sCPUEfficiency can be unmatched by any other disk-based relational database engine.InnoDBThe storage engine is fullyMySQLServer consolidation,InnoDBThe storage engine maintains its own buffer pool to cache data and indexes in main memory.InnoDBStore its table and index in a table space, a tablespace can contain several files (or raw disk partitions). This withMyISAMDifferent tables, such as inMyISAMEach table in the table is in a detached file.InnoDBThe table can be any size, even if the file size is limited to2GBOn the operating system.InnoDBis included by default in theMySQLBinary distribution.Windows Essentials InstallerMakeInnoDBBecomeWindowsOnMySQLThe default table.InnoDBare used to generate large database sites that require high performance. Well-knownInternetnews siteslashdot.orgRun onInnoDBOnMytrix, Inc.InInnoDBOn storage over1TBData, and there are other sitesInnoDBAverage per second on processing -Secondary insertion/The updated load.InnoDBConfigurationInnoDBThe storage engine is allowed by default. If you don't want to useInnoDBTable, you can addSkip-innodbOptions toMySQLOptions file.       BeInnoDBTwo important disk-based resources managed by the storage engine areInnoDBThe tablespace data file and its log file.       If you specify noInnoDBConfiguration options,MySQLWill be inMySQLCreate a data directory namedibdata1Of10MBThe size of the auto-extended data file, and two namedIb_logfile0AndIb_logfile1Of5MBThe size of the log file.       Comments:InnoDBTo giveMySQLProvides transactional security with commit, rollback, and crash recovery capabilities (ACIDcompatible) storage engine. If the operating system and hardware that you intend to run do not work as advertised,InnoDBCan not achieve such as the ability. Many operating systems or disk subsystems may delay or log write operations to improve performance. On some operating systems, it is the system call (Fsync ()) Also wait until all data that has not been written to the refreshed file can actually be returned before it is flushed to stable memory. Because of this, operating system crashes or power-down may corrupt the currently committed data, or in the worst , because the write operation has been logged and even the database has been destroyed. If data integrity is important to you, you should do something before you use any program in production "Pull-the-plugTestMac OS X 10.3and later versions,InnoDBThe use of a specialfcntl ()The file Refresh method. InLinux, it is recommended that you disable write-back caching.       InATAPIOn the hard disk, a similarHdparm-w0/dev/hdaThe command may work. Caution Some drives or disk controllers may not prohibit write-back caching.       Note: To get good performance, you should explicitly provide it as discussed in the following exampleInnoDBParameters. Naturally, you should edit the settings to suit your hardware and requirements.       to establishInnoDBTablespace file, inmy.cnfIn the options file.[Mysqld]Used in knotsInnodb_data_file_pathOptions. InWindows, you can use it in lieu ofMy.iniFile.Innodb_data_file_pathThe value should be a list of one or more data file specifications. If you name more than one data file, use the Semicolon(‘;’)Separate them:innodb_data_file_path=datafile_spec1[;d atafile_spec2] ...For example, set the explicitly created table space with the same characteristics as the default setting, as follows:[Mysqld]innodb_data_file_path=ibdata1:10m:autoextendThis setting configures an expandable size of10MBA separate file, namedibdata1。 The location of the file is not given, so the default isMySQLIn the data directory.       Size for sizeMOrGSuffix to specify that the description unit isMBOrGB。       A tablespace that contains a data directory namedibdata1The fixed size50MBData file and a name ofIbdata2Size is50MBAuto-extension file, which can be configured like this:[Mysqld]innodb_data_file_path=ibdata1:50m;ibdata2:50m:autoextendThe full suffix of a specified data file includes the file name, its size, and several optional attributes:File_name:file_size[:autoextend[:max:max_file_size]]autoextendProperties and subsequent properties can only be used toInnodb_data_file_pathThe last data file in the row.       If you specify the last data fileAutoextendOptions. If the data file runs out of free space in the tablespace,InnoDBThe data file is extended. The amplitude of the expansion is every8MB。       If the disk is full, you may want to add additional data to another hard drive. Reconfigure an existing table space for instructions see15.2.7section, "Add and removeInnoDBData and log files.InnoDBDo not perceive the maximum file size, so be careful with the file system, where the largest file size is2GB。 To specify the maximum size for an auto-extended data file, use theMaxProperty. The following configurations allowibdata1to the limit.500MB:[Mysqld]innodb_data_file_path=ibdata1:10m:autoextend:max:500minnodbBy default, theMySQLThe data Catalog creates a tablespace file. To explicitly specify a location, use theInnodb_data_home_dirOptions. For example, to use two namedibdata1AndIbdata2Files, but to create them to/ibdata, configure as followsInnoDB: [Mysqld]
Innodb_data_home_dir=/ibdata
Innodb_data_file_path=ibdata1:50m;ibdata2:50m:autoextend notes:InnoDBDo not create a directory, so please confirm before starting the server/ibdataThe directory does exist. This is true for any log file directory you have configured. UseUnixOrDOSOfmkdircommand to create any required directories.       By puttingInnodb_data_home_dirValues are deployed to the data file name, and a slash or backslash is added where needed,InnoDBform a directory path for each data file. IfInnodb_data_home_diroption is not at allmy.cnfAs mentioned in, the default value is "DotThe catalog ./, which meansMySQLData Catalog. If you specify Innodb_data_home_dir as an empty string, you can specify an absolute path for the data file listed in the Innodb_data_file_path value. The following example is equivalent to the previous example: [Mysqld]
Innodb_data_home_dir=
Innodb_data_file_path=/ibdata/ibdata1:50m;/ibdata/ibdata2:50m:autoextend Note that on some file systems, the data file must be less than2GB。 The merged dimensions of the data file must be at least10MB。       When you first create aInnoDBTable space, preferably starting from the command lineMySQLServer.InnoDBIt then prints the information created by the database to the screen, so you can see what is happening. For example, inWindowsOn, ifMysqld-maxInC:\mysql\bin, you can start it as follows:c:\> C:\mysql\bin\mysqld-max--consoleIf you do not send the server output to the screen, please check the server's error log to see during the startup processInnoDBWhat was printed.

Summary of the use of MySQL database InnoDB introduction (i)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.