MySQL导入挂在Mac上的Vagrant CoreOS盒子上

时间:2015-05-16 15:49:30

标签: mysql macos docker vagrant coreos

我使用以下内容进行本地开发设置:

  • Mac Yosemite 10.10.3
  • Vagrant 1.7.3
  • CoreOS alpha版本681.0.0
  • 2个基于Ubuntu 12.10的Docker容器,一个用于apache PHP,另一个用于mysql,

它设置为使用NFS将本地开发目录〜/ Sites同步到Vagrant框,因为我的工作目录以及MySQL目录位于此处(〜/ Sites / .coreos-databases / mysql)。从我所看到的,这不是最好的设置类型,但它已经为我工作了很长一段时间以及其他工作。

最近我无法将任何数据库转储导入此设置。导入开始并在此过程的大约一半时间内挂起。它发生在命令行以及Sequel Pro上。它确实导入了一些表格,但每次都在同一地点冻结。转储的大小似乎并不重要 - 我一直尝试的只有104Kb。其他人在100MB +转储时遇到同样的问题 - 大约在同一位置冻结一半。

我的Vagrantfile:

Vagrant.configure("2") do |config|

# Define the CoreOS box
config.vm.box = "coreos-alpha"
config.vm.box_url = "http://alpha.release.core-os.net/amd64-usr/current/coreos_production_vagrant.json"

# Define a static IP
config.vm.network "private_network",
    ip: "33.33.33.77"

# Share the current folder via NFS
config.vm.synced_folder ".", "/home/core/sites",
    id: "core",
    :nfs => true,
    :mount_options => ['nolock,vers=3,udp,noatime']

# Provision docker with shell
# config.vm.provision
config.vm.provision "shell",
    path: ".coreos-devenv/scripts/provision-docker.sh"

end

mysql的Dockerfile:

# Start with Ubuntu base
FROM ubuntu:12.10


# Install some basics
RUN apt-get update

# Install mysql
RUN apt-get install -y mysql-server

# Clean up after install
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

# Add a grants file to set up remote user
# and disbale the root user's remote access.
ADD grants.sql /etc/mysql/

# Add a conf file for correcting "listen"
ADD listen.cnf /etc/mysql/conf.d/

# Run mysqld on standard port
EXPOSE 3306

ENTRYPOINT ["/usr/sbin/mysqld"]
CMD ["--init-file=/etc/mysql/grants.sql"]

我'流浪汉ssh'进入并运行dmesg,这就是冻结后吐出的内容:

[  465.504357] nfs: server 33.33.33.1 not responding, still trying
[  600.091356] INFO: task mysqld:1501 blocked for more than 120 seconds.
[  600.092388]       Not tainted 4.0.3 #2
[  600.093277] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  600.094442] mysqld          D ffff880019dbfbc8     0  1501    939 0x00000000
[  600.095953]  ffff880019dbfbc8 ffffffff81a154c0 ffff88001ec61910 ffff880019dbfba8
[  600.098871]  ffff880019dbffd8 0000000000000000 7fffffffffffffff 0000000000000002
[  600.101594]  ffffffff8150b4e0 ffff880019dbfbe8 ffffffff8150ad57 ffff88001ed5eb18
[  600.103794] Call Trace:
[  600.104376]  [<ffffffff8150b4e0>] ? bit_wait+0x50/0x50
[  600.105934]  [<ffffffff8150ad57>] schedule+0x37/0x90
[  600.107505]  [<ffffffff8150da7c>] schedule_timeout+0x20c/0x280
[  600.108369]  [<ffffffff8101d799>] ? read_tsc+0x9/0x10
[  600.109370]  [<ffffffff810d731e>] ? ktime_get+0x3e/0xa0
[  600.110353]  [<ffffffff8101d799>] ? read_tsc+0x9/0x10
[  600.111327]  [<ffffffff810d731e>] ? ktime_get+0x3e/0xa0
[  600.112347]  [<ffffffff8150a31c>] io_schedule_timeout+0xac/0x130
[  600.113368]  [<ffffffff810a9ee7>] ? prepare_to_wait+0x57/0x90
[  600.114358]  [<ffffffff8150b516>] bit_wait_io+0x36/0x50
[  600.115332]  [<ffffffff8150b145>] __wait_on_bit+0x65/0x90
[  600.116343]  [<ffffffff81146072>] wait_on_page_bit+0xc2/0xd0
[  600.117453]  [<ffffffff810aa360>] ? autoremove_wake_function+0x40/0x40
[  600.119304]  [<ffffffff81146179>] filemap_fdatawait_range+0xf9/0x190
[  600.120646]  [<ffffffff81152ffe>] ? do_writepages+0x1e/0x40
[  600.121346]  [<ffffffff81147f96>] ? __filemap_fdatawrite_range+0x56/0x70
[  600.122397]  [<ffffffff811480bf>] filemap_write_and_wait_range+0x3f/0x70
[  600.123460]  [<ffffffffa0207b1e>] nfs_file_fsync_commit+0x23e/0x3c0 [nfs]
[  600.124399]  [<ffffffff811e7bf0>] vfs_fsync_range+0x40/0xb0
[  600.126163]  [<ffffffff811e7cbd>] do_fsync+0x3d/0x70
[  600.127092]  [<ffffffff811e7f50>] SyS_fsync+0x10/0x20
[  600.128086]  [<ffffffff8150f089>] system_call_fastpath+0x12/0x17

这里有什么想法吗?

1 个答案:

答案 0 :(得分:3)

我也在使用相同的设置。 Vagrant默认为UDP,因此从您的设置中删除它似乎工作。虽然没有测试过,但我没有遇到你遇到的MYSQL问题。

config.vm.synced_folder ".", "/home/core/sites",
    id: "core",
    nfs_version: "4",
    :nfs => true,
    :mount_options => ['nolock,noatime']

这对我有用。 YMMV。