CentOS7 上的 iscsi 驱动器上的 MySQL 无法在启动时启动

CentOS7 上的 iscsi 驱动器上的 MySQL 无法在启动时启动

我在 CentOS 7 上配置了 Mariadb 以在安装在 /mnt/iscsi 上的 iscsi 驱动器上运行,但它无法在启动时启动并出现以下错误(可以手动启动):

mariadb.service - MariaDB database server
Loaded: loaded (/etc/systemd/system/mariadb.service; enabled)
Active: failed (Result: exit-code) since Tue 2015-02-10 09:54:50 MSK; 51s ago
Process: 1283 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=1/FAILURE)

Feb 10 09:54:32 localhost systemd[1]: Starting MariaDB database server...
Feb 10 09:54:50 localhost mariadb-prepare-db-dir[1283]: mkdir: cannot create directory ‘/mnt/iscsi/mysql_databases/��...enied
Feb 10 09:54:50 localhost systemd[1]: mariadb.service: control process exited, code=exited status=1
Feb 10 09:54:50 localhost systemd[1]: Failed to start MariaDB database server.
Feb 10 09:54:50 localhost systemd[1]: Unit mariadb.service entered failed state.

journalctl 错误:

journalctl _PID=1283
 -- Logs begin at Tue 2015-02-10 11:39:22 MSK, end at Tue 2015-02-10 11:50:01 MSK. --
 Feb 10 11:44:09 localhost mariadb-prepare-db-dir[1264]: mkdir: cannot create directory ‘/mnt/iscsi/mysql_databases/’: Permissio

通过可执行文件进行 Journalctl

journalctl /usr/libexec/mariadb-prepare-db-dir
 -- Logs begin at Tue 2015-02-10 11:39:22 MSK, end at Tue 2015-02-10 12:05:51 MSK. --
 Feb 10 11:44:09 localhost mariadb-prepare-db-dir[1264]: mkdir: cannot create directory ‘/mnt/iscsi/mysql_databases/’: Permissio

“/var/log/mariadb/mariadb.log”中没有错误,因此我尝试修改启动顺序:

systemctl list-dependencies --before mariadb
mariadb.service
├─iscsi.service
├─iscsid.service
├─iscsid.socket
├─mnt-iscsi.mount
├─multi-user.target
│ ├─systemd-readahead-done.service
│ ├─systemd-readahead-done.timer
│ ├─systemd-update-utmp-runlevel.service
│ └─graphical.target
│   └─systemd-update-utmp-runlevel.service
└─shutdown.target
  ├─systemd-reboot.service
  └─final.target
    └─systemd-reboot.service

它没有帮助 :(

权限:

 ls -aZ /mnt
     drwxr-xr-x. mysql mysql system_u:object_r:file_t:s0 iscsi

 ls -aZ /mnt/iscsi/
     drwxr-xr-x. mysql mysql system_u:object_r:mysqld_db_t:s0 mysql_databases

 ls -aZ /mnt/iscsi/mysql_databases
     -rw-rw----. mysql mysql system_u:object_r:mysqld_db_t:s0 ibdata1
     -rw-rw----. mysql mysql system_u:object_r:mysqld_db_t:s0 ib_logfile0
     -rw-rw----. mysql mysql system_u:object_r:mysqld_db_t:s0 ib_logfile1
     drwx------. mysql mysql system_u:object_r:mysqld_db_t:s0 mysql
     -rw-rw----. mysql mysql system_u:object_r:mysqld_db_t:s0 mysql-bin.000001
     -rw-rw----. mysql mysql system_u:object_r:mysqld_db_t:s0 mysql-bin.index
     -rw-rw----. mysql mysql system_u:object_r:mysqld_db_t:s0 mysql-error.log
     -rw-rw----. mysql mysql system_u:object_r:mysqld_db_t:s0 mysql-slow.log
     drwx------. mysql mysql system_u:object_r:mysqld_db_t:s0 performance_schema
     drwx------. mysql mysql system_u:object_r:mysqld_db_t:s0 test

SELinux 处于宽容模式。

答案1

根据提供的信息

...mkdir:无法创建目录“/mnt/iscsi/mysql_databases/��...enied

这看起来就像您遇到了某种权限/所有权/SELinux 上下文问题。

您应该检查 /mnt/iscsi 树的权限、所有权和 SElinux 上下文并采取适当的措施。

相关内容