Hadoop集群搭建

hadoop集群搭建

  • centos安装、网络配置
  • java安装

1
2
3
4
#vi ~/.bashrc
export JAVA_HOME=/usr/local/src/jdk1.6.0_45
export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib
export PATH=$PATH:$JAVA_HOME/bin
  • hadoop安装配置
  • 解压安装包tar -zxvf hadoop-1.2.1-bin.tar.gz
  • 配置
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    cd /usr/local/src/hadoop-1.2.1/conf
    # vi masters
    master
    # vi slaves
    slave1
    slave2
    # vi core-site.xml
    <configuration>
    <property>
    <name>hadoop.tmp.dir</name>
    <value>/usr/local/src/hadoop-1.2.1/temp</value>
    </property>
    <property>
    <name>fs.default.name</name>
    <value>hdfs://192.168.177.10:9000</value>
    </property>
    </configuration>
    # vi mapred-site.xml
    <configuration>
    <property>
    <name>mapred.job.tracker</name>
    <value>http://192.168.177.10:9001</value>
    </property>
    </oonfiguratiot>
    # vi hdfs-site.xml
    <property>
    <name>dfs.replication</name>
    <value>3</value>
    </property>
    </configuration>
    # vi hadoop-env.sh
    export JAVA_HOME=/usr/local/src/jdk1.6.0_45
    # vi /etc/sysconfig/network
    NETWORKING=yes
    HOSTNAME=master

  • 网络设置
    1
    2
    3
    service iptables stop
    setenforce 0
    getenforce
  • 启动
    1
    2
    3
    4
    5
    6
    7
    ./hadoop namenode -format
    ./start-all.sh ## 启动
    jps ## 查看启动

    ./hadoop fs -ls / ## 查看集群文件
    ./hadoop fs -put /etc/passwd / ## 上传文件测试
    ./hadoop fs -ls / ## 查看上传多出文件