Ambari 2.2 - 在Ubuntu 14.04 Docker容器上退出非零状态代码

时间:2016-01-18 02:09:38

标签: apache hadoop docker ambari

TL; DR - Ubuntu 14.04上的Dockerized Ambari Docker容器在默认配置启动时抛出错误

我试图将Ambari部署Dockerize以支持在我的Hadoop容器旁边运行它。这是我的Dockerfile:

FROM ubuntu:14.04

ENV AMBARI_HOME /opt/ambari
ENV AMBARI_VERSION 2.2.0.0

RUN export DEBIAN_FRONTEND=noninteractive \
    && apt-get update \
    && apt-get -y install wget software-properties-common python-software-properties openssh-client openssh-server

# Install Java.
RUN \
  echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
  add-apt-repository -y ppa:webupd8team/java && \
  apt-get update && \
  apt-get install -y oracle-java8-installer && \
  rm -rf /var/lib/apt/lists/* && \
  rm -rf /var/cache/oracle-jdk8-installer

# Define commonly used JAVA_HOME variable
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle

RUN mkdir -p "$AMBARI_HOME"
WORKDIR $AMBARI_HOME

# passwordless ssh
RUN export DEBIAN_FRONTEND=noninteractive \
    && echo -e 'y\n'|ssh-keygen -q -t rsa -N "" -f /root/.ssh/id_rsa \
    && cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys

RUN export DEBIAN_FRONTEND=noninteractive \
    && wget -nv http://public-repo-1.hortonworks.com/ambari/ubuntu14/2.x/updates/2.2.0.0/ambari.list -O /etc/apt/sources.list.d/ambari.list \
    && apt-key adv --recv-keys --keyserver keyserver.ubuntu.com B9733A7A07513CAD \
    && apt-get update \
    && apt-get -y install ambari-server

#Disable SELinux
RUN echo SELINUX=disabled >> /etc/selinux/config

EXPOSE 8080

RUN ambari-server setup -s --verbose --java-home $JAVA_HOME
CMD ambari-server start

当我启动容器时,我收到以下错误 -

Using python  /usr/bin/python2
Starting ambari-server
Ambari Server running with administrator privileges.
About to start PostgreSQL
Organizing resource files at /var/lib/ambari-server/resources...
WARNING: setpgid(73, 0) failed - [Errno 13] Permission denied
Server PID at: /var/run/ambari-server/ambari-server.pid
Server out at: /var/log/ambari-server/ambari-server.out
Server log at: /var/log/ambari-server/ambari-server.log
Waiting for server start.........
ERROR: Exiting with exit code -1.
REASON: Ambari Server java process died with exitcode -1. Check /var/log/ambari-server/ambari-server.out for more information.

在ambari-server.log或.out

中似乎没什么用处。

我发现WARNING: setpgid(73, 0) failed - [Errno 13] Permission denied修复了此问题:setpgid issue

从阅读用于部署到Ubuntu 14.04的HortonWorks文档,这应该有效:

Install Ambari on Ubuntu 14.04

我尝试使用嵌入式Postges以及具有相同结果的外部Postges进行部署。

一个有趣的注意事项是,即使出现错误,Ambari似乎已经启动,我可以登录为默认的admin / admin,但是在调用`ambari-server stop'它说没有进程正在运行......

root@3e6d778b43f8:/opt/ambari# ambari-server stop
Using python  /usr/bin/python2
Stopping ambari-server
Ambari Server is not running
root@3e6d778b43f8:/opt/ambari# jps
868 AmbariServer
955 Jps

我明天会在我的Ubuntu盒子上复制这个设置,看看是否会发生同样的事情。

谢谢!

编辑#1:docker info

vagrant@vagrant-ubuntu-trusty-64:/vagrant/scripts$ docker info
Containers: 14
Images: 161
Server Version: 1.9.1
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 189
 Dirperm1 Supported: false
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 3.13.0-44-generic
Operating System: Ubuntu 14.04.1 LTS
CPUs: 1
Total Memory: 3.861 GiB
Name: vagrant-ubuntu-trusty-64
ID: 7AD6:Z5TH:76NW:G54B:IHVK:PWKP:E2LI:CRPI:MIGM:STJU:3D2B:K7EQ
WARNING: No swap limit support

vagrant@vagrant-ubuntu-trusty-64:/vagrant/scripts$ docker version
Client:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5
 Built:        Fri Nov 20 13:12:04 UTC 2015
 OS/Arch:      linux/amd64

Server:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5
 Built:        Fri Nov 20 13:12:04 UTC 2015
 OS/Arch:      linux/amd64

docker在Vagrant Virtualbox实例(v1.8.1)中运行

2 个答案:

答案 0 :(得分:2)

我在ubuntu 14.04上的docker中遇到了与ambari-server相同的问题。你能尝试下面的

吗?

解决aufs问题

在/ etc / default / docker中添加

DOCKER_OPTS="--storage-driver=devicemapper"

并重新启动docker服务。请注意,在此之后,所有图像都将消失(http://muehe.org/posts/switching-docker-from-aufs-to-devicemapper/)。重建你的图像。

说实话,我并不是100%确定这部分是否真的需要。

从aufs切换到devicemapper后,您可能会收到以下错误:

ERROR: Could not find container for entity id

解决方案是删除旧的AUFS数据库和任何现有容器:

sudo rm -rf /var/lib/docker/containers/*
sudo rm -rf /var/lib/docker/linkgraph.db

重新启动docker镜像/容器现在应该可以在devicemapper引擎上运行。

将apparmor置于docker的抱怨模式

/etc/apparmor.d/docker内注释(#)行deny @{PROC}/{*,**^[0-9*],sys/kernel/shm*} wkx,,它会以某种方式混淆apparmor utils。比跑

sudo aa-complain /etc/apparmor.d/docker

如果aa-complain throws命令未找到,请安装:

sudo apt-get install apparmor-utils

启动容器后,ambari-server开始为我工作。

我不知道docker如何依赖于apparmor,即上述操作带来的风险......

答案 1 :(得分:0)

将Ambari部署到docker容器似乎存在问题。我将其分解并将其安装到具有以下脚本的Vagrant 14.04 Ubuntu VM上:

<强> install_java.sh

#!/bin/bash

echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
  add-apt-repository -y ppa:webupd8team/java && \
  apt-get update && \
  apt-get install -y oracle-java8-installer && \
  rm -rf /var/lib/apt/lists/* && \
  rm -rf /var/cache/oracle-jdk8-installer

<强> install_ambari.sh

#!/bin/bash

export DEBIAN_FRONTEND=noninteractive \
    && wget -nv http://public-repo-1.hortonworks.com/ambari/ubuntu14/2.x/updates/2.2.0.0/ambari.list -O /etc/apt/sources.list.d/ambari.list \
    && apt-key adv --recv-keys --keyserver keyserver.ubuntu.com B9733A7A07513CAD \
    && apt-get update \
    && apt-get -y install ambari-server

其次是:

sudo ambari-server setup -s -v -j $JAVA_HOME

sudo ambari-server start -v

@thaJeztah - 我的Dockerfile设置需要修复什么?