我无法让 MySQL 5.7 使用原始磁盘(绕过文件系统的块设备)来存储数据。我对文档基本上,第一次执行 mysqld 时,配置需要newraw
在 的值中包含关键字innodb_data_file_path
,而仅在第二次执行时才应将其替换为raw
。
[mysqld]
innodb_data_home_dir =
innodb_data_file_path = //./E::512Gnewraw
default-time-zone = SYSTEM
basedir = C:/MySQLSrv/
tmpdir = F:/MySQLTemp/
datadir = F:/MySQLData-raw/
pid-file = mysql.pid
port = 3306
socket = MySQL
enable-named-pipe = 1
skip-external-locking
key_buffer_size = 16M
innodb_log_file_size = 26547M
max_allowed_packet = 90M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
innodb_page_size = 64K
E: 和 F: 是大型 (~35 TB) vdisk 上的分区 - GPT 分区,第一个分区由 Windows 的磁盘管理设置为“未格式化”,第二个分区是 4 TB 的传统 NTFS。(我将 innodb 数据文件大小临时设置为 512 GB,因为无法使用 4TB 来工作,而这实际上是我测试时想要的。)我基本上是从头开始启动 MySQL,因此我第一次执行 mysqld 时使用了该--initialize-insecure
选项。这花了一段时间(考虑到数据文件的配置大小和任务管理器中观察到的磁盘传输速率,大约是我预期的时间),最终在配置下生成了通常的文件结构datadir
。这包括包含mysql
多个*.ibd
文件的目录,我不确定这是否应该发生。仍然,mySQL 日志中没有错误,以 524200 结尾的进度行表明表空间已初始化。
2021-10-21T09:47:55.686131Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-10-21T09:47:55.692239Z 0 [Warning] InnoDB: innodb-page-size has been changed from the default value 16384 to 65536.
100 200 300 400 500 <snip> 523900 524000 524100 524200
100 200 300 400 500 <snip> 26200 26300 26400 26500
100 200 300 400 500 <snip> 26200 26300 26400 26500
2021-10-21T09:56:54.318875Z 0 [Warning] InnoDB: New log files created, LSN=130881
2021-10-21T09:56:54.471343Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2021-10-21T09:56:54.533557Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 389cd84c-3255-11ec-8327-005056971dce.
2021-10-21T09:56:54.536035Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2021-10-21T09:56:56.339721Z 0 [Warning] CA certificate ca.pem is self signed.
2021-10-21T09:56:56.436944Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
因此我将选项切换为raw
,然后启动服务(我之前已经创建了它)。服务立即终止,记录它想要创建一个表空间(再次?),因为它找不到它,如果重做日志存在,这是一个坏主意 - 确实存在,选项--initialize-insecure
创建了它们,正如预期的那样。
2021-10-21T10:08:09.625276Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-10-21T10:08:09.625424Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2021-10-21T10:08:09.625800Z 0 [Note] MySQL (mysqld 5.7.29) starting as process 3356 ...
2021-10-21T10:08:09.634217Z 0 [Warning] InnoDB: innodb-page-size has been changed from the default value 16384 to 65536.
2021-10-21T10:08:09.634627Z 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2021-10-21T10:08:09.634873Z 0 [Note] InnoDB: Uses event mutexes
2021-10-21T10:08:09.635033Z 0 [Note] InnoDB: _mm_lfence() and _mm_sfence() are used for memory barrier
2021-10-21T10:08:09.635262Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-10-21T10:08:09.636051Z 0 [Note] InnoDB: Number of pools: 1
2021-10-21T10:08:09.636460Z 0 [Note] InnoDB: Not using CPU crc32 instructions
2021-10-21T10:08:09.638441Z 0 [Note] InnoDB: Initializing buffer pool, total size = 52G, instances = 16, chunk size = 128M
2021-10-21T10:08:10.597917Z 0 [Note] InnoDB: Completed initialization of buffer pool
2021-10-21T10:08:11.118090Z 0 [Note] InnoDB: The first innodb_system data file '//./E:' did not exist. A new tablespace will be created!
2021-10-21T10:08:11.118733Z 0 [ERROR] InnoDB: redo log file '.\ib_logfile0' exists. Creating system tablespace with existing redo log files is not recommended. Please delete all redo log files before creating new system tablespace.
2021-10-21T10:08:11.119256Z 0 [ERROR] InnoDB: InnoDB Database creation was aborted with error Generic error. You may need to delete the ibdata1 file before trying to start up again.
2021-10-21T10:08:11.336787Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2021-10-21T10:08:11.337058Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2021-10-21T10:08:11.337286Z 0 [ERROR] Failed to initialize builtin plugins.
2021-10-21T10:08:11.337474Z 0 [ERROR] Aborting
2021-10-21T10:08:11.337615Z 0 [Note] Binlog end
2021-10-21T10:08:11.337839Z 0 [Note] Shutting down plugin 'CSV'
2021-10-21T10:08:11.338806Z 0 [Note] MySQL: Shutdown complete
我在这里遗漏了什么?为什么 MySQL 在首次初始化后找不到原始磁盘数据文件?
答案1
看来您没有遵循列出的文档中的这个具体细节。
//./ 对应于 Windows 语法 \.\,用于访问物理驱动器。
Windows 的语法与 Linux 操作系统不同。