标签:des style blog class code java
1
2
3
4
5
6 |
<span style= ‘font-family: "courier new", courier;‘ >export JAVA_HOME=/usr/java/jdk1.6.0_45 export JRE_HOME=$JAVA_HOME/jre export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH export HADOOP_MAPRED_HOME=/usr/lib/hadoop-mapreduce </span> |
使之生效:source /etc/profile
<property>
<name>fs.defaultFS</name>
<value>hdfs://sdc</value>
</property>
<property>
<name>ha.zookeeper.quorum</name>
<value>datanode1:2181,datanode2:2181,datanode3:2181</value>
</property>
<property>
<name>fs.trash.interval</name>
<value>10080</value>
</property>
<property>
<name>fs.trash.checkpoint.interval</name>
<value>10080</value>
</property>
<property>
<name>hadoop.native.lib</name>
<value>true</value>
</property>
<property>
<name>hadoop.proxyuser.mapred.groups</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.mapred.hosts</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.oozie.hosts</name>
<value>10.0.0.2</value>
</property>
<property>
<name>hadoop.proxyuser.oozie.groups</name>
<value>*</value>
</property>
<property>
<name>io.compression.codecs</name>
<value>org.apache.hadoop.io.compress.DefaultCodec,org.apache.hadoop.io.compress.GzipCodec,org.apache.hadoop.io.compress.BZip2Codec,com.hadoop.compression.lzo.LzoCodec,com.hadoop.compression.lzo.LzopCodec,org.apache.hadoop.io.compress.SnappyCodec</value>
</property>
<property>
<name>dfs.replication</name>
<value>3</value>
</property>
<property>
<name>dfs.nameservices</name>
<value>sdc</value>
</property>
<property>
<name>dfs.ha.namenodes.sdc</name>
<value>nn1,nn2</value>
</property>
<!--配置rpc通信地址:dfs.namenode.rpc-address.[nameservice ID].-->
<property>
<name>dfs.namenode.rpc-address.sdc.nn1</name>
<value>namenode:8020</value>
</property>
<property>
<name>dfs.namenode.rpc-address.sdc.nn2</name>
<value>secondnamenode:8020</value>
</property>
<!--配置http通信地址:dfs.namenode.http-address.[nameservice ID] -->
<property>
<name>dfs.namenode.http-address.sdc.nn1</name>
<value>namenode:50070</value>
</property>
<property>
<name>dfs.namenode.http-address.sdc.nn2</name>
<value>secondnamenode:50070</value>
</property>
<property>
<name>dfs.namenode.shared.edits.dir</name>
<value>qjournal://datanode1:8485;datanode2:8485;datanode3:8485/sdc</value>
</property>
<property>
<name>dfs.permissions.superusergroup</name>
<value>hadoop</value>
</property>
<property>
<name>dfs.permissions</name>
<value>false</value>
</property>
<property>
<name>dfs.permissions.enabled</name>
<value>false</value>
</property>
<property>
<name>dfs.journalnode.edits.dir</name>
<value>/data/1/dfs/jn</value>
</property>
<!--配置客户端failover,解决客户端故障转移-->
<property>
<name>dfs.client.failover.proxy.provider.sdc</name>
<value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>file:///data/1/dfs/nn,/nfsmount/dfs/nn</value>
</property>
<!--配置:Fencing,
这里dfs.ha.fencing.methods实现的方法有两种sshfence和shell,我下面实现的是sshfence,dfs.ha.fencing.ssh.private-key-files这个是ssh的key file ,于在Active 节点切换期间的安全机制,确保在任何时间都只有一个NameNode 处于活跃状态。在故障切换期间,haadmin 命令确保在将其它NameNode 转换为Active 状态之前Active 节点处在Standby 状态,或其进程已被终止。
至少应该配置一个,因为没有默认配置,因此如果配置则HA 机制将会失效。
如果要实现自定义的安全机制,参照org.apache.hadoop.ha.NodeFencer
-->
<property>
<name>dfs.ha.fencing.methods</name>
<value>sshfence</value>
</property>
<property>
<name>dfs.ha.fencing.ssh.private-key-files</name>
<value>/home/cloud-user/.ssh/id_rsa</value>
</property>
<!--启用失败自动切换-->
<property>
<name>dfs.ha.automatic-failover.enabled</name>
<value>true</value>
</property>
<!--配置zk集群信息-->
<property>
<name>ha.zookeeper.quorum</name>
<value>datanode1:2181,datanode2:2181,datanode3:2181</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:///data/1/dfs/dn,/data/2/dfs/dn,/data/3/dfs/dn</value>
</property>
<property>
<name>dfs.webhdfs.enabled</name>
<value>true</value>
</property>
<property>
<name>dfs.ha.fencing.ssh.connect-timeout</name>
<value>10000</value>
</property>
mapred-site.xml:
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
<property>
<name>yarn.app.mapreduce.am.staging-dir</name>
<value>/user</value>
</property>
<property>
<name>mapreduce.jobhistory.address</name>
<value>namenode:10020</value>
</property>
<property>
<name>mapreduce.jobhistory.webapp.address</name>
<value>namenode:19888</value>
</property>
yarn-site.xml:
<property>
<name>yarn.resourcemanager.resource-tracker.address</name>
<value>namenode:8031</value>
</property>
<property>
<name>yarn.resourcemanager.address</name>
<value>namenode:8032</value>
</property>
<property>
<name>yarn.resourcemanager.scheduler.address</name>
<value>namenode:8030</value>
</property>
<property>
<name>yarn.resourcemanager.admin.address</name>
<value>namenode:8033</value>
</property>
<property>
<name>yarn.resourcemanager.webapp.address</name>
<value>namenode:8088</value>
</property>
<property>
<name>yarn.web-proxy.address</name>
<value>namenode:8100</value>
</property>
<property>
<description>Classpath for typical applications.</description>
<name>yarn.application.classpath</name>
<value>
$HADOOP_CONF_DIR,
$HADOOP_COMMON_HOME/*,$HADOOP_COMMON_HOME/lib/*,
$HADOOP_HDFS_HOME/*,$HADOOP_HDFS_HOME/lib/*,
$HADOOP_MAPRED_HOME/*,$HADOOP_MAPRED_HOME/lib/*,
$YARN_HOME/*,$YARN_HOME/lib/*
</value>
</property>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce.shuffle</value>
</property>
<property>
<name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>
<value>org.apache.hadoop.mapred.ShuffleHandler</value>
</property>
<property>
<name>yarn.nodemanager.local-dirs</name>
<value>file:///data/1/yarn/local,file:///data/2/yarn/local,file:///data/3/yarn/local</value>
</property>
<property>
<name>yarn.nodemanager.log-dirs</name>
<value>file:///data/1/yarn/logs,file:///data/2/yarn/logs,file:///data/3/yarn/logs</value>
</property>
<property>
<description>Where to aggregate logs</description>
<name>yarn.nodemanager.remote-app-log-dir</name>
<value>hdfs://var/log/hadoop-yarn/apps</value>
</property>
[ALL]:sudo mkdir -p /data/1/yarn/local /data/2/yarn/local /data/3/yarn/local /data/4/yarn/local && sudo mkdir -p /data/1/yarn/logs /data/2/yarn/logs /data/3/yarn/logs /data/4/yarn/logs && sudo chown -R yarn:yarn /data/1/yarn/local /data/2/yarn/local /data/3/yarn/local /data/4/yarn/local && sudo chown -R yarn:yarn /data/1/yarn/logs /data/2/yarn/logs /data/3/yarn/logs /data/4/yarn/logs
datanode:
sudo mkdir -p /data/1/dfs/jn && sudo chown -R hdfs:hdfs /data/1/dfs/jn
Namenode:
sudo mkdir -p /data/1/dfs/nn /nfsmount/dfs/nn && sudo chown -R hdfs:hdfs /data/1/dfs/nn /nfsmount/dfs/nn &&sudo chmod 700 /data/1/dfs/nn /nfsmount/dfs/nn
Datanode:
sudo mkdir -p /data/1/dfs/dn /data/2/dfs/dn /data/3/dfs/dn /data/4/dfs/dn && sudo chown -R hdfs:hdfs /data/1/dfs/dn /data/2/dfs/dn /data/3/dfs/dn /data/4/dfs/dn
tickTime=2000
dataDir=/var/lib/zookeeper/
clientPort=2181
initLimit=5
syncLimit=2
server.1=datanode1:2888:3888
server.2=datanode2:2888:3888
server.3=datanode3:2888:3888
配置id:
sudo echo 1 >
/var/lib/zookeeper/myid //仅在namenode1上执行
sudo
echo 2 > /var/lib/zookeeper/myid //仅namenode2上执行
sudo
echo 3 > /var/lib/zookeeper/myid //namenode3上执行
sudo
chown -R zookeeper:zookeeper /var/lib/zookeeper //在所有datanode上
启动zookeeper:
sudo
/usr/lib/zookeeper/bin/zkServer.sh start
查看状态:
sudo
/usr/lib/zookeeper/bin/zkServer.sh start
【原】centos6.5下hadoop cdh4.6 安装,布布扣,bubuko.com
标签:des style blog class code java
原文地址:http://www.cnblogs.com/yuandianliws/p/3716602.html