0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Mysql x Docker】エラー「The table 'xxxx' is full」の原因とDockerの利用率を調べる方法

Posted at

概要

ローカル環境でMysqlのdockerを使っていたら以下のエラーに遭遇。
初めて見たエラーだったので調べてみました。

(1114, "The table 'xxxx' is full")

原因と対応

エラーメッセージから、とあるテーブルがデータをこれ以上格納できない状態になったということがわかります。
このエラーで考えられる一番の原因は、ローカル環境のDockerのディスクスペース不足だとのこと。

そういえば、先日結構重いDUMPファイルをインポートしたなと思い、
テーブルから余計なデータを削除したら、このエラーは表示されないようになりました。

調査方法

この際、Dockerの統計情報を調べる方法があるらしいので確認してみる。

コンテナ内でディスク使用量を確認するコマンドは以下の通り。
(<mysql-container>のところは該当のコンテナ名かIDにしてください)

docker exec -it <mysql-container> df -h

すると以下のような結果になります。

Filesystem      Size  Used Avail Use% Mounted on
overlay          64G   54G  6.6G  89% /
tmpfs            64M     0   64M   0% /dev
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
shm              64M     0   64M   0% /dev/shm
grpcfuse        461G  443G   18G  97% /etc/atbb.sql
/dev/vda1        64G   54G  6.6G  89% /etc/hosts
tmpfs           3.9G     0  3.9G   0% /sys/firmware

grpcfuseでは97%とあるのでかなり利用率が高いです。xxx.sqlがマウントされているのが原因でしょう。

また、以下のコマンドでは、稼働中のコンテナのリソース使用状況をリアルタイムで確認できます。

docker stats <mysql-container>

CPU使用率、メモリ使用量、ネットワークI/O、ブロックI/Oなど、コンテナのリソース使用状況に関する詳細が確認できます。

CONTAINER ID   NAME    CPU %     MEM USAGE / LIMIT    MEM %     NET I/O           BLOCK I/O       PIDS
xxxxxxxxxxxx   mysql   0.13%     448.2MiB / 7.75GiB   5.65%     21.3MB / 33.8MB   123MB / 305MB   32

メモリ使用率はそこまで高くないですね。他の稼働中コンテナも確認しましたが微々たるものでした。
BLOCK I/Oは、コンテナがディスクとどれだけ読み込み(インプット)と書き込み(アウトプット)をしているかの量を表しています。ここが高すぎるとディスクへのアクセスが頻繁に行われていることを意味するので、パフォーマンスに影響があるかもしれません。

特にコンテナを指定せず稼働中のものすべて確認したい場合は以下のコマンドで可能です。

docker stats -a

CONTAINER ID and Name the ID and name of the container
CPU % and MEM % the percentage of the host's CPU and memory the container is using
MEM USAGE / LIMIT the total memory the container is using, and the total amount of memory it is allowed to use
NET I/O The amount of data the container has received and sent over its network interface
BLOCK I/O The amount of data the container has written to and read from block devices on the host
PIDs the number of processes or threads the container has created
引用元: https://docs.docker.com/reference/cli/docker/container/stats/

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?