制作篇2 - 制作CDH master-server镜像包

news/2024/12/5 6:51:18/

前言        

        根据CDH安装流程,将分别安装cloudera-manager-server节点 和 cloudera-manager-agent节点,两者安装步骤和安装包不一样,也是考虑到后续方便扩展节点,所以单独将这两个节点安装到不同的容器内

        接下来先安装cloudera-manager-server节点的内容

1. 创建并运行基础容器

创建运行容器参数说明:

参数说明
-d后台运行容器
-name容器名
-hostname容器主机名
--privileged=true使容器具有root权限
server/bashimage

镜像库名:标签(也可直接填IMAGE ID),指定该容器使用的哪个镜像

启动基础容器,在此基础上安装master-server所需的软件

docker run -d \
--name server001 \
--hostname server001 \
--privileged=true \
server/bashimage \
/usr/sbin/init  \
&& docker ps结果:
8ac7901ae94ccc85cbf9768cec10adc4f9a4e2e9034cd9cf60d3ef2367fe1a11
CONTAINER ID   IMAGE              COMMAND            CREATED                  STATUS                  PORTS     NAMES
8ac7901ae94c   server/bashimage   "/usr/sbin/init"   Less than a second ago   Up Less than a second   22/tcp    server001

2. 初始化容器环境

把容器当作一台全新的物理机器,还是需要重新配置基本环境

# 进入容器
docker exec -it --privileged=true server001 /bin/bash # 初始化容器环境
ping www.baidu.com -c 3 \
&& yum update -y \
&& yum install -y kde-l10n-Chinese telnet reinstall glibc-common wget ntp net-tools firewalld unzip \
&& yum clean all 结果:
PING www.a.shifen.com (180.101.49.11) 56(84) bytes of data.
64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=1 ttl=127 time=54.7 ms
64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=2 ttl=127 time=65.2 ms
64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=3 ttl=127 time=87.8 ms...
Complete!
Loaded plugins: fastestmirror, ovl
Cleaning repos: base extras updates
Cleaning up list of fastest mirrors

3. 关闭防火墙

systemctl stop firewalld \
&& systemctl disable firewalld \
&& systemctl status firewalld结果:
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
● firewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)Active: inactive (dead)Docs: man:firewalld(1)

4. 配置中文环境

(cat <<EOF
export LC_ALL=zh_CN.utf8
export LANG=zh_CN.utf8
export LANGUAGE=zh_CN.utf8
EOF
) >> ~/.bashrc \
&& localedef -c -f UTF-8 -i zh_CN zh_CN.utf8 \
&& source ~/.bashrc \
&& echo $LANG结果:
zh_CN.utf8

5. 配置httpd ,新增yum源

        在上一篇博客中,已经在宿主机上搭建了yum本地软件库,master-server容器内需要安装httpd服务,并指定宿主机的yum源地址,就能够从宿主机上下载所需软件程序。

添加yum源参数说明:

nameyum仓库的名字
baseurl仓库路径用的httpd的本地文件库,宿主机IP:172.16.0.2
gpgcheck为0时不做gpg检查
enabled为1时开启此仓库
yum -y install httpd \
&& systemctl start httpd \
&&(
cat <<EOF
[cloudera-manager]
name=Cloudera Manager 6.3.1
baseurl=http://172.16.0.2/cloudera-repos/
gpgcheck=0
enabled=1
EOF
) >> /etc/yum.repos.d/cloudera-manager.repo \
&& curl http://172.16.0.2/cloudera-repos/ \
&& yum clean all结果:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html><head><title>Index of /cloudera-repos</title></head><body>
<h1>Index of /cloudera-repos</h1><table><tr><th valign="top"><img src="/icons/blank.gif" alt="[ICO]"></th><th><a href="?C=N;O=D">Name</a></th><th><a href="?C=M;O=A">Last modified</a></th><th><a href="?C=S;O=A">Size</a></th><th><a href="?C=D;O=A">Description</a></th></tr><tr><th colspan="5"><hr></th></tr>
<tr><td valign="top"><img src="/icons/back.gif" alt="[PARENTDIR]"></td><td><a href="/">Parent Directory</a>       </td><td>&nbsp;</td><td align="right">  - </td><td>&nbsp;</td></tr>
<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]"></td><td><a href="allkeys.asc">allkeys.asc</a>            </td><td align="right">2021-07-05 00:34  </td><td align="right"> 14K</td><td>&nbsp;</td></tr>
<tr><td valign="top"><img src="/icons/unknown.gif" alt="[   ]"></td><td><a href="cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm">cloudera-manager-age..&gt;</a></td><td align="right">2021-06-15 16:00  </td><td align="right"> 10M</td><td>&nbsp;</td></tr>
<tr><td valign="top"><img src="/icons/unknown.gif" alt="[   ]"></td><td><a href="cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm">cloudera-manager-dae..&gt;</a></td><td align="right">2021-06-15 16:10  </td><td align="right">1.1G</td><td>&nbsp;</td></tr>
<tr><td valign="top"><img src="/icons/unknown.gif" alt="[   ]"></td><td><a href="cloudera-manager-server-6.3.1-1466458.el7.x86_64.rpm">cloudera-manager-ser..&gt;</a></td><td align="right">2021-06-15 15:59  </td><td align="right"> 11K</td><td>&nbsp;</td></tr>
<tr><td valign="top"><img src="/icons/unknown.gif" alt="[   ]"></td><td><a href="cloudera-manager-server-db-2-6.3.1-1466458.el7.x86_64.rpm">cloudera-manager-ser..&gt;</a></td><td align="right">2021-06-15 15:59  </td><td align="right"> 11K</td><td>&nbsp;</td></tr>
<tr><td valign="top"><img src="/icons/unknown.gif" alt="[   ]"></td><td><a href="enterprise-debuginfo-6.3.1-1466458.el7.x86_64.rpm">enterprise-debuginfo..&gt;</a></td><td align="right">2021-06-15 16:00  </td><td align="right"> 14M</td><td>&nbsp;</td></tr>
<tr><td valign="top"><img src="/icons/unknown.gif" alt="[   ]"></td><td><a href="mysql-community-client-5.7.27-1.el7.x86_64.rpm">mysql-community-clie..&gt;</a></td><td align="right">2021-07-08 17:41  </td><td align="right"> 24M</td><td>&nbsp;</td></tr>
<tr><td valign="top"><img src="/icons/unknown.gif" alt="[   ]"></td><td><a href="mysql-community-common-5.7.27-1.el7.x86_64.rpm">mysql-community-comm..&gt;</a></td><td align="right">2021-07-08 17:42  </td><td align="right">275K</td><td>&nbsp;</td></tr>
<tr><td valign="top"><img src="/icons/unknown.gif" alt="[   ]"></td><td><a href="mysql-community-devel-5.7.27-1.el7.x86_64.rpm">mysql-community-deve..&gt;</a></td><td align="right">2021-07-08 17:42  </td><td align="right">3.7M</td><td>&nbsp;</td></tr>
<tr><td valign="top"><img src="/icons/unknown.gif" alt="[   ]"></td><td><a href="mysql-community-libs-5.7.27-1.el7.x86_64.rpm">mysql-community-libs..&gt;</a></td><td align="right">2021-07-08 17:42  </td><td align="right">2.2M</td><td>&nbsp;</td></tr>
<tr><td valign="top"><img src="/icons/unknown.gif" alt="[   ]"></td><td><a href="mysql-community-libs-compat-5.7.27-1.el7.x86_64.rpm">mysql-community-libs..&gt;</a></td><td align="right">2021-07-08 17:42  </td><td align="right">2.0M</td><td>&nbsp;</td></tr>
<tr><td valign="top"><img src="/icons/unknown.gif" alt="[   ]"></td><td><a href="mysql-community-server-5.7.27-1.el7.x86_64.rpm">mysql-community-serv..&gt;</a></td><td align="right">2021-07-08 17:43  </td><td align="right">165M</td><td>&nbsp;</td></tr>
<tr><td valign="top"><img src="/icons/unknown.gif" alt="[   ]"></td><td><a href="oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm">oracle-j2sdk1.8-1.8...&gt;</a></td><td align="right">2021-06-15 16:05  </td><td align="right">176M</td><td>&nbsp;</td></tr>
<tr><td valign="top"><img src="/icons/folder.gif" alt="[DIR]"></td><td><a href="repodata/">repodata/</a>              </td><td align="right">2021-07-11 17:42  </td><td align="right">  - </td><td>&nbsp;</td></tr><tr><th colspan="5"><hr></th></tr>
</table>
</body></html>

6. 安装JDK,daemons ,agent ,server 

        通过上述配置的yum源,安装JDK,CDH的daemons ,agent ,server服务。daemons包大小过大,第一次安装会失败,请在尝试一次

        安装完JDK,并配置环境变量

yum install -y oracle-j2sdk1.8 cloudera-manager-daemons cloudera-manager-agent cloudera-manager-server \
&& rpm -qa | grep cloudera-manager \
&& (cat <<\EOF
export JAVA_HOME=/usr/java/jdk1.8.0_181-cloudera
export PATH=$PATH:$JAVA_HOME/bin
EOF
) >> ~/.bashrc \
&& source ~/.bashrc \
&& java -version \
&& yum clean all结果:
Complete!
cloudera-manager-agent-6.3.1-1466458.el7.x86_64
cloudera-manager-server-6.3.1-1466458.el7.x86_64
cloudera-manager-daemons-6.3.1-1466458.el7.x86_64
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
第一次可能没有上面的结果,请再执行一次

7. 安装mysql

       CDH的正常运行需要安装MySQL, 该MySQL服务安装在server容器内,当然也可以将MySQL容器化单独部署,就是在初始化CDH时稍有变动。

yum install -y mysql-community-common mysql-community-libs mysql-community-devel mysql-community-libs-compat mysql-community-client mysql-community-server \
&& echo character-set-server=utf8 >> /etc/my.cnf \
&& rpm -qa | grep mysql \
&& yum clean all结果:
Installed:mysql-community-client.x86_64 0:5.7.27-1.el7 mysql-community-devel.x86_64 0:5.7.27-1.el7 mysql-community-server.x86_64 0:5.7.27-1.el7Dependency Installed:libaio.x86_64 0:0.3.109-13.el7                                   numactl-libs.x86_64 0:2.0.12-5.el7                                  
Complete!
mysql-community-common-5.7.27-1.el7.x86_64
mysql-community-libs-compat-5.7.27-1.el7.x86_64
mysql-community-client-5.7.27-1.el7.x86_64
mysql-community-devel-5.7.27-1.el7.x86_64
mysql-community-libs-5.7.27-1.el7.x86_64
mysql-community-server-5.7.27-1.el7.x86_64

        7.1 重置密码

                修改mysql登录密码,创建CDH需要的数据库,并授予相关权限

1. #启动比较久,可以另外开一个终端,去查看密码
systemctl start mysqld 2. 查看状态显示报错:这是正常现象
systemctl status mysqld
结果:
● mysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: activating (start) since 五 2021-07-09 08:55:25 CST; 28s agoDocs: man:mysqld(8)http://dev.mysql.com/doc/refman/en/using-systemd.htmlProcess: 1091 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)Process: 1020 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)CGroup: /docker/b4bb69b9c8884b3cc33da208eac1180c269f82cc006622df1b35b05d179cc1c0/docker/b4bb69b9c8884b3cc33da208eac1180c269f82cc006622df1b35b05d179cc1c0/system.slice/mysqld.service└─1093 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid7月 09 08:55:25 asrserver001 systemd[1]: Starting MySQL Server...
7月 09 08:55:30 asrserver001 systemd[1]: New main PID 1093 does not belong to service, and PID file is not owned by root. Refusing.
7月 09 08:55:30 asrserver001 systemd[1]: New main PID 1093 does not belong to service, and PID file is not owned by root. Refusing.3. 修改密码:
# mysqld下面添加skip-grant-tables 保存退出启动服务
vim /etc/my.cnf[mysqld]skip-grant-tables4. 免密重新登录,修改密码
systemctl restart mysqld 
mysql -u rootuse mysqlupdate user set authentication_string=password('123456') where user='root' and host='localhost';flush privileges;exit;
放开忽略密码配置,重启mysqld
systemctl restart mysqld.service5. 输入密码登录mysql
mysql -u root -p 输入自定义的密码
在执行下面的命令:
# 设置mysql密码策略,可以不设置,直接设置复杂度高的密码
set global validate_password_policy=LOW;
set global validate_password_length=6; 
set password for root@localhost = password('123456');
grant all privileges on *.* to 'root'@'%' identified by '123456';
flush privileges;# 创建CDH运行所需的数据库
CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE nav DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE navms DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON scm.* TO 'scm'@'%' IDENTIFIED BY '123456';
GRANT ALL ON amon.* TO 'amon'@'%' IDENTIFIED BY '123456';
GRANT ALL ON rman.* TO 'rman'@'%' IDENTIFIED BY '123456';
GRANT ALL ON hue.* TO 'hue'@'%' IDENTIFIED BY '123456';
GRANT ALL ON metastore.* TO 'hive'@'%' IDENTIFIED BY '123456';
GRANT ALL ON sentry.* TO 'sentry'@'%' IDENTIFIED BY '123456';
GRANT ALL ON nav.* TO 'nav'@'%' IDENTIFIED BY '123456';
GRANT ALL ON navms.* TO 'navms'@'%' IDENTIFIED BY '123456';
GRANT ALL ON oozie.* TO 'oozie'@'%' IDENTIFIED BY '123456';
flush privileges;
SHOW DATABASES;结果:
mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| amon               |
| hue                |
| metastore          |
| mysql              |
| nav                |
| navms              |
| oozie              |
| performance_schema |
| rman               |
| scm                |
| sentry             |
| sys                |
+--------------------+

        直到上述步骤,master-server容器已经安装了JDK,CDH的daemos,server,agent服务和MySQL服务,只是安装好,并没有启动也无需启动,CDH也没有初始化,到这步已经足够

systemctl status cloudera-scm-server && systemctl status cloudera-scm-agent结果:
● cloudera-scm-server.service - Cloudera CM Server ServiceLoaded: loaded (/usr/lib/systemd/system/cloudera-scm-server.service; enabled; vendor preset: disabled)Active: inactive (dead)
● cloudera-scm-agent.service - Cloudera Manager Agent ServiceLoaded: loaded (/usr/lib/systemd/system/cloudera-scm-agent.service; enabled; vendor preset: disabled)Active: inactive (dead)

8. 将容器提交成镜像

        接下来将master-server容器打包成镜像

1. 退出server001容器:
[root@server001 ~]# exit
exit2. 停止运行容器,将容器提交为master-server/cdh:6.3.2镜像,并打包镜像
docker stop server001 \&& docker commit server001  master-server/cdh:6.3.2 \&& docker images \&& docker save -o master-server.tar.gz master-server/cdh:6.3.2 \&& ls -l --block-size=M
结果:
server001
sha256:d4f3e4ee3f9eee71915402d8c9c5eb3bafc4f4e1eca82f11dcdb0cf3cd074493
REPOSITORY          TAG              IMAGE ID       CREATED          SIZE
master-server/cdh   6.3.2            d4f3e4ee3f9e   1 second ago     3.62GB
server/bashimage    latest           c8d140a652e0   15 minutes ago   404MB
centos              centos7.7.1908   08d05d1d5859   22 months ago    204MB
-rw------- 1 root root 3402M Sep 12 17:10 master-server.tar.gz

有问题欢迎在评论区留言,你的提问就是对我最大的支持


http://www.ppmy.cn/news/908608.html

相关文章

免费获得NOD32 半年、1年 激活码-14.08.12到期

地址&#xff1a; http://nod32.ruanmei.com/ 活动时间&#xff1a; 2014年8月6日 - 8月12日&#xff08;全部送完将提前终止&#xff09;。 活动规则&#xff1a; 1、每台电脑限领1枚NOD32激活码&#xff1b; 2、领到的NOD32激活码必须在24小时内激活&#xff0c;否则将在24小…

使用亚马逊云搭建服务器(详细教程,附图)

一、创建aws账户 aws官网&#xff1a;https://aws.amazon.com/cn/ 1、点击创建aws账户 2、输入邮箱和账户名称&#xff0c;点击验证电子邮件地址 3、打开自己的邮箱&#xff0c;查看aws验证码 4、回到申请页面&#xff0c;输入验证码&#xff0c;验证邮箱 5、创建密码&#x…

【VisionMaster】试用版安装说明

1. 安装包下载 进入海康机器人官方主页选择机器视觉 >> 视觉软件 >> 算法平台 点击 软件下载按钮&#xff0c;进入下载页面 下载 VisionMaster 基础安装包 V4.0.0与VisionMaster 软加密试用版 V4.0.0&#xff0c;安装包VisionMaster 示例程序 V4.0.0根据需要进行下…

PVE系列教程(五)、安装群晖DS3622+(DSM7.0.1系统)

为了更好的浏览体验,欢迎光顾勤奋的凯尔森同学个人博客 PVE系列教程(五)、安装群晖DS3622+(DSM7.0.1系统) 一、在PVE创建群晖虚拟机 点击创建按钮,虚拟机id自己设定一个,后面直通硬盘的时候要用到。名称随便写。 操作系统设置这里选择不适用任何介质。 系统这里选择默认。…

单机版本CDH6.3.2搭建教程

单机版本CDH6.3.2搭建教程 已正常安装centos7 虚拟机 安装包 链接&#xff1a;https://pan.baidu.com/s/1ZC7U1pu_5KApQn8JOz1aPQ 提取码&#xff1a;ksic 文档 链接&#xff1a;https://pan.baidu.com/s/1gS_4GLlKClA16ZuBDG1nbA 提取码&#xff1a;zb46 –来自百度网盘超级会…

TinyKv调用流程梳理二

addNode生成peer func (c *client) heartbeatStreamLoop() {defer c.wg.Done()for {select {case <-c.ctx.Done():returndefault:}ctx, cancel : context.WithCancel(c.ctx)c.connMu.RLock()stream, err : c.leaderClient().RegionHeartbeat(ctx)c.connMu.RUnlock()if err !…

4 海康视觉平台VisionMaster 上手系列:常用工具(一)

VisionMaster 常用的工具&#xff1a;&#xff08;以下用VM简称 VisionMaster&#xff09; 1&#xff0c;模板匹配工具&#xff0c;以及其扩展&#xff0c;位置修正工具。 2&#xff0c;测量矩形工具&#xff0c;以及其扩展应用&#xff1a;找边缘点&#xff0c;找直线&#…

自己搭建 KMS激活服务器

1、C盘建KMS文件夹&#xff0c;把vlmcsd-Windows-x64.exe复制到kms文件夹内 2、以管理员运行cmd,在cmd切换到C盘KMS文件下&#xff0c;先输入cd c:/ 回车&#xff0c;再输入cd kms&#xff0c;这两个命令的意思是进入到C盘的kms文件夹下&#xff0c; 3、输入 vlmcsd-Windows-x6…