当前位置:   article > 正文

基于ambari 2.6.2.0的docker镜像安装大数据服务组件_ambari agent 2.6.2.0

ambari agent 2.6.2.0

之前有使用docker搭建了一套Apache Hadoop版本的大数据平台,参考我的码云地址:https://gitee.com/elbertmalone/HadoopHACluster,整个编写脚本和搭建过程花了很多时间,且灵活性不好。Ambari在大数据集群部署方面有得天独厚的优势,但是集群操作系统安装准备工作以及基础包的安装还是需要花费很多的时间。为了节省大数据集群的部署时间接下来我们用Docker容器化的方案部署Ambari。

费话少说,放码出来。让我们开始吧!

Ambari的架构

从Ambari的架构主要有两个组件:Ambari Server和Ambari Agent。

Ambari架构图
Ambari架构图

编写CentOS7支持Systemd镜像Dockfile

  1. FROM centos:7
  2. MAINTAINER elbert.lau
  3. # 2, Setting up systemd
  4. ENV container docker
  5. RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \
  6. systemd-tmpfiles-setup.service ] || rm -f $i; done); \
  7. rm -f /lib/systemd/system/multi-user.target.wants/*;\
  8. rm -f /etc/systemd/system/*.wants/*;\
  9. rm -f /lib/systemd/system/local-fs.target.wants/*; \
  10. rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
  11. rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
  12. rm -f /lib/systemd/system/basic.target.wants/*;\
  13. rm -f /lib/systemd/system/anaconda.target.wants/*;
  14. VOLUME [ "/sys/fs/cgroup" ]
  15. ENTRYPOINT ["/usr/sbin/init"]
  16. RUN yum install -y systemd* && yum clean all

构建ambari-systemd镜像

  1. #!/bin/bash
  2. docker rmi local/ambari-systemd:2.6.2.0-155
  3. docker build --rm -t local/ambari-systemd:2.6.2.0-155 .

编写Ambari Repos镜像Dockerfile

  1. FROM local/ambari-systemd:2.6.2.0-155
  2. MAINTAINER elbert.lau
  3. RUN yum -y install httpd; yum clean all; systemctl enable httpd.service
  4. ADD http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.2.0/ambari-2.6.2.0-centos7.tar.gz /var/www/html
  5. ADD http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.5.0/HDP-2.6.5.0-centos7-rpm.tar.gz /var/www/html
  6. ADD http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.22/repos/centos7/HDP-UTILS-1.1.0.22-centos7.tar.gz /var/www/html/HDP-UTILS
  7. ADD http://public-repo-1.hortonworks.com/HDP-GPL/centos7/2.x/updates/2.6.5.0/HDP-GPL-2.6.5.0-centos7-gpl.tar.gz /var/www/html
  8. EXPOSE 80

构建ambari-repos镜像

  1. #!/bin/bash
  2. docker rmi local/ambari-repos:2.6.2.0-155
  3. docker build --rm -t local/ambari-repos:2.6.2.0-155 .

编写Ambari Base镜像Dockerfile

  1. FROM local/ambari-systemd:2.6.2.0-155
  2. MAINTAINER elbert.lau
  3. # 1, epel-release install
  4. RUN yum install epel-release -y && yum clean all
  5. RUN yum update -y && yum clean all
  6. RUN yum install -y yum-utils yum-plugin-ovl tar git curl bind-utils unzip wget && yum clean all
  7. # 2, Setup sshd
  8. RUN yum install -y openssh-server openssh-clients && yum clean all
  9. RUN systemctl enable sshd
  10. # 3, kerberos client
  11. RUN yum install -y krb5-workstation && yum clean all
  12. # 4, initscripts (service wrapper for servicectl) is need othewise the Ambari is unable to start postgresql
  13. RUN yum install -y initscripts && yum clean all
  14. RUN curl -o /usr/bin/jq http://stedolan.github.io/jq/download/linux64/jq && chmod +x /usr/bin/jq
  15. ENV JDK_ARTIFACT jdk-8u112-linux-x64.tar.gz
  16. ENV JDK_VERSION jdk1.8.0_112
  17. # 5, install Ambari specified 1.8 jdk
  18. RUN mkdir /usr/jdk64 && cd /usr/jdk64 && wget http://public-repo-1.hortonworks.com/ARTIFACTS/$JDK_ARTIFACT \
  19. && tar -xf $JDK_ARTIFACT && rm -f $JDK_ARTIFACT
  20. ENV JAVA_HOME /usr/jdk64/$JDK_VERSION
  21. ENV PATH $PATH:$JAVA_HOME/bin
  22. # 6, jce
  23. ADD http://public-repo-1.hortonworks.com/ARTIFACTS/jce_policy-8.zip $JAVA_HOME/jre/lib/security/
  24. RUN cd $JAVA_HOME/jre/lib/security && unzip jce_policy-8.zip \
  25. && rm -f jce_policy-8.zip && mv UnlimitedJCEPolicyJDK8/*jar . && rm -rf UnlimitedJCEPolicyJDK8
  26. ADD etc/yum.conf /etc/yum.conf
  27. # 7, for ERROR: SSLError: Failed to connect. Please check openssl library versions.
  28. RUN sed -i 's/verify=platform_default/verify=disable/' /etc/python/cert-verification.cfg

构建ambari-base镜像

  1. #!/bin/bash
  2. docker rmi local/ambari-base:2.6.2.0-155
  3. docker build --rm -t local/ambari-base:2.6.2.0-155 .

编写Ambari Server镜像Dockerfile

  1. FROM local/ambari-base:2.6.2.0-155
  2. MAINTAINER elbert.lau
  3. # 1, add ambari repo
  4. ADD http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.2.0/ambari.repo /etc/yum.repos.d/ambari.repo
  5. ADD http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.5.0/hdp.repo /etc/yum.repos.d/hdp.repo
  6. ADD http://public-repo-1.hortonworks.com/HDP-GPL/centos7/2.x/updates/2.6.5.0/hdp.gpl.repo /etc/yum.repos.d/hdp.gpl.repo
  7. # 2, initscripts (service wrapper for servicectl) is need othewise the Ambari is unable to start postgresql
  8. RUN yum -y install ambari-server; yum clean all
  9. # 3, add psql connectors to ambari-server so it can be downloaded by services (e.g.: Ranger)
  10. ADD https://jdbc.postgresql.org/download/postgresql-42.2.5.jar /var/lib/ambari-server/resources/postgres-jdbc-driver.jar
  11. RUN echo DefaultEnvironment=\"JAVA_HOME=$JAVA_HOME\" >> /etc/systemd/system.conf
  12. # 4, ambari server setup
  13. RUN ambari-server setup --silent --java-home $JAVA_HOME; systemctl enable ambari-server.service
  14. EXPOSE 8080

构建ambari-server镜像

  1. #!/bin/bash
  2. docker rmi local/ambari-server:2.6.2.0-155
  3. docker build --rm -t local/ambari-server:2.6.2.0-155 .

编写Ambari Agent镜像Dockerfile

  1. FROM local/ambari-base:2.6.2.0-155
  2. MAINTAINER elbert.lau
  3. # 1, add ambari repo
  4. ADD http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.2.0/ambari.repo /etc/yum.repos.d/ambari.repo
  5. ADD http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.5.0/hdp.repo /etc/yum.repos.d/hdp.repo
  6. ADD http://public-repo-1.hortonworks.com/HDP-GPL/centos7/2.x/updates/2.6.5.0/hdp.gpl.repo /etc/yum.repos.d/hdp.gpl.repo
  7. # 2, install ambari agent
  8. RUN yum -y install ambari-agent; yum clean all
  9. RUN echo DefaultEnvironment=\"JAVA_HOME=$JAVA_HOME\" >> /etc/systemd/system.conf

构建ambari-agent镜像

  1. #!/bin/bash
  2. docker rmi local/ambari-agent:2.6.2.0-155
  3. docker build --rm -t local/ambari-agent:2.6.2.0-155 .

参考资料

【1】https://github.com/sequenceiq/docker-ambari

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/寸_铁/article/detail/743265
推荐阅读
相关标签
  

闽ICP备14008679号