数据库无法启动 - 主机目录作为数据卷 [英] Database Fails to Start - Host Directory as a Data Volume

查看:167
本文介绍了数据库无法启动 - 主机目录作为数据卷的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在正确使用docker-compose(对于本地dev环境)时遇到困难,当我将数据卷包含到主机目录mariadb(和mysql)失败时。如何使用docker-compose并具有正确权限的主机文件夹。我看到几个其他数据卷问题,但在这种情况下,主机文件夹是挂载,mariadb不能使用它。



在我的docker-compose.yml我有:

  expressionengine:
image:mariadb
expose:
- 3306
volumes:#/ var / lib / mysql是来自my.cnf的数据类型
- ../containers/expressionengine/var-lib-mysql/:/var/lib/mysql
环境:
- MYSQL_ROOT_PASSWORD = password
- MYSQL_DATABASE = expressionengine

/ p>

 附加到builddev_expressionengine_1 
expressionengine_1 |运行mysql_install_db ...
expressionengine_1 |在/ var / lib / mysql /'...
中安装MariaDB / MySQL系统表150603 5:15:20 [注意] / usr / sbin / mysqld(mysqld 10.0.19-MariaDB-1〜wheezy-log)从进程38开始...
expressionengine_1 | 150603 5:15:20 [注意] InnoDB:使用互斥量来引用计数缓冲池页面
expressionengine_1 | 150603 5:15:20 [注意] InnoDB:InnoDB内存堆被禁用
expressionengine_1 | 150603 5:15:20 [Note] InnoDB:Mutexes和rw_locks使用GCC原子内建
expressionengine_1 | 150603 5:15:20 [注意] InnoDB:不使用内存屏障
expressionengine_1 | 150603 5:15:20 [注意] InnoDB:压缩表使用zlib 1.2.7
expressionengine_1 | 150603 5:15:20 [注意] InnoDB:使用Linux本地AIO
expressionengine_1 | 150603 5:15:20 [注意] InnoDB:不使用CPU crc32说明
expressionengine_1 | 150603 5:15:20 [注意] InnoDB:初始化缓冲池,大小= 256.0M
expressionengine_1 | 150603 5:15:20 [Note] InnoDB:完成缓冲池的初始化
expressionengine_1 | 2015-06-03 05:15:20 7f2425ed9760 InnoDB:操作系统错误号13在文件操作。
expressionengine_1 | InnoDB:错误的意思是mysqld没有对
expressionengine_1 |的访问权限InnoDB:目录。

我不知道mysql dir是写在主持有者中的权限。 Im也在一个mac上与kitematic:

  bash-3.2 $ cd containers / expressionengine / var-lib-mysql / 
bash-3.2 $ ls -la
total 0
drwxr-xr-x 3 tom staff 102 Jun 3 10:16。
drwxr-xr-x 3 tom工作人员102 6月3日10:16 ..
drwxr-xr-x 2 tom工作人员68 6月3日10:16 mysql


解决方案

问题只存在于OSX上,并且与boot2docker如何使用vboxsf有关。 vboxsf装载有一个UID,但数据库服务需要另一个UID。相关主题: https://github.com/kitematic/kitematic/issues/593


I am struggling with the proper use of docker-compose (for a local dev environment), when I include a data volume to a host directory mariadb (and mysql) fails. How do I use a host folder with docker-compose and with the correct permissions. I see several other data volume questions, but in this case the host folder is mounted and mariadb is not able to use it.

In my docker-compose.yml I have:

expressionengine:
  image: mariadb
  expose: 
   - "3306"
  volumes: # /var/lib/mysql is the datadir from my.cnf
   - ../containers/expressionengine/var-lib-mysql/:/var/lib/mysql
  environment:
   - MYSQL_ROOT_PASSWORD=password
   - MYSQL_DATABASE=expressionengine

But something is off:

Attaching to builddev_expressionengine_1
expressionengine_1 | Running mysql_install_db ...
expressionengine_1 | Installing MariaDB/MySQL system tables in '/var/lib/mysql/' ...
expressionengine_1 | 150603  5:15:20 [Note] /usr/sbin/mysqld (mysqld 10.0.19-MariaDB-1~wheezy-log) starting as process 38 ...
expressionengine_1 | 150603  5:15:20 [Note] InnoDB: Using mutexes to ref count buffer pool pages
expressionengine_1 | 150603  5:15:20 [Note] InnoDB: The InnoDB memory heap is disabled
expressionengine_1 | 150603  5:15:20 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
expressionengine_1 | 150603  5:15:20 [Note] InnoDB: Memory barrier is not used
expressionengine_1 | 150603  5:15:20 [Note] InnoDB: Compressed tables use zlib 1.2.7
expressionengine_1 | 150603  5:15:20 [Note] InnoDB: Using Linux native AIO
expressionengine_1 | 150603  5:15:20 [Note] InnoDB: Not using CPU crc32 instructions
expressionengine_1 | 150603  5:15:20 [Note] InnoDB: Initializing buffer pool, size = 256.0M
expressionengine_1 | 150603  5:15:20 [Note] InnoDB: Completed initialization of buffer pool
expressionengine_1 | 2015-06-03 05:15:20 7f2425ed9760  InnoDB: Operating system error number 13 in a file operation.
expressionengine_1 | InnoDB: The error means mysqld does not have the access rights to
expressionengine_1 | InnoDB: the directory.

Im not sure its permissions given that the mysql dir is written in the host holder. Im also on a mac with kitematic:

bash-3.2$ cd containers/expressionengine/var-lib-mysql/
bash-3.2$ ls -la
total 0
drwxr-xr-x  3 tom  staff  102 Jun  3 10:16 .
drwxr-xr-x  3 tom  staff  102 Jun  3 10:16 ..
drwxr-xr-x  2 tom  staff   68 Jun  3 10:16 mysql

解决方案

The problem only exists on OSX and is related to how boot2docker uses vboxsf. The vboxsf is mounted with one UID, but the database service needs another. Related thread: https://github.com/kitematic/kitematic/issues/593

这篇关于数据库无法启动 - 主机目录作为数据卷的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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