Mysql2 :: Error:内存不足,请考虑使用docker-compose.yml增加服务器排序缓冲区的大小 [英] Mysql2::Error: Out of sort memory, consider increasing server sort buffer size using docker-compose.yml
问题描述
我正在构建一个Rails应用程序,我导入了很多数据并将其插入数据库中。有些表还可以,有些表有一些错误,说明内存不足。
Hi I'm building a rails app and I imported lots of data and inserted into the database. Some tables are okay and some tables have some errors that says out of sort memory.
SQL错误
Mysql2::Error: Out of sort memory, consider increasing server sort buffer size
怎么办您使用 docker-compose.yml
命令增加服务器排序缓冲区的大小?
How do you increase server sort buffer size using the docker-compose.yml
command?
我已经尝试过以下方法:
I've tried this one:
version: '3'
services:
db:
image: mysql:latest
command:
- --default-authentication-plugin=mysql_native_password
- --innodb-buffer-pool-size=402653184
我确实添加了以下命令:
I did add this command:
--innodb-buffer-pool-size=402653184
,但我仍然收到相同的错误消息,提示它内存不足。有什么办法可以使用 docker-compose.yml
but I'm still getting the same error that it is out of memory. Is there any way to increase the buffer size using the docker-compose.yml
推荐答案
在测试了此结果后,这解决了我在docker中的 mysql容器
中的错误。
Turns out when I've tested this, this resolves my error in the mysql container
in docker.
添加此在 db
服务下的 docker-compose.yml
中执行命令以增加内存。
Add this command in docker-compose.yml
under your db
services to increase your memory.
--sort_buffer_size=1073741824
在删除应用程序时删除错误
To remove the error when your application is running on docker.
Error "1038 Out of sort memory, consider increasing server sort buffer size
请注意, 1073741824
等于字节,结果为 1GB
内存分配。
Note that 1073741824
is equal to bytes and will result to 1GB
memory allocation.
这篇关于Mysql2 :: Error:内存不足,请考虑使用docker-compose.yml增加服务器排序缓冲区的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!