hadoop26编译
Ⅰ hadoop 重新编译,提示如下错误,怎么个意思了
第一次编辑错误提示
主要是增加了在maven目录下,conf/settings.xml
<mirror>
<id>nexus-osc</id>
<mirrorOf>*</mirrorOf>
<name>Nexusosc</name>
<url>http://maven.oschina.net/content/groups/public/</url>
</mirror>
<profile>
<id>jdk-1.7</id>
<activation>
<jdk>1.7</jdk>
</activation>
<repositories>
<repository>
<id>nexus</id>
<name>local private nexus</name>
<url>http://maven.oschina.net/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>local private nexus</name>
<url>http://maven.oschina.net/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Apache Hadoop Main ................................. FAILURE [06:34 min]
[INFO] Apache Hadoop Project POM .......................... SKIPPED
[INFO] Apache Hadoop Annotations .......................... SKIPPED
[INFO] Apache Hadoop Assemblies ........................... SKIPPED
[INFO] Apache Hadoop Project Dist POM ..................... SKIPPED
[INFO] Apache Hadoop Maven Plugins ........................ SKIPPED
[INFO] Apache Hadoop MiniKDC .............................. SKIPPED
[INFO] Apache Hadoop Auth ................................. SKIPPED
[INFO] Apache Hadoop Auth Examples ........................ SKIPPED
[INFO] Apache Hadoop Common ............................... SKIPPED
[INFO] Apache Hadoop NFS .................................. SKIPPED
[INFO] Apache Hadoop Common Project ....................... SKIPPED
[INFO] Apache Hadoop HDFS ................................. SKIPPED
[INFO] Apache Hadoop HttpFS ............................... SKIPPED
[INFO] Apache Hadoop HDFS BookKeeper Journal .............. SKIPPED
[INFO] Apache Hadoop HDFS-NFS ............................. SKIPPED
[INFO] Apache Hadoop HDFS Project ......................... SKIPPED
[INFO] hadoop-yarn ........................................ SKIPPED
[INFO] hadoop-yarn-api .................................... SKIPPED
[INFO] hadoop-yarn-common ................................. SKIPPED
[INFO] hadoop-yarn-server ................................. SKIPPED
[INFO] hadoop-yarn-server-common .......................... SKIPPED
[INFO] hadoop-yarn-server-nodemanager ..................... SKIPPED
[INFO] hadoop-yarn-server-web-proxy ....................... SKIPPED
[INFO] hadoop-yarn-server-applicationhistoryservice ....... SKIPPED
[INFO] hadoop-yarn-server-resourcemanager ................. SKIPPED
[INFO] hadoop-yarn-server-tests ........................... SKIPPED
[INFO] hadoop-yarn-client ................................. SKIPPED
[INFO] hadoop-yarn-applications ........................... SKIPPED
[INFO] hadoop-yarn-applications-distributedshell .......... SKIPPED
[INFO] hadoop-yarn-applications-unmanaged-am-launcher ..... SKIPPED
[INFO] hadoop-yarn-site ................................... SKIPPED
[INFO] hadoop-yarn-project ................................ SKIPPED
[INFO] hadoop-maprece-client ............................ SKIPPED
[INFO] hadoop-maprece-client-core ....................... SKIPPED
[INFO] hadoop-maprece-client-common ..................... SKIPPED
[INFO] hadoop-maprece-client-shuffle .................... SKIPPED
[INFO] hadoop-maprece-client-app ........................ SKIPPED
[INFO] hadoop-maprece-client-hs ......................... SKIPPED
[INFO] hadoop-maprece-client-jobclient .................. SKIPPED
[INFO] hadoop-maprece-client-hs-plugins ................. SKIPPED
[INFO] Apache Hadoop MapRece Examples ................... SKIPPED
[INFO] hadoop-maprece ................................... SKIPPED
[INFO] Apache Hadoop MapRece Streaming .................. SKIPPED
[INFO] Apache Hadoop Distributed Copy ..................... SKIPPED
[INFO] Apache Hadoop Archives ............................. SKIPPED
[INFO] Apache Hadoop Rumen ................................ SKIPPED
[INFO] Apache Hadoop Gridmix .............................. SKIPPED
[INFO] Apache Hadoop Data Join ............................ SKIPPED
[INFO] Apache Hadoop Extras ............................... SKIPPED
[INFO] Apache Hadoop Pipes ................................ SKIPPED
[INFO] Apache Hadoop OpenStack support .................... SKIPPED
[INFO] Apache Hadoop Client ............................... SKIPPED
[INFO] Apache Hadoop Mini-Cluster ......................... SKIPPED
[INFO] Apache Hadoop Scheler Load Simulator ............. SKIPPED
[INFO] Apache Hadoop Tools Dist ........................... SKIPPED
[INFO] Apache Hadoop Tools ................................ SKIPPED
[INFO] Apache Hadoop Distribution ......................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10:10 min
[INFO] Finished at: 2015-01-12T00:52:27-08:00
[INFO] Final Memory: 29M/70M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.3:attach-descriptor (attach-descriptor) on project hadoop-main: Execution attach-descriptor of goal org.apache.maven.plugins:maven-site-plugin:3.3:attach-descriptor failed: Plugin org.apache.maven.plugins:maven-site-plugin:3.3 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-site-plugin:jar:3.3 -> org.apache.maven.reporting:maven-reporting-exec:jar:1.1 -> org.apache.maven.shared:maven-shared-utils:jar:0.3: Failed to read artifact descriptor for org.apache.maven.shared:maven-shared-utils:jar:0.3: Could not transfer artifact org.apache.maven.shared:maven-shared-utils:pom:0.3 from/to nexus-osc (http://maven.oschina.net/content/groups/public/): Failed to transfer file:http://maven.oschina.net/content/groups/public/org/apache/maven/shared/maven-shared-utils/0.3/maven-shared-utils-0.3.pom. Return code is: 502, ReasonPhrase: Bad Gateway. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
[hadoop@localhost hadoop-2.5.0-src]$
Ⅱ 安装hadoop的步骤有哪些
hadoop2.0已经发布了稳定版本了,增加了很多特性,比如HDFSHA、YARN等。最新的hadoop-2.4.1又增加了YARNHA
注意:apache提供的hadoop-2.4.1的安装包是在32位操作系统编译的,因为hadoop依赖一些C++的本地库,
所以如果在64位的操作上安装hadoop-2.4.1就需要重新在64操作系统上重新编译
(建议第一次安装用32位的系统,我将编译好的64位的也上传到群共享里了,如果有兴趣的可以自己编译一下)
前期准备就不详细说了,课堂上都介绍了
1.修改linux主机名
2.修改IP
3.修改主机名和IP的映射关系
######注意######如果你们公司是租用的服务器或是使用的云主机(如华为用主机、阿里云主机等)
/etc/hosts里面要配置的是内网IP地址和主机名的映射关系
4.关闭防火墙
5.ssh免登陆
6.安装JDK,配置环境变量等
集群规划:
主机名 IP 安装的软件 运行的进程
HA181 192.168.1.181 jdk、hadoop NameNode、DFSZKFailoverController(zkfc)
HA182 192.168.1.182 jdk、hadoop NameNode、DFSZKFailoverController(zkfc)
HA183 192.168.1.183 jdk、hadoop ResourceManager
HA184 192.168.1.184 jdk、hadoop ResourceManager
HA185 192.168.1.185 jdk、hadoop、zookeeper DataNode、NodeManager、JournalNode、QuorumPeerMain
HA186 192.168.1.186 jdk、hadoop、zookeeper DataNode、NodeManager、JournalNode、QuorumPeerMain
HA187 192.168.1.187 jdk、hadoop、zookeeper DataNode、NodeManager、JournalNode、QuorumPeerMain
说明:
1.在hadoop2.0中通常由两个NameNode组成,一个处于active状态,另一个处于standby状态。ActiveNameNode对外提供服务,而StandbyNameNode则不对外提供服务,仅同步activenamenode的状态,以便能够在它失败时快速进行切换。
hadoop2.0官方提供了两种HDFSHA的解决方案,一种是NFS,另一种是QJM。这里我们使用简单的QJM。在该方案中,主备NameNode之间通过一组JournalNode同步元数据信息,一条数据只要成功写入多数JournalNode即认为写入成功。通常配置奇数个JournalNode
这里还配置了一个zookeeper集群,用于ZKFC(DFSZKFailoverController)故障转移,当ActiveNameNode挂掉了,会自动切换StandbyNameNode为standby状态
2.hadoop-2.2.0中依然存在一个问题,就是ResourceManager只有一个,存在单点故障,hadoop-2.4.1解决了这个问题,有两个ResourceManager,一个是Active,一个是Standby,状态由zookeeper进行协调
安装步骤:
1.安装配置zooekeeper集群(在HA185上)
1.1解压
tar-zxvfzookeeper-3.4.5.tar.gz-C/app/
1.2修改配置
cd/app/zookeeper-3.4.5/conf/
cpzoo_sample.cfgzoo.cfg
vimzoo.cfg
修改:dataDir=/app/zookeeper-3.4.5/tmp
在最后添加:
server.1=HA185:2888:3888
server.2=HA186:2888:3888
server.3=HA187:2888:3888
保存退出
然后创建一个tmp文件夹
mkdir/app/zookeeper-3.4.5/tmp
再创建一个空文件
touch/app/zookeeper-3.4.5/tmp/myid
最后向该文件写入ID
echo1>/app/zookeeper-3.4.5/tmp/myid
1.3将配置好的zookeeper拷贝到其他节点(首先分别在HA186、HA187根目录下创建一个weekend目录:mkdir/weekend)
scp-r/app/zookeeper-3.4.5/HA186:/app/
scp-r/app/zookeeper-3.4.5/HA187:/app/
注意:修改HA186、HA187对应/weekend/zookeeper-3.4.5/tmp/myid内容
HA186:
echo2>/app/zookeeper-3.4.5/tmp/myid
HA187:
echo3>/app/zookeeper-3.4.5/tmp/myid
2.安装配置hadoop集群(在HA181上操作)
2.1解压
tar-zxvfhadoop-2.4.1.tar.gz-C/weekend/
2.2配置HDFS(hadoop2.0所有的配置文件都在$HADOOP_HOME/etc/hadoop目录下)
#将hadoop添加到环境变量中
vim/etc/profile
exportjava_HOME=/app/jdk1.7.0_79
exportHADOOP_HOME=/app/hadoop-2.4.1
exportPATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin
#hadoop2.0的配置文件全部在$HADOOP_HOME/etc/hadoop下
cd/home/hadoop/app/hadoop-2.4.1/etc/hadoop
2.2.1修改hadoop-env.sh
exportJAVA_HOME=/app/jdk1.7.0_79
2.2.2修改core-site.xml
<configuration>
<!--指定hdfs的nameservice为ns1-->
<property>
<name>fs.defaultFS</name>
<value>hdfs://ns1/</value>
</property>
<!--指定hadoop临时目录-->
<property>
<name>hadoop.tmp.dir</name>
<value>/app/hadoop-2.4.1/tmp</value>
</property>
<!--指定zookeeper地址-->
<property>
<name>ha.zookeeper.quorum</name>
<value>HA185:2181,HA186:2181,HA187:2181</value>
</property>
</configuration>
2.2.3修改hdfs-site.xml
<configuration>
<!--指定hdfs的nameservice为ns1,需要和core-site.xml中的保持一致-->
<property>
<name>dfs.nameservices</name>
<value>ns1</value>
</property>
<!--ns1下面有两个NameNode,分别是nn1,nn2-->
<property>
<name>dfs.ha.namenodes.ns1</name>
<value>nn1,nn2</value>
</property>
<!--nn1的RPC通信地址-->
<property>
<name>dfs.namenode.rpc-address.ns1.nn1</name>
<value>HA181:9000</value>
</property>
<!--nn1的http通信地址-->
<property>
<name>dfs.namenode.http-address.ns1.nn1</name>
<value>HA181:50070</value>
</property>
<!--nn2的RPC通信地址-->
<property>
<name>dfs.namenode.rpc-address.ns1.nn2</name>
<value>HA182:9000</value>
</property>
<!--nn2的http通信地址-->
<property>
<name>dfs.namenode.http-address.ns1.nn2</name>
<value>HA182:50070</value>
</property>
<!--指定NameNode的元数据在JournalNode上的存放位置-->
<property>
<name>dfs.namenode.shared.edits.dir</name>
<value>qjournal://HA185:8485;HA186:8485;HA187:8485/ns1</value>
</property>
<!--指定JournalNode在本地磁盘存放数据的位置-->
<property>
<name>dfs.journalnode.edits.dir</name>
<value>/app/hadoop-2.4.1/journaldata</value>
</property>
<!--开启NameNode失败自动切换-->
<property>
<name>dfs.ha.automatic-failover.enabled</name>
<value>true</value>
</property>
<!--配置失败自动切换实现方式-->
<property>
<name>dfs.client.failover.proxy.provider.ns1</name>
<value>org.apache.hadoop.hdfs.server.namenode.ha.</value>
</property>
<!--配置隔离机制方法,多个机制用换行分割,即每个机制暂用一行-->
<property>
<name>dfs.ha.fencing.methods</name>
<value>
sshfence
shell(/bin/true)
</value>
</property>
<!--使用sshfence隔离机制时需要ssh免登陆-->
<property>
<name>dfs.ha.fencing.ssh.private-key-files</name>
<value>/home/hadoop/.ssh/id_rsa</value>
</property>
<!--配置sshfence隔离机制超时时间-->
<property>
<name>dfs.ha.fencing.ssh.connect-timeout</name>
<value>30000</value>
</property>
</configuration>
2.2.4修改mapred-site.xml
<configuration>
<!--指定mr框架为yarn方式-->
<property>
<name>maprece.framework.name</name>
<value>yarn</value>
</property>
</configuration>
2.2.5修改yarn-site.xml
<configuration>
<!--开启RM高可用-->
<property>
<name>yarn.resourcemanager.ha.enabled</name>
<value>true</value>
</property>
<!--指定RM的clusterid-->
<property>
<name>yarn.resourcemanager.cluster-id</name>
<value>yrc</value>
</property>
<!--指定RM的名字-->
<property>
<name>yarn.resourcemanager.ha.rm-ids</name>
<value>rm1,rm2</value>
</property>
<!--分别指定RM的地址-->
<property>
<name>yarn.resourcemanager.hostname.rm1</name>
<value>HA183</value>
</property>
<property>
<name>yarn.resourcemanager.hostname.rm2</name>
<value>HA184</value>
</property>
<!--指定zk集群地址-->
<property>
<name>yarn.resourcemanager.zk-address</name>
<value>HA185:2181,HA186:2181,HA187:2181</value>
</property>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>maprece_shuffle</value>
</property>
</configuration>
2.2.6修改slaves(slaves是指定子节点的位置,因为要在HA181上启动HDFS、在HA183启动yarn,
所以HA181上的slaves文件指定的是datanode的位置,HA183上的slaves文件指定的是nodemanager的位置)
HA185
HA186
HA187
2.2.7配置免密码登陆
#首先要配置HA181到HA182、HA183、HA184、HA185、HA186、HA187的免密码登陆
#在HA181上生产一对钥匙
ssh-keygen-trsa
#将公钥拷贝到其他节点,包括自己
ssh--idHA181
ssh--idHA182
ssh--idHA183
ssh--idHA184
ssh--idHA185
ssh--idHA186
ssh--idHA187
#配置HA183到HA184、HA185、HA186、HA187的免密码登陆
#在HA183上生产一对钥匙
ssh-keygen-trsa
#将公钥拷贝到其他节点
ssh--idHA184
ssh--idHA185
ssh--idHA186
ssh--idHA187
#注意:两个namenode之间要配置ssh免密码登陆,别忘了配置HA182到HA181的免登陆
在HA182上生产一对钥匙
ssh-keygen-trsa
ssh--id-iHA181
2.4将配置好的hadoop拷贝到其他节点
scp-r/app/hadoop-2.5.1/HA182:/app/
scp-r/app/hadoop-2.5.1/HA183:/app/
scp-r/app/hadoop-2.5.1/HA184:/app/
scp-r/app/hadoop-2.5.1/HA185:/app/
scp-r/app/hadoop-2.5.1/HA186:/app/
scp-r/app/hadoop-2.5.1/HA187:/app/
###注意:严格按照下面的步骤
2.5启动zookeeper集群(分别在HA185、HA186、tcast07上启动zk)
cd/app/zookeeper-3.4.5/bin/
./zkServer.shstart
#查看状态:一个leader,两个follower
./zkServer.shstatus
2.6启动journalnode(分别在在HA185、HA186、HA187上执行)
cd/app/hadoop-2.5.1
hadoop-daemon.shstartjournalnode
#运行jps命令检验,HA185、HA186、HA187上多了JournalNode进程
2.7格式化ZKFC(在HA181上执行即可) hdfszkfc-formatZK
2.8格式化HDFS
#在HA181上执行命令:
hdfsnamenode-format
#格式化后会在根据core-site.xml中的hadoop.tmp.dir配置生成个文件,这里我配置的是/app/hadoop-2.4.1/tmp,然后将/weekend/hadoop-2.4.1/tmp拷贝到HA182的/weekend/hadoop-2.4.1/下。
scp-rtmp/HA182:/app/hadoop-2.5.1/
##也可以这样,建议hdfsnamenode-bootstrapStandby
2.9启动HDFS(在HA181上执行)
sbin/start-dfs.sh
2.10启动YARN(#####注意#####:是在HA183上执行start-yarn.sh,把namenode和resourcemanager分开是因为性能问题,因为他们都要占用大量资源,所以把他们分开了,他们分开了就要分别在不同的机器上启动)
sbin/start-yarn.sh
到此,hadoop-2.4.1配置完毕,可以统计浏览器访问:
http://192.168.1.181:50070
NameNode'HA181:9000'(active)
http://192.168.1.182:50070
NameNode'HA182:9000'(standby)
验证HDFSHA
首先向hdfs上传一个文件
hadoopfs-put/etc/profile/profile
hadoopfs-ls/
然后再kill掉active的NameNode
kill-9<pidofNN>
通过浏览器访问:http://192.168.1.182:50070
NameNode'HA182:9000'(active)
这个时候HA182上的NameNode变成了active
在执行命令:
hadoopfs-ls/
-rw-r--r--3rootsupergroup19262014-02-0615:36/profile
刚才上传的文件依然存在!!!
手动启动那个挂掉的NameNode
sbin/hadoop-daemon.shstartnamenode
通过浏览器访问:http://192.168.1.181:50070
NameNode'HA181:9000'(standby)
验证YARN:
运行一下hadoop提供的demo中的WordCount程序:
hadoopjarshare/hadoop/maprece/hadoop-maprece-examples-2.4.1.jarwordcount/profile/out
OK,大功告成!!!
CID-74d21742-3e4b-4df6-a99c-d52f703b49c0
测试集群工作状态的一些指令:
bin/hdfsdfsadmin-report 查看hdfs的各节点状态信息
bin/hdfshaadmin-getServiceStatenn1 获取一个namenode节点的HA状态
sbin/hadoop-daemon.shstartnamenode单独启动一个namenode进程
./hadoop-daemon.shstartzkfc单独启动一个zkfc进程
Ⅲ hadoop编译时出现javac: file not found: 求助!!!!!
有 种可能
1、linux的classpath设置有问题,没有加上"."。
2、你的javac后的classpath设置也不对,wordCount的编译不只是需这一个包,我记得还有别的相关的jar包,只有都加到你的classpath中才能正常编译。
3、这种编译明显是不太合适,在windows上编译好后再导入linux运行比较简单直接一些。
试下看吧。
Ⅳ 为什么编译 hadoop 源码
编译了hadoop,可以方便的查看某个函数的实现。如果不编译就只是自己去翻源代码了。更重要的是如果你编译了hadoop,你可以根据自己的需要改动hadoop的某些实现机制。(hadoop开源的好处)