0

我可以启动mysqld并正常使用它。但是启动的持续时间很长(超过 3 分钟)。当我检查日志文件 ( /var/log/mysqld.log) 时,我发现InnoDB: Unable to lock ./ibdata1, error: 38.

最近,由于文件太大,我将我的 mysql 数据从 移动/var/lib/mysql到。/home/user/mysql然后我分别换datadir/etc/my.cnf/etc/init.d/mysqlddatasocketc/my.cnf。它的所有者和模式/home/user/mysql以及其中的文件也已正确设置。

此安装中的/home卷位于 Lustre 文件系统上。

当我发现我的数据库中有 3 个 innodb 引擎表时,我删除了它们。但问题仍然存在。

这是启动 mysqld ( /var/log/mysqld.log) 时的日志。

141027 19:40:03 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
141027 19:40:04 mysqld_safe Starting mysqld daemon with databases from /home/user/mysql
InnoDB: Unable to lock ./ibdata1, error: 38
141027 19:40:04  InnoDB: Retrying to lock the first data file
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
InnoDB: Unable to lock ./ibdata1, error: 38
141027 19:41:45  InnoDB: Unable to open the first data file
InnoDB: Error in opening ./ibdata1
141027 19:41:45  InnoDB: Operating system error number 38 in a file operation.
InnoDB: Error number 38 means 'Function not implemented'.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/operating-system-error-codes.html
InnoDB: Could not open or create data files.
InnoDB: If you tried to add new data files, and it failed here,
InnoDB: you should now edit innodb_data_file_path in my.cnf back
InnoDB: to what it was, and remove the new ibdata files InnoDB created
InnoDB: in this failed attempt. InnoDB only wrote those files full of
InnoDB: zeros, but did not yet use them in any way. But be careful: do not InnoDB: remove old data files which contain your precious data!
141027 19:41:45 [ERROR] Plugin 'InnoDB' init function returned error.
141027 19:41:45 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
141027 19:41:45 [Note] Event Scheduler: Loaded 0 events
141027 19:41:45 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.52'  socket: '/home/user/mysql/mysql.sock'  port: 3306  Source distribution
4

1 回答 1

1

您正在为/home卷使用 Lustre 文件系统。除非您专门在 Lustre 卷上启用它,否则该文件系统不支持文件锁定。但 InnoDB 需要锁定其文件才能正常运行。因此,当 InnoDB 发出ioctl(2)锁定文件的调用时,文件系统会退回“功能未实现”。这就是你的错误日志所说的。

InnoDB: Error in opening ./ibdata1
141027 19:41:45  InnoDB: Operating system error number 38 in a file operation.
InnoDB: Error number 38 means 'Function not implemented'.

这是关于这一点的旧列表服务器的链接。http://lists.lustre.org/pipermail/lustre-discuss/2007-August/003768.html 在该线程的某处有人提到如何启用文件锁定。

您可能希望与管理您的文件系统的人员合作,为您的 MySQL 数据库创建一个特殊用途的 Lustre 卷,该卷已启用锁定。

这是一个关键任务 MySQL 服务器吗?如果是这样,请在将其部署到此文件系统之前进行大量的尽职调查。

于 2014-10-28T12:49:47.600 回答