简体   繁体   English

从存储引擎与MySQL的存储28错误

[英]error with storage 28 from storage engine with mysql

I am having an issue with a storage . 我的存储设备有问题。 I recieved this error 我收到此错误

 Got error 28 from storage engine 

I have checked the storage capacity and it was still available and it was not full. 我已经检查了存储容量,它仍然可用,并且没有满。 what can be the reason for this? 这可能是什么原因? I have checked everything with no success 我检查了一切都没有成功

It is possible that I am running out of main mysql data directory, or in the mysql tmp. 可能我的主mysql数据目录或mysql tmp用尽了。 Can someone tell me how to find their place in order to check for it too ? 有人可以告诉我如何找到自己的位置以进行检查吗?

It is possible that I am running out of main mysql data directory, or in the mysql tmp. 可能我的主mysql数据目录或mysql tmp用尽了。 Can someone tell me how to find their place in order to check for it too ? 有人可以告诉我如何找到自己的位置以进行检查吗?

TL;DR TL; DR

Issue the following commands to inspect the location of your server's data and temporary directories respectively: 发出以下命令分别检查服务器数据和临时目录的位置:

SHOW GLOBAL VARIABLES LIKE 'datadir'
SHOW GLOBAL VARIABLES LIKE 'tmpdir'

The values of these variables are typically absolute paths (relative to any chroot jail in which the server is running), but if they happen to be relative paths then they will be relative to the working directory of the process that started the server. 这些变量的值通常是绝对路径(相对于运行服务器的任何chroot监狱),但是如果它们恰好是相对路径,则它们将相对于启动服务器的进程的工作目录。

However... 然而...

As documented under The MySQL Data Directory (emphasis added): “ MySQL数据目录” (已添加重点)所述:

The following list briefly describes the items typically found in the data directory ... 以下列表简要描述了通常在数据目录中找到的项目...

Some items in the preceding list can be relocated elsewhere by reconfiguring the server. 通过重新配置服务器,可以将上述列表中的某些项目重新放置在其他位置。 In addition, the --datadir option enables the location of the data directory itself to be changed. 另外,使用--datadir选项可以更改数据目录本身的位置。 For a given MySQL installation, check the server configuration to determine whether items have been moved. 对于给定的MySQL安装,请检查服务器配置以确定是否已移动项目。

You may therefore also wish to inspect the values of a number of other variables, including: 因此,您可能还希望检查许多其他变量的值,包括:

  • pid_file
  • ssl_%
  • %_log_file
  • innodb_data_home_dir
  • innodb_log_group_home_dir
  • innodb_temp_data_file_path
  • innodb_undo_directory
  • innodb_buffer_pool_filename

If your server is not responsive... 如果您的服务器没有响应...

You can also inspect the server's startup configuration. 您还可以检查服务器的启动配置。

As documented under Specifying Program Options , the server's startup configuration is determined " by examining environment variables, then by processing option files, and then by checking the command line " with later options taking precedence over earlier options. 如在“ 指定程序选项”下记录的,“ 通过检查环境变量,然后通过处理选项文件,然后通过检查命令行 ”来确定服务器的启动配置其中优先于较早选项的较新选项。

The documentation also lists the locations of the Option Files Read on Unix and Unix-Like Systems , should you require it. 该文档还列出了在Unix和类似Unix的系统上读取选项文件的位置(如果需要)。 Note that the sections of those files that the server reads is determined by the manner in which the server is started, as described in the second and third paragraphs of Server Command Options . 请注意,服务器读取的那些文件的部分由服务器启动的方式决定,如服务器命令选项的第二和第三段所述。

Once you have found the locations where MySQL stores files, run a command in the shell: 找到MySQL存储文件的位置后,在shell中运行命令:

df -Ph <pathname>

Where <pathname> is each of the locations you want to test. 其中<pathname>是要测试的每个位置。 Some may be on the same disk volume, so they'll show up as the same when reported by df . 一些磁盘可能位于同一磁盘卷上,因此当df报告它们时,它们将显示为相同的磁盘卷。

[vagrant@localhost ~]$ mysql -e 'select @@datadir'
+-----------------+
| @@datadir       |
+-----------------+
| /var/lib/mysql/ |
+-----------------+

[vagrant@localhost ~]$ df -Ph /var/lib/mysql
Filesystem                       Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00   38G  3.7G   34G  10% /

This tells me that the disk volume for my datadir is the root volume, including the top-level directory " / " and everything beneath that. 这告诉我datadir的磁盘卷是根卷,包括顶级目录“ / ”及其下的所有内容。 The volume is 10% full, with 34G unused. 该卷已满10%,未使用34G。

If the volume where your datadir reaches 100%, then you'll start seeing errno 28 issues when you insert new data and it needs to expand a MySQL tablespace, or write to a log file. 如果datadir达到100%的卷,那么当您插入新数据并且需要扩展MySQL表空间或写入日志文件时,您将开始看到errno 28问题。

In that case, you need to figure out what's taking so much space. 在这种情况下,您需要弄清楚正在占用多少空间。 It might be something under the MySQL directory, or like in my case, your datadir might be part of a larger disk volume, where all your other files exist. 它可能在MySQL目录下,或者像我这样,您的datadir可能是更大的磁盘卷的一部分,而其他所有文件都位于该磁盘卷中。 In that case, any accumulation of files on the system might cause the disk to fill up. 在这种情况下,系统上文件的任何积累都可能导致磁盘已满。 For example, log files or temp files even if they're not related to MySQL. 例如,日志文件或临时文件,即使它们与MySQL无关。

I'd start at the top of the disk volume and use du to figure out which directories are so full. 我将从磁盘卷的顶部开始,然后使用du找出哪些目录已满。

[vagrant@localhost ~]$ sudo du -shx /*
33M     /boot
34M     /etc
40K     /home
28M     /opt
4.0K    /tmp
2.0G    /usr
941M    /vagrant
666M    /var

Note: if your df command told you that your datadir is on a separate disk volume, you'd start at that volume's mount point. 注意:如果df命令告诉您datadir在单独的磁盘卷上,则应从该卷的安装点开始。 The space used by one disk volume does not count toward another disk volume. 一个磁盘卷使用的空间不计入另一磁盘卷。

Now I see that /usr is taking the most space, of top-level directories. 现在,我看到/usr占用了顶层目录的最大空间。 Drill down and see what's taking space under that: 向下钻取,看看在此之下占用了什么空间:

[vagrant@localhost ~]$ sudo du -shx /usr/*
166M    /usr/bin
126M    /usr/include
345M    /usr/lib
268M    /usr/lib64
55M     /usr/libexec
546M    /usr/local
106M    /usr/sbin
335M    /usr/share
56M     /usr/src

Keep drilling down level by level. 继续逐级向下钻取。

Usually the culprit ends up being pretty clear. 通常,罪魁祸首最终变得非常清晰。 Like if you have some huge 500G log file /var/log somewhere that has been growing for months. 就像您有一些巨大的500G日志文件/var/log ,这个文件已经增长了几个月。

An example of a typical culprit is the http server logs. HTTP服务器日志就是典型的罪魁祸首。


Re your comments: 对您的评论:

It sounds like you have a separate storage volume for your database storage. 听起来您有一个单独的数据库存储卷。 That's good. 那很好。

You just added the du output to your question above. 您刚刚将du输出添加到上面的问题中。 I see that in your 1.4T disk volume, the largest single file by far is this: 我看到在您的1.4T磁盘卷中,迄今为止最大的单个文件是:

1020G   /vol/db1/mysql/_fool_Gerg_sql_200e_4979_main_16419_2_18.tokudb$

This appears to be a TokuDB tablespace. 这似乎是一个TokuDB表空间。 There's information on how TokuDB handles full disks here: https://www.percona.com/doc/percona-server/LATEST/tokudb/tokudb_faq.html#full-disks 此处提供有关TokuDB如何处理完整磁盘的信息: https ://www.percona.com/doc/percona-server/LATEST/tokudb/tokudb_faq.html#full-disks

I would not remove those files. 我不会删除这些文件。 I'm not as familiar with TokuDB as I am with InnoDB, but I assume those files are important datafiles. 我对TokuDB的了解不如对InnoDB的了解,但我认为这些文件是重要的数据文件。 If you remove them, you will lose part of your data and you might corrupt the rest of your data. 如果删除它们,则将丢失部分数据,并且可能会破坏其余数据。

I found this post, which explains in detail what the files are used for: https://www.percona.com/blog/2014/07/30/examining-the-tokudb-mysql-storage-engine-file-structure/ 我发现了这篇文章,其中详细说明了文件的用途: https : //www.percona.com/blog/2014/07/30/examining-the-tokudb-mysql-storage-engine-file-structure/

The manual also says: 该手册还说:

Deleting large numbers of rows from an existing table and then closing the table may free some space, but it may not. 从现有表中删除大量行,然后关闭表可能会释放一些空间,但可能不会。 Deleting rows may simply leave unused space (available for new inserts) inside TokuDB data files rather than shrink the files (internal fragmentation). 删除行可能只是在TokuDB数据文件中留下未使用的空间(可用于新插入),而不是缩小文件(内部碎片)。

So you can DELETE rows from the table, but the physical file on disk may not shrink. 因此,您可以从表中删除行,但是磁盘上的物理文件可能不会缩小。 Eventually, you could free enough space that you can build a new TokuDB data file with ALTER TABLE <tablename> ENGINE=TokuDB ROW_FORMAT=TOKUDB_SMALL; 最终,您可以释放足够的空间来使用ALTER TABLE <tablename> ENGINE=TokuDB ROW_FORMAT=TOKUDB_SMALL;来构建新的TokuDB数据文件ALTER TABLE <tablename> ENGINE=TokuDB ROW_FORMAT=TOKUDB_SMALL; (see https://dba.stackexchange.com/questions/48190/tokudb-optimize-table-does-not-reclaim-disk-space ) (请参阅https://dba.stackexchange.com/questions/48190/tokudb-optimize-table-does-not-reclaim-disk-space

But this will require enough free disk space to build the new table. 但这将需要足够的可用磁盘空间来构建新表。

So I'm afraid you have painted yourself into a corner. 所以,恐怕您已经把自己画在了一个角落。 You no longer have enough disk space to rebuild your large table. 您不再有足够的磁盘空间来重建大型表。 You should never let the free disk space get smaller than the space required to rebuild your largest table. 您绝不能让可用磁盘空间小于重建最大表所需的空间。

At this point, you probably have to use mysqldump to dump data from your largest table. 此时,您可能必须使用mysqldump从最大表中转储数据。 Not necessarily the whole table, but just what you want to keep (read about the mysqldump --where option). 不一定是整个表,而是您想要保留的表(了解mysqldump --where选项)。 Then DROP TABLE to remove that large table entirely. 然后DROP TABLE以完全删除该大表。 I assume that will free disk space, where using DELETE won't. 我认为这将释放磁盘空间,而使用DELETE则不会。

You don't have enough space on your db1 volume to save the dump file, so you'll have to save it to another volume. db1卷上没有足够的空间来保存转储文件,因此您必须将其保存到另一个卷。 It looks like you have a larger volume on /vol/cbgb1, but I don't know if it's full. 看来您在/ vol / cbgb1上有更大的音量,但我不知道它是否已满。

I'd dump the whole thing, for archiving purposes. 我会把整个东西丢掉,以备存档之用。 Then dump again with a subset. 然后再次转储一个子集。

mkdir /vol/cbgdb1/backup
mysqldump fool Gerg | gzip -c > /vol/cbgdb1/backup/Gerg-dump-full.sql.gz
mysqldump fool Gerg --where "id > 8675309" | gzip -c > /vol/cbgb1/backup/Gerg-dump-partial.sql.gz

I'm totally guessing at the arguments to --where . 我完全在猜测--where的参数。 You'll have to decide how you want to select for a partial dump. 您必须决定如何选择部分转储。

After the big table is dropped, reload the partial data you dumped: 删除大表后,重新加载转储的部分数据:

gunzip -c /vol/cbgb1/backup/Gerg-dump-partial.sql.gz | mysql fool

If there are any commands I've given in my examples that you don't already know well, I suggest you learn them before trying them. 如果我在示例中给出了您不太了解的命令,建议您在尝试之前先学习它们。 Or find someone to pair with who is more familiar with those commands. 或找到与这些命令更熟悉的人配对。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM