14.7.3UsingRawDiskPartitionsForTheSystemTablespace

You can use raw disk partitions as data files in the InnoDB system tablespace. This technique enables nonbuffered I/O on Windows and on some Linux and Unix systems without file system overhead. Perform tests with and without raw partitions to verify whether this change actually improves performance on your system.
您可以使用原始磁盤分區作爲InnoDB系統表空間中的數據文件。這種技術可以在Windows和某些Linux和Unix系統上啓用非緩衝 I/O,而無需文件系統開銷。在有原始分區和沒有原始分區的情況下執行測試,以驗證此更改是否確實提高了系統的性能
When you use a raw disk partition, ensure that the user ID that runs the MySQL server has read and write privileges for that partition. For example, if you run the server as the mysql user, the partition must be readable and writeable by mysql. If you run the server with the --memlock option, the server must be run as root, so the partition must be readable and writeable by root.
在使用原始磁盤分區時,請確保運行MySQL服務器的用戶ID對該分區具有讀寫權限。例如,如果您以mysql用戶身份運行服務器,則分區必須是mysql可讀可寫的。如果使用--memlock選項運行服務器,則必須以root用戶身份運行服務器,以便該分區必須是root可讀可寫的
The procedures described below involve option file modification. For additional information, see Section 4.2.6, “Using Option Files”.
下面介紹的過程涉及選項文件修改。 有關更多信息,請參見Section 4.2.6, “Using Option Files”.

Allocating a Raw Disk Partition on Linux and Unix Systems
在Linux和Unix系統上分配原始磁盤分區

  • When you create a new data file, specify the keyword newraw immediately after the data file size for the innodb_data_file_path option. The partition must be at least as large as the size that you specify. Note that 1MB in InnoDB is 1024 × 1024 bytes, whereas 1MB in disk specifications usually means 1,000,000 bytes.
  • 創建新數據文件時,請在innodb_data_file_path選項的數據文件大小後立即指定關鍵字newraw。分區必須至少與指定的大小相同。請注意,InnoDB中的1MB是1024×1024字節,而磁盤規格中的1MB通常表示1,000,000字節。
    [mysqld]
    innodb_data_home_dir=
    innodb_data_file_path=/dev/hdd1:3Gnewraw;/dev/hdd2:2Gnewraw
    • Restart the server. InnoDB notices the newraw keyword and initializes the new partition. However, do not create or change any InnoDB tables yet. Otherwise, when you next restart the server, InnoDB reinitializes the partition and your changes are lost. (As a safety measure InnoDB prevents users from modifying data when any partition with newraw is specified.)
    • 重新啓動服務器。 InnoDB注意到newraw關鍵字並初始化新的分區。但是,請不要創建或更改任何InnoDB表。否則,當您下次重新啓動服務器時,InnoDB將重新初始化分區,並且您的更改將丟失(作爲一項安全措施,InnoDB可防止用戶在任何指定了newraw的分區時修改數據)
    • After InnoDB has initialized the new partition, stop the server, change newraw in the data file specification to raw:
    • InnoDB初始化新分區後,停止服務器,將數據文件規範中的newraw更改爲raw:
      [mysqld]
      innodb_data_home_dir=
      innodb_data_file_path=/dev/hdd1:3Graw;/dev/hdd2:2Graw
    • Restart the server. InnoDB now permits changes to be made.
    • 重啓服務器。 InnoDB現在允許進行更改。

Allocating a Raw Disk Partition on Windows
在Windows上分配原始磁盤分區

On Windows systems, the same steps and accompanying guidelines described for Linux and Unix systems apply except that the innodb_data_file_path setting differs slightly on Windows.
在Windows系統上,除了在Windows上innodb_data_file_path設置略有不同之外,適用於Linux和Unix系統的相同步驟和相應指導原則適用。

  • When you create a new data file, specify the keyword newraw immediately after the data file size for the innodb_data_file_path option:
  • 當您創建新的數據文件時,請在innodb_data_file_path選項的數據文件大小之後立即指定關鍵字newraw:
    [mysqld]
    innodb_data_home_dir=
    innodb_data_file_path=//./D::10Gnewraw
    • The //./ corresponds to the Windows syntax of \.\ for accessing physical drives. In the example above, D: is the drive letter of the partition.
    • //./對應於用於訪問物理驅動器的\.\ 的Windows語法。 在上面的例子中,D:是分區的驅動器號。
  • Restart the server. InnoDB notices the newraw keyword and initializes the new partition.
  • 重新啓動服務器。 InnoDB注意到newraw關鍵字並初始化新的分區
  • After InnoDB has initialized the new partition, stop the server, change newraw in the data file specification to raw:
  • InnoDB初始化新分區後,停止服務器,將數據文件規範中的newraw更改爲raw:
    [mysqld]
    innodb_data_home_dir=
    innodb_data_file_path=//./D::10Graw
  • Restart the server. InnoDB now permits changes to be made.
  • 重新啓動服務器。 InnoDB現在允許進行更改。

PREV: 14.7.2 Changing the Number or Size of InnoDB Redo. https://blog.51cto.com/itzhoujun/2359833

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