MYSQL插入大小为GB的巨大SQL文件 [英] MYSQL Insert Huge SQL Files of GB in Size

查看:372
本文介绍了MYSQL插入大小为GB的巨大SQL文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建Wikipedia数据库副本(大约50GB),但是最大的SQL文件存在问题.

I'm trying to create a Wikipedia DB copy (Around 50GB), but having problems with the largest SQL files.

我已经使用linux split实用程序将大小为GB的文件拆分为300 MB的块.例如

I've split the files of size in GB using linux split utility into chunks of 300 MB. e.g.

split -d -l 50 ../enwiki-20070908-page page.input.

在我的服务器上,平均300MB的文件平均需要3个小时. 我已经安装了Ubuntu 12.04服务器操作系统和Mysql 5.5 Server.

On average 300MB files take 3 hours at my server. I've ubuntu 12.04 server OS and Mysql 5.5 Server.

我正在尝试以下操作:

mysql -u username -ppassword database < category.sql

注意:这些文件由插入语句组成,不是CSV文件.

Wikipedia提供了数据库转储供下载,因此每个人都可以创建Wikipedia的副本. 您可以在此处找到示例文件:维基百科转储

Wikipedia offers database dumps for download, so everybody can create a copy of Wikipedia. You can find example files here: Wikipedia Dumps

由于MySQL Server的设置,我认为导入速度很慢,但是我不知道应该更改什么.我在具有不错处理器和2GB RAM的计算机上使用标准的Ubuntu MySQL配置.有人可以为我的系统提供合适的配置来帮助我吗?

I think the import is slow because of the settings for my MySQL Server, but I don't know what I should change. I'm using the standard Ubuntu MySQL config on a machine with a decent processor and 2GB RAM. Could someone help me out with a suitable configuration for my system?

我尝试将innodb_buffer_pool_size设置为1GB,但是没有用.

I've tried to set innodb_buffer_pool_size to 1GB but no vains.

推荐答案

由于内存不足50GB(因此无法在内存中缓冲整个数据库),因此瓶颈是磁盘子系统的写入速度.

Since you have less than 50GB of memory (so you can't buffer the entire database in memory), the bottleneck is the write speed of your disk subsystem.

加快进口速度的技巧:

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆