【发布时间】:2018-07-24 01:35:00
【问题描述】:
我在安装 MariaDB 的服务器上遇到了一些问题。
mariadb 进程几天前第一次突然停止工作,当我尝试重新启动它时
sudo service mariadb restart
我得到这个输出
Redirecting to /bin/systemctl restart mariadb.service
Job for mariadb.service failed because the control process exited with error cod e. See "systemctl status mariadb.service" and "journalctl -xe" for details.
[root@web-customer-01 ~]# systemctl status mariadb.service
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2018-02-13 15:43:56 UTC; 24s ago
Process: 10529 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=1/FAILURE)
Process: 10528 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=0/SUCCESS)
Process: 10498 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Main PID: 10528 (code=exited, status=0/SUCCESS)
Feb 13 15:43:54 web-customer-01.customer.it systemd[1]: Starting MariaDB database server...
Feb 13 15:43:54 web-customer-01.customer.it mariadb-prepare-db-dir[10498]: Database MariaDB is probably initialized in /var/lib/mysql already, nothing is done.
Feb 13 15:43:54 web-customer-01.customer.it mysqld_safe[10528]: 180213 15:43:54 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Feb 13 15:43:54 web-customer-01.customer.it mysqld_safe[10528]: 180213 15:43:54 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Feb 13 15:43:56 web-customer-01.customer.it systemd[1]: mariadb.service: control process exited, code=exited status=1
Feb 13 15:43:56 web-customer-01.customer.it systemd[1]: Failed to start MariaDB database server.
Feb 13 15:43:56 web-customer-01.customer.it systemd[1]: Unit mariadb.service entered failed state.
Feb 13 15:43:56 web-customer-01.customer.it systemd[1]: mariadb.service failed.
作为临时解决方案,我发现删除这些文件后,服务将重新启动,但我不确定这是一个[好的]解决方案。
/var/lib/mysql/ib_logfile0
/var/lib/mysql/ib_logfile1
我注意到 mariadb 日志中有很多这样的行
180213 15:53:29 InnoDB: Error: page 16392 log sequence number 19972774982
InnoDB: is in the future! Current system log sequence number 731248348.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: for more information.
然后,如上面链接中所述,我在 my.cnf
中添加了 innodb_force_recovery[mysqld]
innodb_force_recovery = 1
我试图调查问题,但我不知道可能的原因,因此我无法找到正确的解决方案。
-- 编辑
这是我的 /etc/my.cnf (这些天我添加了 innodb_force_recovery)
[mysqld]
innodb_force_recovery = 1
innodb_buffer_pool_size=256M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
skip-name-resolve
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
[client]
port = 3306
socket = =/var/lib/mysql/mysql.sock
【问题讨论】:
-
天哪,你真的在不知道它们的用途的情况下删除了这些文件吗?我也喜欢活在危险中!! dba.stackexchange.com/questions/27083/…
-
是的@Hackerman,但我在删除这些文件之前有几天前的备份。我了解其重要性,但这是使服务器再次联机的唯一方法。
-
你有多少内存?向我们展示您的
my.cnf。 一些像你这样的打嗝是由错误的配置引起的。 -
@RickJames 这是一个只有 1GB 内存的 Digital Ocean VPS,我将把 my.cnf 添加到帖子中。
标签: mysql database mariadb ubuntu-server