docker 离线安装 cdh 6.2

1. docker 拉取centos7 镜像

docker pull centos:7.7.1908

2. 启动dockerContainer

  • 设置网桥
docker network create --subnet=172.18.0.0/24 cdh-network
  • 运行centos 容器
docker run -d --privileged=true -ti -v /etc/localtime:/etc/localtime:ro -v /root/package:/docker/cdh-package -v /sys/fs/cgroup:/sys/fs/cgroup --name cdh-master -h cdh-master -p 3309:3306 -p 7180:7180 -p 7187:7187 -p 1080:1080 -p 4200:4200 -p 7777:7777 -p 7788:7788 -p 8000:8000 -p 8080:8080 -p 8744:8744 -p 8886:8886 -p 9088:9088 -p 9089:9089 -p 61080:61080 -p 61888:61888 -p 4040:4040 -p 6080:6080 -p 8042:8042 -p 8088:8088 -p 8188:8188 -p 8888:8888 -p 9995:9995 -p 11000:11000 -p 15000:15000 -p 16010:16010 -p 18081:18081 -p 19888:19888 -p 21000:21000 -p 21050:21050 -p 50010:50010 -p 50020:50020 -p 50070:50070 -p 50075:50075 -p 50111:50111 -p 8081:8081 -p 2182:2182 -p 2202:2202 -p 4557:4557 -p 6627:6627 -p 6667:6667 -p 9090:9090 -p 9091:9091 -p 15500:15500 -p 1100:1100 -p 1111:1111 -p 1988:1988 -p 2100:2100 -p 2181:2181 -p 2201:2201 -p 2222:2222 -p 3000:3000 -p 4242:4242 -p 5007:5007 -p 5011:5011 -p 6001:6001 -p 6003:6003 -p 6008:6008 -p 6188:6188 -p 8005:8005 -p 8020:8020 -p 8032:8032 -p 8040:8040 -p 8082:8082 -p 8086:8086 -p 8090:8090 -p 8091:8091 -p 8443:8443 -p 8765:8765 -p 8889:8889 -p 8983:8983 -p 8993:8993 -p 9000:9000 -p 9996:9996 -p 10000:10000 -p 10001:10001 -p 10015:10015 -p 10016:10016 -p 10500:10500 -p 10502:10502 -p 12049:12049 -p 12200:12200 -p 15002:15002 -p 16000:16000 -p 16020:16020 -p 16030:16030 -p 18080:18080 -p 33553:33553 -p 39419:39419 -p 42111:42111 -p 50079:50079 -p 50095:50095 -p 60000:60000 -p 60080:60080 --net cdh-network --ip 172.18.0.2 centos:7.7.1908 /usr/sbin/init
docker run -d --privileged=true  -ti -v /etc/localtime:/etc/localtime:ro -v /root/package:/docker/cdh-package -v /sys/fs/cgroup:/sys/fs/cgroup --name cdh-slave1 -h cdh-slave1 --net cdh-network --ip 172.18.0.3 centos:7.7.1908 /usr/sbin/init
docker run -d --privileged=true  -ti -v /etc/localtime:/etc/localtime:ro -v /root/package:/docker/cdh-package -v /sys/fs/cgroup:/sys/fs/cgroup --name cdh-slave2 -h cdh-slave2 --net cdh-network --ip 172.18.0.4 centos:7.7.1908 /usr/sbin/init 
docker run -d --privileged=true  -ti -v /etc/localtime:/etc/localtime:ro -v /root/package:/docker/cdh-package -v /sys/fs/cgroup:/sys/fs/cgroup --name cdh-slave3 -h cdh-slave3 --net cdh-network --ip 172.18.0.5 centos:7.7.1908 /usr/sbin/init

window 可以使用vscode docker插件进行attach

Linux :docker exec -it 容器ID /bin/bash (docker ps查看容器id)

由于dockerhub centos 为精简版,需要安装一些插件

yum install -y net-tools

yum install passwd

yum install firewalld
  • change root user default password
passwd root
  • 修改容器hosts(docker 固定网段)
172.18.0.2      cdh-master
172.18.0.3      cdh-slave1
172.18.0.4      cdh-slave2
172.18.0.5      cdh-slave3
  • 配置免密(所有容器都执行)
yum -y install openssh openssh-server openssh-clients
systemctl start sshd
ssh-keygen -t rsa #三次回车
ssh-copy-id  -f -i ~/.ssh/id_rsa.pub cdh-master
ssh-copy-id  -f -i ~/.ssh/id_rsa.pub cdh-slave1
ssh-copy-id  -f -i ~/.ssh/id_rsa.pub cdh-slave2
ssh-copy-id  -f -i ~/.ssh/id_rsa.pub cdh-slave3
  • ntp 时间同步(centos7 使用ntp ,centos 8 需要使用chronyd进行时间同步)
yum install  -y ntp
vi /etc/ntp.conf 添加
server 0.cn.pool.ntp.org
server 1.cn.pool.ntp.org
server 2.cn.pool.ntp.org
server 3.cn.pool.ntp.org
systemctl enable ntpd  #开机自启
systemctl start ntpd
  • 宿主机关闭防火墙
systemctl disable firewalld
systemctl stop firewalld

(此处使用OpenJDK8U-jdk_x64_linux_hotspot_8u302b08.tar)

mkdir /usr/java
tar -zxf /docker/cdh-package/OpenJDK8U-jdk_x64_linux_hotspot_8u302b08.tar.gz -C /usr/java
export JAVA_HOME=/usr/java/jdk8u302-b08
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
source ~/.bashrc
  • 安装Mysql
    • 复制mysql-connect-java.jar 到所有容器
mkdir -p /usr/share/java/
cp /docker/cdh-package/mysql-connector-java-5.1.46-bin.jar /usr/share/java/mysql-connector-java.jar 

mysql安装

yum install -y wget
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server
systemctl start mysqld.service    
systemctl status mysqld.service  #查看是否启动成功

##### 获取默认密码
grep "password" /var/log/mysqld.log

##### 登录
mysql -uroot -p   
##### 更改密码策略(取消密码复杂度的校验)
set global validate_password_policy=0;
set global validate_password_length=1;

##### 修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';

##### 设置可视化客户端连接
grant all on *.* to root@'%' identified by '123456';

#创建数据库(远端连接都是 u:root p:123456)
create database hive DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create database amon DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create database hue DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create database monitor DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create database oozie DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create database report DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
flush privileges;

安装Cloudera提供jdk

rpm -ivh oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm

vi /etc/profile
JAVA_HOME=/usr/java/jdk1.8.0_181-cloudera
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
source ~/.bashrc

source /etc/profile

安装cloudera manager

所有容器执行

mkdir /mnt/data1/cloudera-manager
tar -zxf /docker/cdh-package/cm6.1.0-redhat7.tar.gz -C /opt/cloudera-manager/

新建SCM用户

useradd --system --no-create-home --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm

主节点执行

# 创建cloudera-manager-server的本地元数据保存目录

mkdir /var/cloudera-scm-server

chown cloudera-scm:cloudera-scm /var/cloudera-scm-server

#该rpm只需要主节点执行安装
rpm -ivh cloudera-manager-server-6.2.0-968826.el7.x86_64.rpm(从节点不需要执行)

所有节点执行

#rpm 安装Cloudera Manager 6.2相关软件
yum install -y perl

rpm -ivh cloudera-manager-daemons-6.2.0-968826.el7.x86_64.rpm

yum install bind-utils psmisc cyrus-sasl-plain cyrus-sasl-gssapi fuse portmap fuse-libs /lib/lsb/init-functions httpd mod_ssl openssl-devel python-psycopg2 MySQL-python libxslt iproute initscripts  -y

rpm -ivh cloudera-manager-agent-6.2.0-968826.el7.x86_64.rpm

#安装完毕后需要进行指向server 节点hostname
vi /etc/cloudera-scm-agent/config.ini

server_host=cdh-master

创建本地parcel仓库用于离线安装

# 主节点中创建parcel-repo仓库目录
mkdir -p /opt/cloudera/parcel-repo
cp CDH-6.2.0-1.cdh6.2.0.p0.967373-el7.parcel /opt/cloudera/parcel-repo/
cp CDH-6.2.0-1.cdh6.2.0.p0.967373-el7.parcel.sha256 /opt/cloudera/parcel-repo/CDH-6.2.0-1.cdh6.2.0.p0.967373-el7.parcel.sha
cp manifest.json /opt/cloudera/parcel-repo/ 
chown cloudera-scm:cloudera-scm /opt/cloudera/parcel-repo

# 如遇到安装parcel无法识别库 ,则重新生成sha文件即可
sha1sum CDH-6.2.0-1.cdh6.2.0.p0.967373-el7.parcel| cut -d ' ' -f 1 > CDH-6.2.0-1.cdh6.2.0.p0.967373-el7.parcel.sha

创建parcels分发目录(所有容器)

mkdir -p /opt/cloudera/parcels
chown cloudera-scm:cloudera-scm /opt/cloudera/parcels

初始化生成CDH中scm元数据信息

# cdh 初始化mysql 信息 (后三项分别为 库名、库所有用户、库所有密码)
/opt/cloudera/cm/schema/scm_prepare_database.sh mysql -hlocalhost -uroot -p123456 --scm-host localhost scmdbn scmdbu scmdbp

cdh相关命令

# 主节点执行
systemctl start cloudera-scm-server
systemctl stop cloudera-scm-server
# 所有节点执行
systemctl start cloudera-scm-agent
systemctl stop cloudera-scm-agent
# 状态查看
systemctl status cloudera-scm-server
systemctl status cloudera-scm-agent
  • 更改cdh ip以及主机信息 附:https://blog.csdn.net/qq_39680564/article/details/103240483
# scm用户登录mysql
mysql -uscmdbu -pscmdbp
  • mysql 中主机信息修改
# 查看所有主机信息
select * from HOSTS;

# 根据主机ID 更新主机名以及IP
UPDATE HOSTS SET IP_ADDRESS = "xxx.xxx.xxx.xxx" ,NAME = "hostName" WHERE HOST_ID= 1;

CentOS release 7.6 (Final)

ntp 同步问题

1.需要禁掉chronyd.service:

systemctl disable chronyd.service 

2.手动启动ntpd:

systemctl start ntpd

3.再次设置开机自启动:

systemctl enable ntpd

4.重启服务器测试ntpd即可正常自启动了

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇