赞
踩
1)镜像地址:http://mirrors.aliyun.com/centos/7/isos/x86_64/
下载文件:CentOS-7-x86_64-Everything-2009.iso
http://mirrors.aliyun.com/centos/7/isos/x86_64/CentOS-7-x86_64-Everything-2009.iso
2)镜像说明
打开centos官网,里面主要是以下几块内容
1.DVD ISO : 最新版本基本版下载,带有常用的软件,无需自己下载安装(通常情况下),一般安装的是这个版本
2.Everything ISO :最新版本完整版,带有大部分软件,无需自己下载安装(通常情况下),体积最大
3.Minimal ISO:精简版,带有必备软件,其他软件需要自己下载安装,但是体积最小
4.Older Versions:过往版本系统下载
5.Need the Source:源码下载
mkdir -p /mnt/centos7/
mount -o loop CentOS-7-x86_64-Everything-2009.iso /mnt/centos7/
docker pull tomcat:jdk8-adoptopenjdk-openj9
docker run --name centos7 -itd -p 18080:8080 tomcat:jdk8-adoptopenjdk-openj9
docker cp /mnt/centos7 centos7:/usr/local/tomcat/webapps
docker commit -m="centos yum repos" -a="pony" centos7 pony/centos7-yumrepos:v1
docker save -o centos7.tar pony/centos7-yumrepos:v1
参考:
离线ambari 和hdp yum 源下载
https://blog.csdn.net/ZYC88888/article/details/103009119
离线方式部署Ambari2.6.0.0
https://www.cnblogs.com/yinzhengjie/p/9631920.html
mysql-connector-java-5.1.49.jar
nginx.conf
# For more information on configuration, see: # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/ru/docs/ user nginx; worker_processes auto; error_log /data/nginx/error.log; pid /run/nginx.pid; # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. include /usr/share/nginx/modules/*.conf; events { worker_connections 1024; } http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /data/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; include /etc/nginx/conf.d/*.conf; client_max_body_size 2048m; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; #server { # listen 80 default_server; # listen [::]:80 default_server; # server_name _; # root /usr/share/nginx/html; # # # Load configuration files for the default server block. # include /etc/nginx/default.d/*.conf; # # location / { # } # # error_page 404 /404.html; # location = /404.html { # } # # error_page 500 502 503 504 /50x.html; # location = /50x.html { # } #} # Settings for a TLS enabled server. # # server { # listen 443 ssl http2 default_server; # listen [::]:443 ssl http2 default_server; # server_name _; # root /usr/share/nginx/html; # # ssl_certificate "/etc/pki/nginx/server.crt"; # ssl_certificate_key "/etc/pki/nginx/private/server.key"; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 10m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # # # Load configuration files for the default server block. # include /etc/nginx/default.d/*.conf; # # location / { # } # # error_page 404 /404.html; # location = /404.html { # } # # error_page 500 502 503 504 /50x.html; # location = /50x.html { # } # } }
init.repo
#VERSION_NUMBER=2.7.3.0-139 [ambari-2.7.3.0] name=ambari Version - ambari-2.7.3.0 baseurl=http://192.168.0.1:18080/ambari2.7.3/centos7/2.7.3.0-139/ gpgcheck=1 gpgkey=http://192.168.0.1:18080/ambari2.7.3/centos7/2.7.3.0-139/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins enabled=1 priority=1 #centos7 [CentOS-7-x86_64-Everything-2009] name=CentOS-7-x86_64-Everything-2009 baseurl=http://192.168.0.1:18080/centos7 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 enabled=1 priority=1
yum.conf
[main] cachedir=/var/cache/yum/$basearch/$releasever keepcache=0 debuglevel=2 logfile=/var/log/yum.log exactarch=1 obsoletes=1 gpgcheck=1 plugins=1 installonly_limit=5 bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum distroverpkg=centos-release override_install_langs=en_US.UTF-8 tsflags=nodocs exclude=systemd*
FROM centos:7 MAINTAINER pony # install nginx RUN yum install -y epel-release && yum -y install nginx && yum clean all ADD ../nginx.conf /etc/nginx/nginx.conf # yum repos config && install ambari-server & ambari-agent COPY ../mysql-connector-java-5.1.49.jar /opt/ COPY ../init.repo /etc/yum.repos.d/init.repo RUN yum -y install ambari-server; \ yum -y install ambari-agent; \ yum clean all; \ sed -i "s#ambari.root.dir=.*#ambari.root.dir=/data/ambari-server#g" /etc/ambari-server/conf/log4j.properties; \ sed -i "s#hostname=.*#hostname=hdp01#g" /etc/ambari-agent/conf/ambari-agent.ini; \ sed -i "s#logdir=.*#logdir=/data/ambari-agent/log#g" /etc/ambari-agent/conf/ambari-agent.ini # Configure the offline YUM source RUN mv /etc/yum.repos.d /etc/yum.repos.d.bak && mkdir /etc/yum.repos.d COPY ../yum.conf /etc/yum.conf COPY ../init.repo /etc/yum.repos.d/init.repo #Setting up systemd RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ rm -f /lib/systemd/system/multi-user.target.wants/*;\ rm -f /etc/systemd/system/*.wants/*;\ rm -f /lib/systemd/system/local-fs.target.wants/*; \ rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ rm -f /lib/systemd/system/basic.target.wants/*;\ rm -f /lib/systemd/system/anaconda.target.wants/*; VOLUME ["/sys/fs/cgroup"] ENTRYPOINT ["/usr/sbin/init"] RUN yum install -y systemd* && yum clean all #RUN yum install -y yum-utils yum-plugin-ovl tar git curl bind-utils unzip wget sudo net-tools && yum clean all RUN yum install -y curl unzip wget sudo net-tools nc && yum clean all # Setup sshd RUN yum install -y openssh-server openssh-clients && yum clean all RUN systemctl enable sshd # install mysql client RUN yum install -y mariadb.x86_64 mariadb-libs.x86_64 && yum clean all ENV JDK_ARTIFACT jdk-8u112-linux-x64.tar.gz ENV JDK_VERSION jdk1.8.0_112 # install Ambari specified 1.8 jdk RUN mkdir /usr/jdk64 && cd /usr/jdk64 && wget http://public-repo-1.hortonworks.com/ARTIFACTS/$JDK_ARTIFACT && \ tar -xf $JDK_ARTIFACT && rm -f $JDK_ARTIFACT ENV JAVA_HOME /usr/jdk64/$JDK_VERSION ENV PATH $PATH:$JAVA_HOME/bin # jce ADD http://public-repo-1.hortonworks.com/ARTIFACTS/jce_policy-8.zip $JAVA_HOME/jre/lib/security/ RUN cd $JAVA_HOME/jre/lib/security && unzip jce_policy-8.zip && rm -f jce_policy-8.zip && mv UnlimitedJCEPolicyJDK8/*jar . && rm -rf UnlimitedJCEPolicyJDK8 # limits config RUN echo "* soft memlock unlimited" >> /etc/security/limits.conf; \ echo "* hard memlock unlimited" >> /etc/security/limits.conf; \ echo "* soft nofile 65535" >> /etc/security/limits.conf; \ echo "* hard nofile 65535" >> /etc/security/limits.conf; \ echo "* soft nproc unlimited" >> /etc/security/limits.conf; \ echo "* hard nproc unlimited" >> /etc/security/limits.conf # set the time zone RUN rm -f /etc/localtime; ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime VOLUME [ "/data","/data/nginx" ] EXPOSE 8080 8088 50070 19888 18081 #RUN rm -f /etc/yum.repos.d/*
docker build -t ambri:1.0 ./
ambari.repo
#VERSION_NUMBER=2.7.3.0-139
[ambari-2.7.3.0]
name=ambari Version - ambari-2.7.3.0
baseurl=http://yumrepos:8080/ambari2.7.3/centos7/2.7.3.0-139/
gpgcheck=1
gpgkey=http://yumrepos:8080/ambari2.7.3/centos7/2.7.3.0-139/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
centos7.repo
#VERSION_NUMBER=2.7.3.0-139
[ambari-2.7.3.0]
name=ambari Version - ambari-2.7.3.0
baseurl=http://yumrepos:8080/ambari2.7.3/centos7/2.7.3.0-139/
gpgcheck=1
gpgkey=http://yumrepos:8080/ambari2.7.3/centos7/2.7.3.0-139/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
proxy.conf
# For more information on configuration, see: # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/ru/docs/ user nginx; worker_processes auto; error_log /data/nginx/error.log; pid /run/nginx.pid; # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. include /usr/share/nginx/modules/*.conf; events { worker_connections 1024; } http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /data/nginx/access.log main; include /etc/nginx/mime.types; default_type application/octet-stream; include /etc/nginx/conf.d/*.conf; #正向代理配置 server{ listen 80; #监听端口 resolver 8.8.8.8; #DNS resolver_timeout 10s; # DNS解析超时时间 location / { proxy_pass http://$http_host$request_uri; proxy_set_header Host $http_host; proxy_buffers 256 4k; proxy_max_temp_file_size 0; proxy_connect_timeout 30; proxy_cache_valid 200 302 10m; proxy_cache_valid 301 1h; proxy_cache_valid any 1m; } } #==========反向代理配置==================== # ambari-server UI server { listen 8080;# 访问端口(自行修改) server_name localhost; charset utf-8; #access_log /var/log/nginx/yarn-access.log main; #error_log /var/log/nginx/yarn-error.log; location / { proxy_pass http://hdp01:8080; } error_page 404 /404.html; location = /404.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } # yarn ResourceManager UI server { listen 8088;# 访问端口(自行修改) server_name localhost; charset utf-8; #access_log /var/log/nginx/yarn-access.log main; #error_log /var/log/nginx/yarn-error.log; location / { proxy_pass http://hdp02:8088; } error_page 404 /404.html; location = /404.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } #NameNode UI upstream namenodeui { ip_hash; server hdp02:50070; server hdp03:50070; } server { listen 50070;# 访问端口(自行修改) server_name localhost; charset utf-8; location / { proxy_pass http://namenodeui; } error_page 404 /404.html; location = /404.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } #JobHistory UI server { listen 19888;# 访问端口(自行修改) server_name localhost; charset utf-8; location / { proxy_pass http://hdp03:19888; } error_page 404 /404.html; location = /404.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } #Spark2 History Server UI server { listen 18081;# 访问端口(自行修改) server_name localhost; charset utf-8; location / { proxy_pass http://hdp02:18081; } error_page 404 /404.html; location = /404.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } }
docker-compose.yml
version: '3' services: yumrepos: image: pony/all-yumrepos:v1 container_name: yumrepos hostname: yumrepos restart: always deploy: resources: limits: cpus: '1.00' memory: 1G reservations: cpus: '0.25' memory: 100M ports: - "18080:8080" networks: bdpnet: ipv4_address: 192.168.1.101 mysql: image: mysql:5.7 container_name: mysql hostname: mysql restart: always deploy: resources: limits: cpus: '1.00' memory: 2G reservations: cpus: '0.25' memory: 100M volumes: #此处为映射,无空格 - /data/bdp/mysql:/var/lib/mysql:rw environment: MYSQL_ROOT_PASSWORD: xxx ports: - "3306:3306" networks: bdpnet: ipv4_address: 192.168.1.102 proxy: image: pony/bdp:v1 container_name: proxy hostname: proxy privileged: false entrypoint: nginx command: - -g - 'daemon off;' ports: - 8080:8080 - 8088:8088 - 50070:50070 - 19888:19888 - 18081:18081 volumes: - /data/bdp/proxy:/data/nginx - /data/bdp/proxy.conf:/etc/nginx/nginx.conf deploy: resources: limits: cpus: '1.00' memory: 1G reservations: cpus: '0.25' memory: 100M networks: bdpnet: ipv4_address: 192.168.1.103 hdp01: image: pony/bdp:v1 container_name: hdp01 hostname: hdp01 privileged: true entrypoint: /usr/sbin/init #ports: # - 8081:8080 volumes: - /data/bdp/hdp01:/data - /data/bdp/ambari.repo:/etc/yum.repos.d/ambari.repo - /data/bdp/centos7.repo:/etc/yum.repos.d/centos7.repo deploy: #mode: replicated #replicas: 1 #restart_policy: # condition: any # max_attempts: 5 resources: limits: cpus: '2.00' memory: 5G reservations: cpus: '0.25' memory: 100M depends_on: - mysql - yumrepos networks: bdpnet: ipv4_address: 192.168.1.11 hdp02: image: pony/bdp:v1 container_name: hdp02 hostname: hdp02 privileged: true entrypoint: /usr/sbin/init volumes: - /data/bdp/hdp02:/data - /data/bdp/ambari.repo:/etc/yum.repos.d/ambari.repo - /data/bdp/centos7.repo:/etc/yum.repos.d/centos7.repo deploy: resources: limits: cpus: '2.00' memory: 20G reservations: cpus: '0.25' memory: 200M depends_on: - mysql - yumrepos networks: bdpnet: ipv4_address: 192.168.1.12 hdp03: image: pony/bdp:v1 container_name: hdp03 hostname: hdp03 privileged: true entrypoint: /usr/sbin/init volumes: - /data/bdp/hdp03:/data - /data/bdp/ambari.repo:/etc/yum.repos.d/ambari.repo - /data/bdp/centos7.repo:/etc/yum.repos.d/centos7.repo deploy: resources: limits: cpus: '2.00' memory: 20G reservations: cpus: '0.25' memory: 200M depends_on: - mysql - yumrepos networks: bdpnet: ipv4_address: 192.168.1.13 hdp04: image: pony/bdp:v1 container_name: hdp04 hostname: hdp04 privileged: true entrypoint: /usr/sbin/init volumes: - /data/bdp/hdp04:/data - /data/bdp/ambari.repo:/etc/yum.repos.d/ambari.repo - /data/bdp/centos7.repo:/etc/yum.repos.d/centos7.repo deploy: resources: limits: cpus: '5.00' memory: 20G reservations: cpus: '0.25' memory: 200M depends_on: - mysql - yumrepos networks: bdpnet: ipv4_address: 192.168.1.14 hdp05: image: pony/bdp:v1 container_name: hdp05 hostname: hdp05 privileged: true entrypoint: /usr/sbin/init volumes: - /data/bdp/hdp05:/data - /data/bdp/ambari.repo:/etc/yum.repos.d/ambari.repo - /data/bdp/centos7.repo:/etc/yum.repos.d/centos7.repo deploy: resources: limits: cpus: '5.00' memory: 20G reservations: cpus: '0.25' memory: 200M depends_on: - mysql - yumrepos networks: bdpnet: ipv4_address: 192.168.1.15 #networks: # default: # external: # name: ambari networks: bdpnet: external: true
docker network create -d bridge --subnet 192.168.1.0/24 --gateway 192.168.1.1 bdpnet
root密码为构建容器时传入的密码 mysql -hmysql -uroot -P3306 -pxxx ambari元数据 DROP DATABASE ambari; CREATE DATABASE ambari DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'%' IDENTIFIED BY 'xxx' WITH GRANT OPTION; flush privileges; hive元数据 DROP DATABASE hive; CREATE DATABASE hive DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; GRANT ALL PRIVILEGES ON hive.* TO 'hive'@'%' IDENTIFIED BY 'xxx' WITH GRANT OPTION; flush privileges; 初始化ambari数据库: use ambari; set names utf8; source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql;
ambari-server setup
JAVA_HOME: /usr/jdk64/jdk1.8.0_112/
jdbc driver path: /opt/mysql-connector-java-5.1.49.jar
mv /usr/share/java /usr/share/java.bak;mkdir /usr/share/java
cp /opt/mysql-connector-java-5.1.49.jar /usr/share/java
ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java-5.1.49.jar
ambari-server start
如果ambari-server 主机名有变化,这个需要配置
ambari-agent start
选择3.0版本
# ambari-hdp-1.repo [HDP-3.0-repo-1] name=HDP-3.0-repo-1 baseurl=http://yumrepos:8080/HDP-3.0.1.0/centos7/3.0.1.0-187 path=/ enabled=1 gpgcheck=0 [HDP-3.0-GPL-repo-1] name=HDP-3.0-GPL-repo-1 baseurl=http://yumrepos:8080/HDP-3.0.1.0/centos7/3.0.1.0-187 path=/ enabled=1 gpgcheck=0 [HDP-UTILS-1.1.0.22-repo-1] name=HDP-UTILS-1.1.0.22-repo-1 baseurl=http://yumrepos:8080/HDP-UTILS-1.1.0.22/centos7/1.1.0.22 path=/ enabled=1 gpgcheck=0 注意: yum源生成失败,需要在所有的ambari-agent节点删除产生的yum源文件,然后返回yum源配置页面重新配置 rm -f /etc/yum.repos.d/ambari-hdp-1.repo
配置安装ambari-agent的所有节点
选择所需要安装的服务
合理的分配不同角色在合适的节点上
为granfana hive等服务设置密码
配置hive元数据库的连接信息,在这里选择:Existing MySQL / MariaDB
配置元数据、日志数据及业务数据目录等,这里需要注意数据目录需要配置到挂载卷上。
SPARK2 THRIFT SERVERS 需要修改如下配置,否则读取不到hive的元数据
metastore.catalog.default=spark 改为 metastore.catalog.default=hive
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。