装入数据卷后,Riak容器无法启动 [英] Riak container does not start when its data volume is mounted

查看:88
本文介绍了装入数据卷后,Riak容器无法启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下命令可以正常运行,并且riak服务将按预期启动:

The following command works perfectly and the riak service starts as expected:


docker run --name = riak -d -p 8087 :8087 -p 8098:8098 -v $ {pwd} / schemas:/ etc / riak / schema basho / riak-ts

docker run --name=riak -d -p 8087:8087 -p 8098:8098 -v $(pwd)/schemas:/etc/riak/schema basho/riak-ts

本地 schemas 目录已成功安装,并且riak读取了其中的 sql 文件。但是,如果我尝试挂载riak的 data log 目录,则riak服务不会启动,并且15秒后会超时:

The local schemas directory is mounted successfully and the sql file in it is read by riak. However if I try to mount the riak's data or log directories, the riak service does not start and timeouts after 15 seconds:


docker run --name = riak -d -p 8087:8087 -p 8098:8098 -v $ {pwd)/ logs :/ var / log / riak -v $ {pwd)/ schemas:/ etc / riak / schema basho / riak-ts

docker run --name=riak -d -p 8087:8087 -p 8098:8098 -v $(pwd)/logs:/var/log/riak -v $(pwd)/schemas:/etc/riak/schema basho/riak-ts

docker log riak 的输出:


+ / usr / sbin / riak start < br>
riak在15秒内无法启动,

请参见'riak console'的输出以获取更多信息。

如果您想让
等待更长的时间,将环境变量

WAIT_FOR_ERLANG设置为
等待的秒数。

+ /usr/sbin/riak start
riak failed to start within 15 seconds,
see the output of 'riak console' for more information.
If you want to wait longer, set the environment variable
WAIT_FOR_ERLANG to the number of seconds to wait.

为什么riak在日志或数据目录装入本地目录时无法启动?

Why does riak not start when it's logs or data directories are mounted to local directories?

推荐答案

此问题与挂载的 log 文件夹的目录所有者有关。文件夹 $ GROUP $ USER 预期为 riak 如下所示:

This issue is with the directory owner of mounted log folder. The folder $GROUP and $USER are expected to be riak as follow:

root@20e489124b9a:/var/log# ls -l
drwxr-xr-x 2 riak riak   4096 Jul 19 10:00 riak

但是随着交易量的增加,您将得到:

but with volumes you are getting:

root@3546d261a465:/var/log# ls -l
drwxr-xr-x 2 root root   4096 Jul 19 09:58 riak

一种解决方法是将目录所有权设置为 riak 用户和主机上的组,然后再启动容器。我在docker映像中查看了UID / GID( / etc / passwd ),它们是:

One way to solve this is to have the directory ownership as riak user and group on host before starting the container. I looked the UID/GID (/etc/passwd) in docker image and they were:

riak:x:102:105:Riak user,,,:/var/lib/riak:/bin/bash

现在在启动容器之前先更改主机目录的所有权:

now change the ownership on host directories before starting the container as:

sudo chown 102:105 logs/
sudo chown 102:105 data/

这应该可以解决。至少现在(是。详细信息此处

This should solve it. At least for now. Details here.

这篇关于装入数据卷后,Riak容器无法启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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