Hadoop3.1.1 集群安装

2018-08-21  本文已影响0人  xiao_kong

具体配置参照《大数据平台相关配置》一文

1. 环境初始化

systemctl stop firewalld.service #关闭防火墙
systemctl disable firewalld.service #关闭防火墙
timedatectl set-timezone Asia/Shanghai  #都要执行
hostnamectl set-hostname master   #master执行
hostnamectl set-hostname node1    #node1执行
hostnamectl set-hostname node2    #node2执行
vi /etc/hosts

192.169.0.104 master
192.169.0.105 node1
192.169.0.106 node2
export JAVA_HOME=/opt/apps/jdk1.8.0_181
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH

cd /usr/lib &&ln -s /opt/apps/hadoop-3.1.1 hadoop-current

# set the hadoop home
export HADOOP_HOME="/usr/lib/hadoop-current"
export HADOOP_MAPRED_HOME="/usr/lib/hadoop-current"
export HADOOP_PID_DIR="${HADOOP_HOME}/pids"
export YARN_PID_DIR=${HADOOP_PID_DIR}

# set hadoop log dir
export HADOOP_LOG_DIR="/data/bigdata/log/hadoop-hdfs"
export YARN_LOG_DIR="/data/bigdata/log/hadoop-yarn"
export HADOOP_MAPRED_LOG_DIR="/data/bigdata/log/hadoop-mapred"

if [[ -n $HADOOP_HOME ]]; then
  export PATH=$HADOOP_HOME/bin:$PATH
  export PATH=$HADOOP_HOME/sbin:$PATH
fi
mkdir -p /data/bigdata/log
chown hadoop:hadoop /data/bigdata/log -R
<configuration>
   <property>
       <name>fs.defaultFS</name>
       <value>hdfs://master:9000</value>
   </property>
   <property>
     <name>hadoop.proxyuser.hadoop.hosts</name>
     <value>*</value>
   </property>
   <property>
     <name>hadoop.proxyuser.hadoop.groups</name>
    <value>hadoop</value>
   </property>
</configuration>
无需修改
<configuration>
    <property>
        <name>mapreduce.framework.name</name>
        <value>yarn</value>
    </property>
    <property>
        <name>yarn.app.mapreduce.am.env</name>
        <value>HADOOP_MAPRED_HOME=/opt/apps/hadoop-3.1.1</value>
    </property>
    <property>
        <name>mapreduce.map.env</name>
        <value>HADOOP_MAPRED_HOME=/opt/apps/hadoop-3.1.1</value>
    </property>
    <property>
        <name>mapreduce.reduce.env</name>
        <value>HADOOP_MAPRED_HOME=/opt/apps/hadoop-3.1.1</value>
    </property>
</configuration>
<configuration>
    <property>
        <name>yarn.nodemanager.aux-services</name>
        <value>mapreduce_shuffle</value>
    </property>
    <property>
        <name>yarn.resourcemanager.hostname</name>
        <value>master</value>
    </property>
    <property>
        <name>yarn.nodemanager.resource.memory-mb</name>
        <value>2048</value>
    </property>
    <property>
        <name>yarn.nodemanager.resource.cpu-vcores</name>
        <value>1</value>
    </property>
    <property>
        <name>yarn.web-proxy.address</name>
        <value>master:9001</value>
    </property>
</configuration>

2.启动Hadoop集群

[hdfs]$ $HADOOP_HOME/bin/hdfs namenode -format <cluster_name>
[hdfs]$ $HADOOP_HOME/bin/hdfs --daemon start namenode
[hdfs]$ $HADOOP_HOME/bin/hdfs --daemon start datanode
[yarn]$ $HADOOP_HOME/bin/yarn --daemon start resourcemanager
[yarn]$ $HADOOP_HOME/bin/yarn --daemon start nodemanager
[yarn]$ $HADOOP_HOME/bin/yarn --daemon start proxyserver
[mapred]$ $HADOOP_HOME/bin/mapred --daemon start historyserver

访问:http://master:8088/cluster

上一篇下一篇

猜你喜欢

热点阅读