Hadoop配置文件与HBase配置文件压缩格式 Hadoop配置文件与HBase配置文件

Hadoop配置文件与HBase配置文件

本Hadoop与HBase集群有1台NameNode, 7台DataNode

1. /etc/hostname文件

 NameNode:

       node1

DataNode 1:

       node2

DataNode 2:

       node3

.......

DataNode 7:

       node8

2. /etc/hosts文件

NameNode:

         

[java]  view plain  copy
  1. 127.0.0.1   localhost  
  2. #127.0.1.1  node1  
  3. #-------edit by HY(2014-05-04)--------  
  4. #127.0.1.1  node1  
  5. 125.216.241.113 node1  
  6. 125.216.241.112 node2  
  7. 125.216.241.96 node3  
  8. 125.216.241.111 node4  
  9. 125.216.241.114 node5  
  10. 125.216.241.115 node6  
  11. 125.216.241.116 node7  
  12. 125.216.241.117 node8  
  13. #-------end edit--------  
  14.   
  15. # The following lines are desirable for IPv6 capable hosts  
  16. ::1     ip6-localhost ip6-loopback  
  17. fe00::0 ip6-localnet  
  18. ff00::0 ip6-mcastprefix  
  19. ff02::1 ip6-allnodes  
  20. ff02::2 ip6-allrouters  

DataNode 1:

[java]  view plain  copy
  1. 127.0.0.1   localhost  
  2. #127.0.0.1  node2  
  3. #127.0.1.1  node2  
  4. #--------eidt by HY(2014-05-04)--------  
  5. 125.216.241.113 node1  
  6. 125.216.241.112 node2  
  7. 125.216.241.96 node3  
  8. 125.216.241.111 node4  
  9. 125.216.241.114 node5  
  10. 125.216.241.115 node6  
  11. 125.216.241.116 node7  
  12. 125.216.241.117 node8  
  13. #-------end eidt---------  
  14.   
  15.   
  16. # The following lines are desirable for IPv6 capable hosts  
  17. ::1     ip6-localhost ip6-loopback  
  18. fe00::0 ip6-localnet  
  19. ff00::0 ip6-mcastprefix  
  20. ff02::1 ip6-allnodes  
  21. ff02::2 ip6-allrouters  

其他的DataNode类似,只是注意要保持hostname与hosts中的域名要一样, 如果不一样, 在集群上跑任务时会出一些莫名奇妙的问题, 具体什么问题忘记了.

3. 在hadoop-env.sh中注释

# export JAVA_HOME=/usr/lib/j2sdk1.5-sun

增加

JAVA_HOME=/usr/lib/jvm/java-6-sun

4. core-site.xml

[html]  view plain  copy
  1. <?xml version="1.0"?>  
  2. <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>  
  3.   
  4. <!-- Put site-specific property overrides in this file. -->  
  5.   
  6. <configuration>  
  7. <property>    
  8.  <name>fs.default.name</name>    
  9.   <value>hdfs://node1:49000</value>    
  10. </property>    
  11. <property>    
  12.   <name>hadoop.tmp.dir</name>    
  13.  <value>/home/hadoop/newdata/hadoop-1.2.1/tmp</value>    
  14. </property>   
  15. <property>  
  16. <name>io.compression.codecs</name>  
  17. <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</value>  
  18. </property>  
  19. <property>  
  20. <name>io.compression.codec.lzo.class</name>  
  21. <value>com.hadoop.compression.lzo.LzoCodec</value>  
  22. </property>  
  23.    <property>  
  24.      <name>dfs.datanode.socket.write.timeout</name>  
  25.      <value>3000000</value>  
  26.    </property>  
  27.    
  28.    <property>  
  29.      <name>dfs.socket.timeout</name>  
  30.      <value>3000000</value>  
  31.    </property>  
  32. </configuration>  

5. hdfs-site.xml

[html]  view plain  copy
  1. <?xml version="1.0"?>  
  2. <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>  
  3.   
  4. <!-- Put site-specific property overrides in this file. -->  
  5.   
  6. <configuration>  
  7. <property>    
  8. <name>dfs.name.dir</name>    
  9. <value>/home/hadoop/newdata/hadoop-1.2.1/name1,/home/hadoop/newdata/hadoop-1.2.1/name2</value>  
  10. <description>数据元信息存储位置</description>    
  11. </property>    
  12. <property>    
  13. <name>dfs.data.dir</name>    
  14. <value>/home/hadoop/newdata/hadoop-1.2.1/data1,/home/hadoop/newdata/hadoop-1.2.1/data2</value>    
  15. <description>数据块存储位置</description>    
  16. </property>    
  17. <property>    
  18.   <name>dfs.replication</name>    
  19.   <!-- 这里备份两份 -->    
  20.   <value>2</value>    
  21. </property>    
  22. </configuration>  

6. mapred-site.xml

[html]  view plain  copy
  1. <?xml version="1.0"?>  
  2. <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>  
  3.   
  4. <!-- Put site-specific property overrides in this file. -->  
  5.   
  6. <configuration>  
  7. <property>    
  8.   <name>mapred.job.tracker</name>    
  9.   <value>node1:49001</value>    
  10. </property>    
  11. <property>    
  12.   <name>mapred.local.dir</name>    
  13.  <value>/home/hadoop/newdata/hadoop-1.2.1/tmp</value>    
  14. </property>  
  15. <property>  
  16. <name>mapred.compress.map.output</name>  
  17. <value>true</value>  
  18. <!-- map 和 reduce 输出中间文件默认开启压缩 -->  
  19. </property>  
  20. <property>  
  21. <name>mapred.map.output.compression.codec</name>  
  22. <value>com.hadoop.compression.lzo.LzoCodec</value>  
  23. <!-- 使用 Lzo 库作为压缩算法 -->  
  24. </property>  
  25. </configuration>  


7. masters

[html]  view plain  copy
  1. node1  

8. slaves

[html]  view plain  copy
  1. node2  
  2. node3  
  3. node4  
  4. node5  
  5. node6  
  6. node7  
  7. node8  


9. 在hbase-env.sh

增加 

JAVA_HOME=/usr/lib/jvm/java-6-sun

并启用export HBASE_MANAGES_ZK=true //为true表示使用自带的Zookeeper, 如果需要独立的Zookeeper,则设置为false, 并且安装Zookeeper

10. hbase-site.xml

[html]  view plain  copy
  1. <?xml version="1.0"?>  
  2. <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>  
  3. <!--  
  4. /**  
  5.  *  
  6.  * Licensed to the Apache Software Foundation (ASF) under one  
  7.  * or more contributor license agreements.  See the NOTICE file  
  8.  * distributed with this work for additional information  
  9.  * regarding copyright ownership.  The ASF licenses this file  
  10.  * to you under the Apache License, Version 2.0 (the  
  11.  * "License"); you may not use this file except in compliance  
  12.  * with the License.  You may obtain a copy of the License at  
  13.  *  
  14.  *     http://www.apache.org/licenses/LICENSE-2.0  
  15.  *  
  16.  * Unless required by applicable law or agreed to in writing, software  
  17.  * distributed under the License is distributed on an "AS IS" BASIS,  
  18.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
  19.  * See the License for the specific language governing permissions and  
  20.  * limitations under the License.  
  21.  */  
  22. -->  
  23. <configuration>  
  24.     <property>  
  25.         <name>hbase.rootdir</name>  
  26.         <value>hdfs://node1:49000/hbase</value>  
  27.         <description>The directory shared by RegionServers.</description>  
  28.     </property>  
  29.   
  30.     <property>  
  31.         <name>hbase.cluster.distributed</name>  
  32.         <value>true</value>  
  33.         <description>The mode the cluster will be in. Possible values are  
  34.             false: standalone and pseudo-distributed setups with managed Zookeeper  
  35.             true: fully-distributed with unmanaged Zookeeper Quorum (see hbase-env.sh)  
  36.         </description>  
  37.     </property>  
  38.   
  39.     <property>  
  40.         <name>hbase.master</name>  
  41.         <value>node1:60000</value>  
  42.         <description>  
  43.         </description>  
  44.     </property>  
  45.   
  46.     <property>  
  47.         <name>hbase.tmp.dir</name>  
  48.         <value>/home/hadoop/newdata/hbase/tmp</value>  
  49.         <description>  
  50.             Temporary directory on the local filesystem.  
  51.             Change this setting to point to a location more permanent than '/tmp',  
  52.             the usual resolve for java.io.tmpdir,  
  53.             as the '/tmp' directory is cleared on machine restart.  
  54.             Default: ${java.io.tmpdir}/hbase-${user.name}  
  55.         </description>  
  56.     </property>  
  57.   
  58.     <property>  
  59.         <name>hbase.zookeeper.quorum</name>  
  60.         <value>node2,node3,node4,node5,node6,node7,node8</value>  
  61.         <description>  
  62.             要单数台,Comma separated list of servers in the ZooKeeper ensemble (This config.  
  63.             should have been named hbase.zookeeper.ensemble).  
  64.             For example, "host1.mydomain.com,host2.mydomain.com,host3.mydomain.com".  
  65.             By default this is set to localhost for local and pseudo-distributed  
  66.             modes of operation.  
  67.             For a fully-distributed setup,  
  68.             this should be set to a full list of ZooKeeper ensemble servers.  
  69.             If HBASE_MANAGES_ZK is set in hbase-env.sh this is the list of servers  
  70.             which hbase will start/stop ZooKeeper on as part of cluster start/stop.  
  71.             Client-side, we will take this list of ensemble members and put it  
  72.             together with the hbase.zookeeper.clientPort config.  
  73.             and pass it into zookeeper constructor as the connectString parameter.  
  74.             Default: localhost  
  75.         </description>  
  76.     </property>  
  77.   
  78.     <property>  
  79.         <name>hbase.zookeeper.property.dataDir</name>  
  80.         <value>/home/hadoop/newdata/zookeeper</value>  
  81.         <description>  
  82.             Property from ZooKeeper's config zoo.cfg.  
  83.             The directory where the snapshot is stored.  
  84.             Default: ${hbase.tmp.dir}/zookeeper  
  85.         </description>  
  86.     </property>  
  87.   
  88.     <property>  
  89.         <name></name>  
  90.         <value></value>  
  91.     </property>  
  92. </configuration>  


11. regionservers

[html]  view plain  copy
  1. node2  
  2. node3  
  3. node4  
  4. node5  
  5. node6  
  6. node7  
  7. node8  


每台机器配置都要一样

猜你喜欢

转载自blog.csdn.net/wangshuminjava/article/details/80589835