磁盘满了影响mysql性能吗,Linux Server磁盘满导致的mysql数据库错误

因为博主在服务器上安装了一些文件存储服务,有几次出现了文件占满磁盘后导致数据库出错,在删除了多余文件之后也无法重启数据库。所有与数据库相关的服务均报错无法启动,比如Wordpress的数据库连接错误,Nextcloud的500错误等。

在磁盘满后,请不要立即重启服务器或数据库服务,应首先清理出磁盘空间,让数据库服务将缓存写入后再关闭或重启!若直接重启就会导致博主遇到的这种错误。

以下内容仅供参考,请根据自身报错情况进行修复。首先查看自己的服务器磁盘是否清理出足够的空间,使用命令如 df -h 和 du -h 进行检查。

检查是否因为一些日志文件导致空间占用过高,常见检查位置有 syslog 和 /var/log/nginx 等,根据自己安装情况而定。

尝试启动mysql,得到错误报告,位置一般在 /var/log/mysql/error.log 中

检查错误报告,如果是类似博主这种错误,会显示类似

2018-01-02 11:43:16 139786760734528 [Note] InnoDB: Using SSE crc32 instructions

2018-01-02 11:43:16 139786760734528 [Note] InnoDB: Initializing buffer pool, size = 16.0M

2018-01-02 11:43:16 139786760734528 [Note] InnoDB: Completed initialization of buffer pool

2018-01-02 11:43:16 139786760734528 [Note] InnoDB: Highest supported file format is Barracuda.

2018-01-02 11:43:16 139786760734528 [Note] InnoDB: 128 rollback segment(s) are active.

2018-01-02 11:43:16 139786760734528 [Note] InnoDB: Waiting for purge to start

2018-01-02 11:43:16 139786760734528 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.34-79.1 started; log sequence number 1181473902

2018-01-02 11:43:16 139786449975040 [Note] InnoDB: Dumping buffer pool(s) not yet started

2018-01-02 11:43:16 139786760734528 [Note] Plugin 'FEEDBACK' is disabled.

2018-01-02 11:43:16 139786760734528 [Note] Recovering after a crash using tc.log

2018-01-02 11:43:16 139786760734528 [ERROR] Can't init tc log

2018-01-02 11:43:16 139786760734528 [ERROR] Aborting

1

2

3

4

5

6

7

8

9

10

11

122018-01-0211:43:16139786760734528[Note]InnoDB:UsingSSEcrc32instructions

2018-01-0211:43:16139786760734528[Note]InnoDB:Initializingbufferpool,size=16.0M

2018-01-0211:43:16139786760734528[Note]InnoDB:Completedinitializationofbufferpool

2018-01-0211:43:16139786760734528[Note]InnoDB:HighestsupportedfileformatisBarracuda.

2018-01-0211:43:16139786760734528[Note]InnoDB:128rollbacksegment(s)areactive.

2018-01-0211:43:16139786760734528[Note]InnoDB:Waitingforpurgetostart

2018-01-0211:43:16139786760734528[Note]InnoDB:PerconaXtraDB(http://www.percona.com) 5.6.34-79.1 started; log sequence number 1181473902

2018-01-0211:43:16139786449975040[Note]InnoDB:Dumpingbufferpool(s)notyetstarted

2018-01-0211:43:16139786760734528[Note]Plugin'FEEDBACK'isdisabled.

2018-01-0211:43:16139786760734528[Note]Recoveringafteracrashusingtc.log

2018-01-0211:43:16139786760734528[ERROR]Can'tinittclog

2018-01-0211:43:16139786760734528[ERROR]Aborting

其中问题关键出在无法初始化 tc.log 文件

因此解决方案是删除已有的tc.log文件(检查为空),然后重启mysql服务。tc.log 常见位于 /var/lib/mysql/ 中

sudo rm -f /var/lib/mysql/tc.log

service mysql restart

1

2sudorm-f/var/lib/mysql/tc.log

servicemysqlrestart

它会自动生成一个正常的tc.log文件,从而使mysql能够正常启动,问题解决!

你可能感兴趣的:(磁盘满了影响mysql性能吗)