共计 21014 个字符,预计需要花费 53 分钟才能阅读完成。
公司的 CDH 早就装好了,一直想自己装一个玩玩,最近组了台电脑,笔记本就淘汰下来了,加上之前的,一共 3 台,就在 X 宝上买了 CPU 和内存升级了下笔记本,就自己组了个集群。
话说,好想去捡垃圾,捡台 8 核 16 线程 64G 内存的回来,手动滑稽。
3 台笔记本的配置和角色分配:
宿主 CPU 宿主内存 虚拟机 虚拟机 CPU/ 台 角色及内存
双核双线程 4G 1 台 双核双线程 nexus、yum、ntp
双核四线程 8G 2 台 双核四线程 master(4G)、node01(2G)
双核四线程 8G 2 台 双核四线程 node02、node03、node04(各 2G)
双核四线程 8G 1 台 双核四线程 master(6G)
双核四线程 8G 2 台 双核四线程 node01、node02(各 3G)
虚拟机的网卡都使用桥接模式,保证在同一网段下。
双核双线程那台本想也虚拟出 2 台来,但实在太老了,就给集群当个通用服务器吧。
试安装的时候,原本想整个 7 个节点,每个给 2G,但 master 给 2G,根本不够用,卡得要死,空余内存就 20 多 M,所以建议 master 给 4G 以上,我也就只能整 5 台了。
master 给 4G,选择安装所有服务也是不够的,最后的时候一共 10 步骤,执行到第八步会报错,网上老司机对这个错误解释是内存不足,所以只给 4G 的话就少装点服务吧,给了 6G 可以装所有服务。
另据 hyj 所述,master 上要装 mysql,小于 4G 可能会出现未知错误。
感觉 CDH 比 Apache 原生的 Hadoop 多吃好多内存,毕竟要起服务管理和监控。
我安装过程中参考了很多教程,主要参考了 http://www.linuxidc.com/Linux/2016-07/133356.htm 和其它小伙伴的教程。
因为我装的是 5.9 版,与 上面链接 装的 5.0 稍有出入,本篇算是对上面链接教程的补充和更新,并加入了个人的心得总结(采坑填坑)。
PS: 善用虚拟机的快照功能。
本文命令一律使用 root 用户,非 root 用户,请设置 sudo。
〇、安装文件准备
Cloudera Manager 5.9:http://archive-primary.cloudera.com/cm5/cm/5/cloudera-manager-el6-cm5.9.0_x86_64.tar.gz
CDH5.9 主文件:http://archive-primary.cloudera.com/cdh5/parcels/5.9.0.23/CDH-5.9.0-1.cdh5.9.0.p0.23-el6.parcel
CDH5.9 sha 文件:http://archive-primary.cloudera.com/cdh5/parcels/5.9.0.23/CDH-5.9.0-1.cdh5.9.0.p0.23-el6.parcel.sha1
manifest 文件:http://archive-primary.cloudera.com/cdh5/parcels/5.9.0.23/manifest.json
一、虚拟机准备
系统用的是 CentOS6.8,常规的设置或最小安装不带的软件,诸如:设置 ip 地址,hosts,ssh 免密登录,scp,sudo,关闭防火墙,yum,ntp 时间同步,我这不再叙述(可参考 hyj 的文章),这些是安装 CDH 的基础,请务必设置好。
虚拟机我用的完整克隆,这样网络会不可用,解决方案如下:
1、修改 hostname
vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=node02
2、修改 ip
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.2.102
PREFIX=24
GATEWAY=192.168.2.99
3、删除旧网卡
vi /etc/udev/rules.d/70-persistent-net.rules
可以看到会有 2 张 PCI device 网卡,删除 eth0 那行,再把 eth1 的那行里的 ”eh1″ 改成 ”eth0″。
4、重启
reboot
二、实用 shell 脚本
本文五特别说明,都是在 master 机上操作
0、节点 List 文件(文件名 nodes,不将 master 列在其中,不然下面的 scp 脚本会出问题的,详见二 -2)
vi nodes
node01
node02
node03
node04
1、ssh 免密登录批处理(需要同级目录下的 nodes 文件)
#!/bin/bash
PASSWORD=hadoop
auto_ssh_copy_id() {expect -c "set timeout -1;
spawn ssh-copy-id $1;
expect {*(yes/no)* {send -- yes\r;exp_continue;}
*assword:* {send -- $2\r;exp_continue;}
eof {exit 0;}
}";
}
cat nodes | while read host
do
{auto_ssh_copy_id $host $PASSWORD}&wait
done
2、scp 批处理(需要同级目录下的 nodes 文件)
nodes 文件中不能包含 master,不然就是 master scp 到 master,scp 目录的时候会反复在目录下创建目录再拷贝,直至路径太长而创建失败,然后才 scp 到 node01 等
#!/bin/bash
cat nodes | while read host
do
{scp -r $1 $host:$2
}&wait
done
3、ssh 批处理
#!/bin/bash
cat nodes | while read host
do
{ssh $host $1
}&wait
done
三、Cloudera 推荐设置
在试安装的过程,发现 Cloudera 给出了一些警告,如下图:
身为一个有洁癖的码农,自然是连黄色的感叹号都要消灭的。因此在安装 CM/CDH 之前就先全部设置好。
1、设置 swap 空间
vi /etc/sysctl.conf
末尾加上
vm.swappiness=10
使用 scp 批处理拷贝 /etc/sysctl.conf 到各节点
./scp.sh /etc/sysctl.conf /etc/
使用 ssh 批处理生效
./ssh.sh "sysctl -p"
2、关闭大页面压缩
试过只设置 defrag,但貌似个别节点还是会有警告,干脆全部设置
vi /etc/rc.local
末尾加上(永久生效)
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
批处理拷贝
./scp.sh /etc/rc.local /etc/
生效
reboot
或
./ssh.sh "echo never > /sys/kernel/mm/transparent_hugepage/enabled"
./ssh.sh "echo never > /sys/kernel/mm/transparent_hugepage/defrag"
3、关闭 SELinux
Cloudera 企业版本支持在 SELinux 平台上部署,咱们不花钱的还是关掉吧。
文档地址:http://www.cloudera.com/documentation/enterprise/release-notes/topics/rn_consolidated_pcm.html#xd_583c10bfdbd326ba–5a52cca-1476e7473cd–7f8d
说明原文:Cloudera Enterprise is supported on platforms with Security-Enhanced Linux (SELinux) enabled. However, Cloudera does not support use of SELinux with Cloudera Navigator. Cloudera is not responsible for policy support nor policy enforcement. If you experience issues with SELinux, contact your OS provider.
vi /etc/selinux/config
批处理拷贝
./scp.sh /etc/selinux/config /etc/selinux/
重启
reboot
四、Java 安装(安装按照个人习惯)
1、解压并创建软连接
tar -zxvf jdk-8u112-linux-x64.tar.gz -C /opt/program/
ln -s /opt/program/jdk1.8.0_112/ /opt/java
2、设置环境变量
vi /etc/profile
末尾添加
export JAVA_HOME=/opt/java
export PATH=$JAVA_HOME/bin:$PATH
3、批处理拷贝
./scp.sh /opt/program/jdk1.8.0_112/ /opt/program/jdk1.8.0_112/
./scp.sh /etc/profile /etc/
4、生效
./ssh.sh "ln -s /opt/program/jdk1.8.0_112/ /opt/java"
./ssh.sh "source /etc/profile"(此条无效,请在各节点手动执行)
5、设置全局变量(重要,我试安装的时候没加导致 CM 找不到 JAVA_HOME 而安装失败)
echo "JAVA_HOME=/opt/java" >> /etc/environment
五、安装 Mysql(供 CM 使用)
1、yum 安装 Mysql
yum install -y mysql mysql-server mysql-devel
2、设置随系统启动
chkconfig mysqld on
3、启动 mysql
service mysqld start
4、设置 root 用户密码
mysql
USE mysql;
UPDATE user SET Password=PASSWORD('你的密码') WHERE user='root';
FLUSH PRIVILEGES;
exit;
5、设置允许远程登录
mysql -u root -p
你的密码
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你的密码' WITH GRANT OPTION;
6、创建 CM 用的数据库
安装集群时按需创建,详见第七章第 13 步
--hive 数据库
create database hive DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
--oozie 数据库
create database oozie DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
--hue 数据库
create database hue DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
六、安装 CM
1、解压到 /opt 目录下,不能解压到其他地方,因为 cdh5 的源会默认在 /opt/cloudera/parcel-repo 寻找,而 CM 可以按照个人喜好安装
tar -zxvf cloudera-manager-el6-cm5.9.0_x86_64.tar.gz -C /opt/
mv /opt/cm-5.9.0/ /opt/program/
ln -s /opt/program/cm-5.9.0/ /opt/cm
2、将 CDH-5.9.0-1.cdh5.9.0.p0.23-el6.parcel 和 CDH-5.9.0-1.cdh5.9.0.p0.23-el6.parcel.sha1 移动到 /opt/cloudera/parcel-repo
这样安装时 CM 就能直接找到了。
mv CDH-5.9.0-1.cdh5.9.0.p0.23-el6.parcel CDH-5.9.0-1.cdh5.9.0.p0.23-el6.parcel.sha1 /opt/cloudera/parcel-repo/
3、将 CDH-5.9.0-1.cdh5.9.0.p0.23-el6.parcel.sha1 重命名为 CDH-5.9.0-1.cdh5.9.0.p0.23-el6.parcel.sha(去掉结尾的 1)
非常重要。我试安装时,这点遗漏了,导致安装 CDH 的时候一直刷不出 5.9 版本。
旧版本好像还需要 manifest.json,用 manifest.json 里的信息来生成 *.sha,新版本直接可以下载,也就不用 manifest.json 了,严谨一点的话可以比对一下。
通过日志发现,没有 manifest.json 就会去下载,不能访问外网就报错了,但不影响安装 CDH,还是 mv 一下吧
mv manifest.json /opt/cloudera/parcel-repo/
cd /opt/cloudera/parcel-repo/
mv CDH-5.9.0-1.cdh5.9.0.p0.23-el6.parcel.sha1 CDH-5.9.0-1.cdh5.9.0.p0.23-el6.parcel.sha
4、修改配置文件中的 server_host
vi /opt/cm/etc/cloudera-scm-agent/config.ini
server_host=master
5、将 mysql 的 JDBC 驱动放入 CM 的 lib 目录下
JDBC 驱动下载:http://dev.mysql.com/downloads/connector/j/
gz 和 zip 都无所谓,最终要的是里面的 jar 包。
解压获得 mysql-connector-java-5.1.40-bin.jar 上传到集群。
mv mysql-connector-java-5.1.40-bin.jar /opt/cm/share/cmf/lib/
6、为 CM 创建数据库
/opt/cm/share/cmf/schema/scm_prepare_database.sh mysql cm -hlocalhost -uroot - p 你的密码 --scm-host localhost scm scm scm
7、为每个节点创建 cloudera-scm 用户
useradd --system --home=/opt/cm/run/cloudera-scm-server --no-create-home --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm
接下来其实可以直接在 master 上启动服务安装了,但因为其它节点没有 CM,最后还是通过远程的 yum 在线下载再安装,我这设置了内部网络,其它节点是访问不了外网的,所以拷贝 CM 到其它节点进行完全离线安装。
8、拷贝 CM 到每个节点
./scp.sh /opt/program/cm-5.9.0/ /opt/program/cm-5.9.0/
./ssh.sh "ln -s /opt/program/cm-5.9.0/ /opt/cm"
看着滚动着的屏幕,等吧~
PS: 我单独搞了个二级路由器给集群当交换机,但用的是无线,这路由器也是个便宜货,scp 的时候看了下,速度峰值只有 2Mb/ s 左右,普遍在 1.2Mb/s,所以 scp 的时候特别慢,应该和路由器及笔记本的无线网卡有关 (笔记本比较老,无线网卡型号也挺旧)。有线没试,估计会好很多,毕竟 100M 的有线网卡很早就普及了。所以大的数据量,无线是搞不起来的。大数据搞不了,小数据还是可以搞搞的嘛~ 小数据要什么分布式集群啊?
所以,大数据处理速度想要快,CPU、内存、网速和 IO 速度,这几项硬件还是大头啊。大头既然搞不了(关键是没钱),小头还是可以搞搞的嘛~ 比如:重构啊,序列化啊什么的,下次在这上面试试效果。
拷贝了快 1 个小时,完了赶紧虚拟机快照一下。
9、在 master 上启动 CM 的 service 服务
/opt/cm/etc/init.d/cloudera-scm-server start
10、在所有你想作为 worker 的节点上启动 CM 的 agent 服务
/opt/cm/etc/init.d/cloudera-scm-agent start
然后就能在 http://master:7180/ 上开始安装 CDH 了。但因为是刚启动,需要等上个几分钟,才能看到 web 页面。当然,你电脑快,当我没说 0.0
等页面能访问了,看了下 master 上剩余内存只有 300M 了。
七、安装 CDH(图大部分是以 5 台节点的时候截的,最后几张是 3 台节点。图要是看不清楚,可以右击选择 ” 在新标签中查看 ”)
1、使用 admin(密码 admin)登录
2、勾选然后“继续”
3、按需选择,我选择免费
4、继续
5、因为我们在节点上启动了 agent,所以直接点“当前管理的主机”。如果节点上没有 CM,只有 master 上有,这边可以在新主机下去搜索,例如 192.168.2.[100-104],但这样最后从节点会去 yum 在线安装。
6、全部勾上,然后继续
7、选择版本,然后继续
8、开始安装了,等着吧
9、好了之后继续
10、全部是勾,完美!
这里可能会有各种各样的问题,但每个问题,cloudera 都会给出相应的建议,当然也有一些很恶心的黄色感叹号。比如:
我明明 JDK 都是一个 tar.gz 解压出来的,它硬说我版本不一致,查看提示发现一个 JAVA_HOME 是 /opt/java,一个是 /opt/java/,多了个斜杠他就认为不一致了,我回档快照然后再整就没问题了,这种其实可以直接忽略掉。
所以这边有问题,请仔细看提示,看看是不是哪个漏了或搞错了。
11、集群设置,按需选择
12、角色分配,按需分配
13、创建 Mysql 数据库并测试(按需创建,比如你没选 oozie,就不用创建 oozie 的数据库)
--hive 数据库
create database hive DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
--oozie 数据库
create database oozie DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
--hue 数据库
create database hue DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
这时 hue 是连不上的,会报错:Unexpected error. Unable to verify database connection.
这是因为我是 Centos 最小安装,缺了个东西:yum install -y python-lxml
这个坑了我很久,还是在 http://www.cnblogs.com/jasondan/p/4011153.html 下面的回复里找到的解决方案。感谢那位小伙伴。
14、集群设置
15、报错了,看日志显示没装 perl,每个节点都装一下
yum install -y perl
16、然后就让我蛋疼了很久,如下图,JAVA_HOME 竟然找不到了,但只是 spark 找不到,其它 hdfs、yarn 等都好的,说明我肯定都设置好了啊。
我做了 2 个尝试,就好了,也不知道到底是哪个是有效操作,还是 2 个操作是有依赖的。
尝试一:
cat /etc/environment
然后在 web 上点“重试”试试看。不行的话:
尝试二:
find / -type f -name "*.sh" | xargs grep "as ALT_NAME"
定位到 /opt/program/cm-5.9.0/lib64/cmf/service/client/deploy-cc.sh
直接在上面加上
JAVA_HOME=/opt/java
export JAVA_HOME=/opt/java
scp 到每个节点
./scp.sh /opt/program/cm-5.9.0/lib64/cmf/service/client/deploy-cc.sh /opt/program/cm-5.9.0/lib64/cmf/service/client/
再搞一遍这个
cat /etc/environment
然后再点“重试”就好了
17、继续安装,启动 hive 的时候失败,看日志是没有 Mysql 的 JDBC,cp 一个过去再继续
cp mysql-connector-java-5.1.40-bin.jar /opt/cloudera/parcels/CDH-5.9.0-1.cdh5.9.0.p0.23/lib/hive/lib/
18、安装 oozie 的时候失败,还是 JDBC,再 cp 一个
cp mysql-connector-java-5.1.40-bin.jar /var/lib/oozie/
19、mater 给 4G 的时候,执行到 oozie 我就报错了,图忘记截了,网上说是内存不足。下图是 master 给了 6G。
20、终于装好了 0.0
八、测试,使用 spark 计算 PI
因为权限问题,先切换到 hdfs 用户,之前安装过程中 CDH 已经创建好 hdfs 用户了。
su hdfs
spark-submit \
--master yarn-client \
--class org.apache.spark.examples.SparkPi \
--driver-memory 512m \
--executor-memory 512m \
--executor-cores 2 \
/opt/cloudera/parcels/CDH-5.9.0-1.cdh5.9.0.p0.23/lib/spark/examples/lib/spark-examples-1.6.0-cdh5.9.0-hadoop2.6.0-cdh5.9.0.jar
10
17/01/12 23:28:30 INFO spark.SparkContext: Running Spark version 1.6.0
17/01/12 23:28:33 INFO spark.SecurityManager: Changing view acls to: hdfs
17/01/12 23:28:33 INFO spark.SecurityManager: Changing modify acls to: hdfs
17/01/12 23:28:33 INFO spark.SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(hdfs); users with modify permissions: Set(hdfs)
17/01/12 23:28:34 INFO util.Utils: Successfully started service 'sparkDriver' on port 38078.
17/01/12 23:28:36 INFO slf4j.Slf4jLogger: Slf4jLogger started
17/01/12 23:28:37 INFO Remoting: Starting remoting
17/01/12 23:28:37 INFO Remoting: Remoting started; listening on addresses :[akka.tcp://sparkDriverActorSystem@192.168.2.100:34306]
17/01/12 23:28:37 INFO Remoting: Remoting now listens on addresses: [akka.tcp://sparkDriverActorSystem@192.168.2.100:34306]
17/01/12 23:28:37 INFO util.Utils: Successfully started service 'sparkDriverActorSystem' on port 34306.
17/01/12 23:28:37 INFO spark.SparkEnv: Registering MapOutputTracker
17/01/12 23:28:37 INFO spark.SparkEnv: Registering BlockManagerMaster
17/01/12 23:28:37 INFO storage.DiskBlockManager: Created local directory at /tmp/blockmgr-d9897e9d-bdd0-424a-acdb-b636ba57cd04
17/01/12 23:28:37 INFO storage.MemoryStore: MemoryStore started with capacity 265.1 MB
17/01/12 23:28:38 INFO spark.SparkEnv: Registering OutputCommitCoordinator
17/01/12 23:28:39 INFO util.Utils: Successfully started service 'SparkUI' on port 4040.
17/01/12 23:28:39 INFO ui.SparkUI: Started SparkUI at http://192.168.2.100:4040
17/01/12 23:28:39 INFO spark.SparkContext: Added JAR file:/opt/cloudera/parcels/CDH-5.9.0-1.cdh5.9.0.p0.23/lib/spark/examples/lib/spark-examples-1.6.0-cdh5.9.0-hadoop2.6.0-cdh5.9.0.jar at spark://192.168.2.100:38078/jars/spark-examples-1.6.0-cdh5.9.0-hadoop2.6.0-cdh5.9.0.jar with timestamp 1484234919364
17/01/12 23:28:40 INFO client.RMProxy: Connecting to ResourceManager at master/192.168.2.100:8032
17/01/12 23:28:41 INFO yarn.Client: Requesting a new application from cluster with 2 NodeManagers
17/01/12 23:28:42 INFO yarn.Client: Verifying our application has not requested more than the maximum memory capability of the cluster (1024 MB per container)
17/01/12 23:28:42 INFO yarn.Client: Will allocate AM container, with 896 MB memory including 384 MB overhead
17/01/12 23:28:42 INFO yarn.Client: Setting up container launch context for our AM
17/01/12 23:28:42 INFO yarn.Client: Setting up the launch environment for our AM container
17/01/12 23:28:42 INFO yarn.Client: Preparing resources for our AM container
17/01/12 23:28:44 INFO yarn.Client: Uploading resource file:/tmp/spark-40750070-91a7-4a5b-ae27-1cfd733d0be8/__spark_conf__3134783970337565626.zip -> hdfs://master:8020/user/hdfs/.sparkStaging/application_1484232210824_0004/__spark_conf__3134783970337565626.zip
17/01/12 23:28:45 INFO spark.SecurityManager: Changing view acls to: hdfs
17/01/12 23:28:45 INFO spark.SecurityManager: Changing modify acls to: hdfs
17/01/12 23:28:45 INFO spark.SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(hdfs); users with modify permissions: Set(hdfs)
17/01/12 23:28:45 INFO yarn.Client: Submitting application 4 to ResourceManager
17/01/12 23:28:46 INFO impl.YarnClientImpl: Submitted application application_1484232210824_0004
17/01/12 23:28:47 INFO yarn.Client: Application report for application_1484232210824_0004 (state: ACCEPTED)
17/01/12 23:28:47 INFO yarn.Client:
client token: N/A
diagnostics: N/A
ApplicationMaster host: N/A
ApplicationMaster RPC port: -1
queue: root.users.hdfs
start time: 1484234925930
final status: UNDEFINED
tracking URL: http://master:8088/proxy/application_1484232210824_0004/
user: hdfs
17/01/12 23:28:48 INFO yarn.Client: Application report for application_1484232210824_0004 (state: ACCEPTED)
17/01/12 23:28:49 INFO yarn.Client: Application report for application_1484232210824_0004 (state: ACCEPTED)
17/01/12 23:28:50 INFO yarn.Client: Application report for application_1484232210824_0004 (state: ACCEPTED)
17/01/12 23:28:51 INFO cluster.YarnSchedulerBackend$YarnSchedulerEndpoint: ApplicationMaster registered as NettyRpcEndpointRef(null)
17/01/12 23:28:51 INFO yarn.Client: Application report for application_1484232210824_0004 (state: ACCEPTED)
17/01/12 23:28:51 INFO cluster.YarnClientSchedulerBackend: Add WebUI Filter. org.apache.hadoop.yarn.server.webproxy.amfilter.AmIpFilter, Map(PROXY_HOSTS -> master, PROXY_URI_BASES -> http://master:8088/proxy/application_1484232210824_0004), /proxy/application_1484232210824_0004
17/01/12 23:28:51 INFO ui.JettyUtils: Adding filter: org.apache.hadoop.yarn.server.webproxy.amfilter.AmIpFilter
17/01/12 23:28:52 INFO yarn.Client: Application report for application_1484232210824_0004 (state: RUNNING)
17/01/12 23:28:52 INFO yarn.Client:
client token: N/A
diagnostics: N/A
ApplicationMaster host: 192.168.2.101
ApplicationMaster RPC port: 0
queue: root.users.hdfs
start time: 1484234925930
final status: UNDEFINED
tracking URL: http://master:8088/proxy/application_1484232210824_0004/
user: hdfs
17/01/12 23:28:52 INFO cluster.YarnClientSchedulerBackend: Application application_1484232210824_0004 has started running.
17/01/12 23:28:52 INFO util.Utils: Successfully started service 'org.apache.spark.network.netty.NettyBlockTransferService' on port 42832.
17/01/12 23:28:52 INFO netty.NettyBlockTransferService: Server created on 42832
17/01/12 23:28:52 INFO storage.BlockManager: external shuffle service port = 7337
17/01/12 23:28:52 INFO storage.BlockManagerMaster: Trying to register BlockManager
17/01/12 23:28:52 INFO storage.BlockManagerMasterEndpoint: Registering block manager 192.168.2.100:42832 with 265.1 MB RAM, BlockManagerId(driver, 192.168.2.100, 42832)
17/01/12 23:28:52 INFO storage.BlockManagerMaster: Registered BlockManager
17/01/12 23:28:53 INFO scheduler.EventLoggingListener: Logging events to hdfs://master:8020/user/spark/applicationHistory/application_1484232210824_0004
17/01/12 23:28:53 INFO cluster.YarnClientSchedulerBackend: SchedulerBackend is ready for scheduling beginning after reached minRegisteredResourcesRatio: 0.8
17/01/12 23:28:55 INFO spark.SparkContext: Starting job: reduce at SparkPi.scala:36
17/01/12 23:28:55 INFO scheduler.DAGScheduler: Got job 0 (reduce at SparkPi.scala:36) with 10 output partitions
17/01/12 23:28:55 INFO scheduler.DAGScheduler: Final stage: ResultStage 0 (reduce at SparkPi.scala:36)
17/01/12 23:28:55 INFO scheduler.DAGScheduler: Parents of final stage: List()
17/01/12 23:28:55 INFO scheduler.DAGScheduler: Missing parents: List()
17/01/12 23:28:55 INFO scheduler.DAGScheduler: Submitting ResultStage 0 (MapPartitionsRDD[1] at map at SparkPi.scala:32), which has no missing parents
17/01/12 23:28:57 INFO spark.ExecutorAllocationManager: Requesting 1 new executor because tasks are backlogged (new desired total will be 1)
17/01/12 23:28:57 INFO storage.MemoryStore: Block broadcast_0 stored as values in memory (estimated size 1904.0 B, free 1904.0 B)
17/01/12 23:28:58 INFO storage.MemoryStore: Block broadcast_0_piece0 stored as bytes in memory (estimated size 1202.0 B, free 3.0 KB)
17/01/12 23:28:58 INFO storage.BlockManagerInfo: Added broadcast_0_piece0 in memory on 192.168.2.100:42832 (size: 1202.0 B, free: 265.1 MB)
17/01/12 23:28:58 INFO spark.SparkContext: Created broadcast 0 from broadcast at DAGScheduler.scala:1006
17/01/12 23:28:58 INFO spark.ExecutorAllocationManager: Requesting 2 new executors because tasks are backlogged (new desired total will be 3)
17/01/12 23:28:58 INFO scheduler.DAGScheduler: Submitting 10 missing tasks from ResultStage 0 (MapPartitionsRDD[1] at map at SparkPi.scala:32)
17/01/12 23:28:58 INFO cluster.YarnScheduler: Adding task set 0.0 with 10 tasks
17/01/12 23:28:59 INFO spark.ExecutorAllocationManager: Requesting 2 new executors because tasks are backlogged (new desired total will be 5)
17/01/12 23:29:09 INFO cluster.YarnClientSchedulerBackend: Registered executor NettyRpcEndpointRef(null) (node02:49339) with ID 1
17/01/12 23:29:09 INFO storage.BlockManagerMasterEndpoint: Registering block manager node02:37527 with 265.1 MB RAM, BlockManagerId(1, node02, 37527)
17/01/12 23:29:10 INFO spark.ExecutorAllocationManager: New executor 1 has registered (new total is 1)
17/01/12 23:29:11 INFO scheduler.TaskSetManager: Starting task 0.0 in stage 0.0 (TID 0, node02, executor 1, partition 0,PROCESS_LOCAL, 2071 bytes)
17/01/12 23:29:11 INFO scheduler.TaskSetManager: Starting task 1.0 in stage 0.0 (TID 1, node02, executor 1, partition 1,PROCESS_LOCAL, 2073 bytes)
17/01/12 23:29:16 INFO storage.BlockManagerInfo: Added broadcast_0_piece0 in memory on node02:37527 (size: 1202.0 B, free: 265.1 MB)
17/01/12 23:29:17 INFO scheduler.TaskSetManager: Starting task 2.0 in stage 0.0 (TID 2, node02, executor 1, partition 2,PROCESS_LOCAL, 2073 bytes)
17/01/12 23:29:17 INFO scheduler.TaskSetManager: Starting task 3.0 in stage 0.0 (TID 3, node02, executor 1, partition 3,PROCESS_LOCAL, 2073 bytes)
17/01/12 23:29:17 INFO scheduler.TaskSetManager: Starting task 4.0 in stage 0.0 (TID 4, node02, executor 1, partition 4,PROCESS_LOCAL, 2073 bytes)
17/01/12 23:29:17 INFO scheduler.TaskSetManager: Starting task 5.0 in stage 0.0 (TID 5, node02, executor 1, partition 5,PROCESS_LOCAL, 2073 bytes)
17/01/12 23:29:17 INFO scheduler.TaskSetManager: Starting task 6.0 in stage 0.0 (TID 6, node02, executor 1, partition 6,PROCESS_LOCAL, 2073 bytes)
17/01/12 23:29:17 INFO scheduler.TaskSetManager: Finished task 1.0 in stage 0.0 (TID 1) in 6402 ms on node02 (executor 1) (1/10)
17/01/12 23:29:17 INFO scheduler.TaskSetManager: Finished task 3.0 in stage 0.0 (TID 3) in 250 ms on node02 (executor 1) (2/10)
17/01/12 23:29:17 INFO scheduler.TaskSetManager: Finished task 2.0 in stage 0.0 (TID 2) in 308 ms on node02 (executor 1) (3/10)
17/01/12 23:29:17 INFO scheduler.TaskSetManager: Finished task 0.0 in stage 0.0 (TID 0) in 6855 ms on node02 (executor 1) (4/10)
17/01/12 23:29:17 INFO scheduler.TaskSetManager: Starting task 7.0 in stage 0.0 (TID 7, node02, executor 1, partition 7,PROCESS_LOCAL, 2073 bytes)
17/01/12 23:29:17 INFO scheduler.TaskSetManager: Finished task 4.0 in stage 0.0 (TID 4) in 266 ms on node02 (executor 1) (5/10)
17/01/12 23:29:17 INFO scheduler.TaskSetManager: Finished task 5.0 in stage 0.0 (TID 5) in 190 ms on node02 (executor 1) (6/10)
17/01/12 23:29:17 INFO scheduler.TaskSetManager: Starting task 8.0 in stage 0.0 (TID 8, node02, executor 1, partition 8,PROCESS_LOCAL, 2073 bytes)
17/01/12 23:29:17 INFO scheduler.TaskSetManager: Finished task 6.0 in stage 0.0 (TID 6) in 156 ms on node02 (executor 1) (7/10)
17/01/12 23:29:17 INFO scheduler.TaskSetManager: Starting task 9.0 in stage 0.0 (TID 9, node02, executor 1, partition 9,PROCESS_LOCAL, 2073 bytes)
17/01/12 23:29:17 INFO scheduler.TaskSetManager: Finished task 7.0 in stage 0.0 (TID 7) in 149 ms on node02 (executor 1) (8/10)
17/01/12 23:29:17 INFO scheduler.TaskSetManager: Finished task 8.0 in stage 0.0 (TID 8) in 131 ms on node02 (executor 1) (9/10)
17/01/12 23:29:17 INFO scheduler.TaskSetManager: Finished task 9.0 in stage 0.0 (TID 9) in 128 ms on node02 (executor 1) (10/10)
17/01/12 23:29:17 INFO scheduler.DAGScheduler: ResultStage 0 (reduce at SparkPi.scala:36) finished in 19.406 s
17/01/12 23:29:17 INFO cluster.YarnScheduler: Removed TaskSet 0.0, whose tasks have all completed, from pool
17/01/12 23:29:17 INFO scheduler.DAGScheduler: Job 0 finished: reduce at SparkPi.scala:36, took 22.241001 s
Pi is roughly 3.142676
17/01/12 23:29:18 INFO ui.SparkUI: Stopped Spark web UI at http://192.168.2.100:4040
17/01/12 23:29:18 INFO cluster.YarnClientSchedulerBackend: Interrupting monitor thread
17/01/12 23:29:18 INFO cluster.YarnClientSchedulerBackend: Shutting down all executors
17/01/12 23:29:18 INFO cluster.YarnClientSchedulerBackend: Asking each executor to shut down
17/01/12 23:29:19 INFO cluster.YarnClientSchedulerBackend: Stopped
17/01/12 23:29:19 INFO spark.MapOutputTrackerMasterEndpoint: MapOutputTrackerMasterEndpoint stopped!
17/01/12 23:29:19 INFO storage.MemoryStore: MemoryStore cleared
17/01/12 23:29:19 INFO storage.BlockManager: BlockManager stopped
17/01/12 23:29:19 INFO storage.BlockManagerMaster: BlockManagerMaster stopped
17/01/12 23:29:19 INFO scheduler.OutputCommitCoordinator$OutputCommitCoordinatorEndpoint: OutputCommitCoordinator stopped!
17/01/12 23:29:19 INFO spark.SparkContext: Successfully stopped SparkContext
17/01/12 23:29:20 INFO remote.RemoteActorRefProvider$RemotingTerminator: Shutting down remote daemon.
17/01/12 23:29:20 INFO util.ShutdownHookManager: Shutdown hook called
17/01/12 23:29:20 INFO remote.RemoteActorRefProvider$RemotingTerminator: Remote daemon shut down; proceeding with flushing remote transports.
17/01/12 23:29:20 INFO util.ShutdownHookManager: Deleting directory /tmp/spark-40750070-91a7-4a5b-ae27-1cfd733d0be8
上面已经计算出来了:Pi is roughly 3.142676
收工收工。
参考资料如下:
http://www.linuxidc.com/Linux/2016-06/132131.htm
http://www.linuxidc.com/Linux/2016-07/133356.htm
http://www.linuxidc.com/Linux/2016-07/133359.htm
Hadoop-2.0.0-CDH4.7.0 集群部署 PDF http://www.linuxidc.com/Linux/2017-01/139501.htm
CDH5.7.2 离线部署笔记 http://www.linuxidc.com/Linux/2016-08/133924.htm
重新编译、安装 spark assembly,使 CDH5.5.1 支持 sparkSQL http://www.linuxidc.com/Linux/2016-08/133847.htm
Cloudera Manager 5 和 CDH5 离线安装 http://www.linuxidc.com/Linux/2016-07/133360.htm
更多 Hadoop 相关信息见Hadoop 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=13
本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-01/139518.htm