Shell脚本之——Hadoop3单机版安装

news2024/11/28 2:35:51

目录

1.解压

2.文件重命名

3.配置环境变量

4.hadoop-env.sh

5.core-site.xml

6. hdfs-site.xml

7. mapred-site.xml

8.yarn-site.xml

9.完整脚本代码(注意修改主机名)

10.重启环境变量

11.初始化

12.启动服务

13.jps查询节点


1.解压

tar -zxf /opt/install/hadoop-3.1.3.tar.gz -C /opt/soft/

2.文件重命名

mv /opt/soft/hadoop-3.1.3 /opt/soft/hadoop313

3.配置环境变量

  sed -i '73a\export HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop' /etc/profile
  sed -i '73a\export HADOOP_LIBEXEC_DIR=$HADOOP_HOME/libexec' /etc/profile
  sed -i '73a\export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native' /etc/profile
  sed -i '73a\export HADOOP_INSTALL=$HADOOP_HOME' /etc/profile
  sed -i '73a\export HADOOP_YARN_HOME=$HADOOP_HOME' /etc/profile
  sed -i '73a\export HADOOP_HDFS_HOME=$HADOOP_HOME' /etc/profile
  sed -i '73a\export HADOOP_COMMON_HOME=$HADOOP_HOME' /etc/profile
  sed -i '73a\export HADOOP_MAPRED_HOME=$HADOOP_HOME' /etc/profile
  sed -i '73a\export YARN_NODEMANAGER_USER=root' /etc/profile
  sed -i '73a\export YARN_RESOURCEMANAGER_USER=root' /etc/profile
  sed -i '73a\export HDFS_ZKFC_USER=root' /etc/profile
  sed -i '73a\export HDFS_JOURNALNODE_USER=root' /etc/profile
  sed -i '73a\export HDFS_SECONDARYNAMENODE_USER=root' /etc/profile
  sed -i '73a\export HDFS_DATANODE_USER=root' /etc/profile
  sed -i '73a\export HDFS_NAMENODE_USER=root' /etc/profile
  sed -i '73a\export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$HADOOP_HOME/lib' /etc/profile
  sed -i '73a\export HADOOP_HOME=/opt/soft/hadoop313' /etc/profile
  sed -i '73a\#HADOOP_HOME' /etc/profile

4.hadoop-env.sh

#hadoop-env.sh
  sed -i '53a\export JAVA_HOME=/opt/soft/jdk180'  /opt/soft/hadoop313/etc/hadoop/hadoop-env.sh

5.core-site.xml

#core-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <value>*</value>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <name>hadoop.proxyuser.root.groups</name>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <value>*</value>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <name>hadoop.proxyuser.root.hosts</name>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <description>读写队列缓存:128k</description>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <value>131072</value>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <name>io.file.buffer.size</name>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <value>root</value>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <name>hadoop.http.staticuser.user</name>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <description>namenode上本地的hadoop临时文件夹</description>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <value>/opt/soft/hadoop313/data</value>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <name>hadoop.tmp.dir</name>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <value>hdfs://cp145:9000</value>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <name>fs.defaultFS</name>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/core-site.xml

6. hdfs-site.xml

#hdfs-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\    <description>关闭权限验证</description>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\    <value>false</value>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\    <name>dfs.permissions.enabled</name>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\    <description>datanode上数据块的物理存储位置目录</description>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\    <value>/opt/soft/hadoop313/data/dfs/data</value>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\    <name>dfs.datanode.data.dir</name>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\    <description>namenode上存储hdfsq名字空间元数据的目录</description>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\    <value>/opt/soft/hadoop313/data/dfs/name</value>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\    <name>dfs.namenode.name.dir</name>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\    <description>hadoop中每一个block文件的备份数量</description>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\    <value>1</value>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\    <name>dfs.replication</name>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml

7. mapred-site.xml

#mapred-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\    <value>1024</value>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\    <name>mapreduce.reduce.memory.mb</name>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\    <value>1024</value>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\    <name>mapreduce.map.memory.mb</name>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\    <value>cp145:19888</value>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\    <name>mapreduce.jobhistory.webapp.address</name>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\    <value>cp145:10020</value>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\    <name>mapreduce.jobhistory.address</name>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\    <value>/opt/soft/hadoop313/etc/hadoop:/opt/soft/hadoop313/share/hadoop/common/lib/*:/opt/soft/hadoop313/share/hadoop/common/*:/opt/soft/hadoop313/share/hadoop/hdfs/*:/opt/soft/hadoop313/share/hadoop/hdfs/lib/*:/opt/soft/hadoop313/share/hadoop/mapreduce/*:/opt/soft/hadoop313/share/hadoop/mapreduce/lib/*:/opt/soft/hadoop313/share/hadoop/yarn/*:/opt/soft/hadoop313/share/hadoop/yarn/lib/*</value>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\   <name>mapreduce.application.classpath</name>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\    <final>true</final>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\    <description>job执行框架:local,classic or yarn</description>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\    <value>yarn</value>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\    <name>mapreduce.framework.name</name>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml

8.yarn-site.xml

  #yarn-site.xml
  sed -i '17a\  </property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <value>/opt/soft/hadoop313/yarndata/log</value>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <name>yarn.nodemanager.log-dirs</name>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  <property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  </property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <value>/opt/soft/hadoop313/yarndata/yarn</value>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <name>yarn.nodemanager.local-dirs</name>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  <property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  </property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <value>mapreduce_shuffle</value>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <name>yarn.nodemanager.aux-services</name>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  <property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  </property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <value>cp145:8042</value>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <name>yarn.nodemanager.webapp.address</name>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  <property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  </property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <value>cp145:8050</value>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <name>yarn.nodemanager.address</name>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  <property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  </property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <value>cp145:8040</value>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <name>yarn.nodemanager.localizer.address</name>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  <property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  </property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <value>org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler</value>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <name>yarn.resourcemanager.scheduler.class</name>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  <property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  </property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <value>20000</value>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <name>yarn.resourcemanager.connect.retry-interval.ms</name>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  <property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml

9.完整脚本代码(注意修改主机名)

#! /bin/bash
echo 'auto install hadoop begining....'

#global var
hadoop=true

if [ "$hadoop" = true ];then
  echo 'hadoop install set true'
  echo 'setup hadoop 3'
  tar -zxf /opt/install/hadoop-3.1.3.tar.gz -C /opt/soft/
  mv /opt/soft/hadoop-3.1.3 /opt/soft/hadoop313
  sed -i '73a\export HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop' /etc/profile
  sed -i '73a\export HADOOP_LIBEXEC_DIR=$HADOOP_HOME/libexec' /etc/profile
  sed -i '73a\export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native' /etc/profile
  sed -i '73a\export HADOOP_INSTALL=$HADOOP_HOME' /etc/profile
  sed -i '73a\export HADOOP_YARN_HOME=$HADOOP_HOME' /etc/profile
  sed -i '73a\export HADOOP_HDFS_HOME=$HADOOP_HOME' /etc/profile
  sed -i '73a\export HADOOP_COMMON_HOME=$HADOOP_HOME' /etc/profile
  sed -i '73a\export HADOOP_MAPRED_HOME=$HADOOP_HOME' /etc/profile
  sed -i '73a\export YARN_NODEMANAGER_USER=root' /etc/profile
  sed -i '73a\export YARN_RESOURCEMANAGER_USER=root' /etc/profile
  sed -i '73a\export HDFS_ZKFC_USER=root' /etc/profile
  sed -i '73a\export HDFS_JOURNALNODE_USER=root' /etc/profile
  sed -i '73a\export HDFS_SECONDARYNAMENODE_USER=root' /etc/profile
  sed -i '73a\export HDFS_DATANODE_USER=root' /etc/profile
  sed -i '73a\export HDFS_NAMENODE_USER=root' /etc/profile
  sed -i '73a\export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$HADOOP_HOME/lib' /etc/profile
  sed -i '73a\export HADOOP_HOME=/opt/soft/hadoop313' /etc/profile
  sed -i '73a\#HADOOP_HOME' /etc/profile
  
  #hadoop-env.sh
  sed -i '53a\export JAVA_HOME=/opt/soft/jdk180'  /opt/soft/hadoop313/etc/hadoop/hadoop-env.sh

  #core-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <value>*</value>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <name>hadoop.proxyuser.root.groups</name>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <value>*</value>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <name>hadoop.proxyuser.root.hosts</name>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <description>读写队列缓存:128k</description>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <value>131072</value>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <name>io.file.buffer.size</name>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <value>root</value>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <name>hadoop.http.staticuser.user</name>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <description>namenode上本地的hadoop临时文件夹</description>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <value>/opt/soft/hadoop313/data</value>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <name>hadoop.tmp.dir</name>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <value>hdfs://cp145:9000</value>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\    <name>fs.defaultFS</name>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/core-site.xml
  
  #hdfs-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\    <description>关闭权限验证</description>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\    <value>false</value>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\    <name>dfs.permissions.enabled</name>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\    <description>datanode上数据块的物理存储位置目录</description>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\    <value>/opt/soft/hadoop313/data/dfs/data</value>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\    <name>dfs.datanode.data.dir</name>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\    <description>namenode上存储hdfsq名字空间元数据的目录</description>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\    <value>/opt/soft/hadoop313/data/dfs/name</value>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\    <name>dfs.namenode.name.dir</name>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\    <description>hadoop中每一个block文件的备份数量</description>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\    <value>1</value>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\    <name>dfs.replication</name>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/hdfs-site.xml
  
  #mapred-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\    <value>1024</value>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\    <name>mapreduce.reduce.memory.mb</name>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\    <value>1024</value>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\    <name>mapreduce.map.memory.mb</name>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\    <value>cp145:19888</value>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\    <name>mapreduce.jobhistory.webapp.address</name>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\    <value>cp145:10020</value>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\    <name>mapreduce.jobhistory.address</name>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\    <value>/opt/soft/hadoop313/etc/hadoop:/opt/soft/hadoop313/share/hadoop/common/lib/*:/opt/soft/hadoop313/share/hadoop/common/*:/opt/soft/hadoop313/share/hadoop/hdfs/*:/opt/soft/hadoop313/share/hadoop/hdfs/lib/*:/opt/soft/hadoop313/share/hadoop/mapreduce/*:/opt/soft/hadoop313/share/hadoop/mapreduce/lib/*:/opt/soft/hadoop313/share/hadoop/yarn/*:/opt/soft/hadoop313/share/hadoop/yarn/lib/*</value>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\   <name>mapreduce.application.classpath</name>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\  </property>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\    <final>true</final>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\    <description>job执行框架:local,classic or yarn</description>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\    <value>yarn</value>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\    <name>mapreduce.framework.name</name>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  sed -i '19a\  <property>' /opt/soft/hadoop313/etc/hadoop/mapred-site.xml
  
  #yarn-site.xml
  sed -i '17a\  </property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <value>/opt/soft/hadoop313/yarndata/log</value>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <name>yarn.nodemanager.log-dirs</name>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  <property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  </property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <value>/opt/soft/hadoop313/yarndata/yarn</value>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <name>yarn.nodemanager.local-dirs</name>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  <property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  </property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <value>mapreduce_shuffle</value>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <name>yarn.nodemanager.aux-services</name>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  <property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  </property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <value>cp145:8042</value>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <name>yarn.nodemanager.webapp.address</name>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  <property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  </property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <value>cp145:8050</value>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <name>yarn.nodemanager.address</name>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  <property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  </property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <value>cp145:8040</value>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <name>yarn.nodemanager.localizer.address</name>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  <property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  </property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <value>org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler</value>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <name>yarn.resourcemanager.scheduler.class</name>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  <property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  </property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <value>20000</value>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\    <name>yarn.resourcemanager.connect.retry-interval.ms</name>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml
  sed -i '17a\  <property>' /opt/soft/hadoop313/etc/hadoop/yarn-site.xml

  echo 'setup hadoop 3 success!!!'
fi

10.重启环境变量

[root@lxm148 opt]# source /etc/profile

11.初始化

[root@lxm148 yarndata]# hdfs namenode -format

12.启动服务

[root@lxm148 yarndata]# start-all.sh

13.jps查询节点

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/335822.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【速通版】吴恩达机器学习笔记Part3

目录 1.多元线性回归 a.特征缩放 可行的缩放方式&#xff1a; 1.除以最大值&#xff1a; 2.mean normalization&#xff1a; 3.Z-score normalization b.learning curve: c.learning rate: 2.多项式回归 3.classification logistics regression 1.多元线性回归 其意义很…

UML术语标准和分类

一、UML术语标准 1&#xff0e;中文UML术语标准 中国软件行业协会&#xff08;CSIA&#xff09;与日本UML建模推进协会&#xff08;UMTP&#xff09;共同在中国推动的UML专家认证&#xff0c;两个协会共同颁发认证证书、两国互认&#xff0c;CSIA与UMTP共同推出了UML中文术语…

(record)QEMU安装最小linux系统——TinyCore(命令行版)

文章目录QEMU安装最小linux系统——TinyCore参考QEMU使用qemu创建tinycore虚拟机再次启动文件保存QEMU安装最小linux系统——TinyCore 简单记录安装过程和记录点 参考 [原创] qemu 与 Tiny Core tinycore的探索 QEMU qemu不多介绍&#xff0c;这里是在WSL2上安装的linux版…

最近很火的一部电视(狂飙)像安欣和高启强这样类型的人,谁更合适做软件测试工程师

狂飙》央视收视率狂飙。央视发布《狂飙》收视成绩&#xff0c;全剧平均收视1.54%&#xff0c;平均收视份额6.99%&#xff0c;单集最高收视率2.20%&#xff0c;单集最高收视份额10.69%&#xff1b;晚间电视剧类节目第一。可以说还部剧为今年开了个好头&#xff0c;一开年就引爆收…

财报解读:四季度营收超预期,优步却越来越“不务正业”了

“公司第四季度的业绩表现将是强劲的”。 公布2022年第三季度财报时&#xff0c;优步的高管给出了这样的预告&#xff0c;给资本市场打了一针“强心剂”。然而有人对此表示质疑&#xff0c;后疫情时代&#xff0c;带着新模式、新车型的全新网约车公司层出不穷&#xff0c;车企…

Java面试数据库

目录 一、关系型数据库 数据库权限 表设计及创建 表数据相关 数据库架构优化 二、非关系型数据库 redis 今天给大家稍微整理了一下&#xff0c;内容有数据表设计的三大范式原则、sql查询如何优化、redis数据的击穿、穿透、雪崩等...&#xff0c;以及相关的面试题&#xff0…

Intel中断体系(1)中断与异常处理

文章目录概述中断与异常中断可屏蔽中断与不可屏蔽中断&#xff08;NMI&#xff09;异常异常分类中断与异常向量中断描述符表中断描述符中断与异常处理中断与异常处理过程堆栈切换错误码64位模式下的中断异常处理64位中断描述符64位处理器下的堆栈切换相关参考概述 中断是现代计…

不用创建项目,直接在 VS 里快速测试 C/C++ 代码

概述 Visual Studio 强大、方便&#xff0c;但是每次写代码都要先创建新项目&#xff0c;这对于一些简单的代码测试来说有点不方便。 本文介绍一种使用 VS 快速测试代码的方法。 该方法适用任何版本的 VS。“不用创建项目”&#xff0c;是指不用“手工”创建项目&#xff0c…

Python Scrapy 爬虫简单教程

1. Scrapy install 准备知识 pip 包管理Python 安装XpathCssWindows安装 Scrapy $>- pip install scrapy Linux安装 Scrapy $>- apt-get install python-scrapy 2. Scrapy 项目创建 在开始爬取之前&#xff0c;必须创建一个新的Scrapy项目。进入自定义的项目目录中&am…

爆火出圈的ChatGPT,真的那么好用吗?

近期&#xff0c;ChatGPT在互联网行业爆火&#xff01; 这个由人工智能研究和部署公司OpenAI开发的“交互机器人”&#xff0c;在今年1月其全球月活跃用户已达1亿&#xff0c;成为史上用户增长速度最快的消费级应用。 爆火的ChatGPT到底是什么&#xff1f; ChatGPT是一个原型人…

Java程序的执行顺序、简述对线程池的理解

点个关注&#xff0c;必回关 文章目录一、Java程序是如何执行的二、合理利用线程池能够带来三个好处一、Java程序是如何执行的 我们日常的工作中都使用开发工具&#xff08;IntelliJ IDEA 或 Eclipse 等&#xff09;可以很方便的调试程序&#xff0c;或者是通 过打包工具把项目…

删除Node.js,安装nvm,看这一篇就够了(有坑)

nvm的作用就是可以任意切换Node.js的版本&#xff0c;所以在下载nvm之前&#xff0c;现将系统中的Node.js全部删除&#xff0c;若之前没有安装过&#xff0c;可忽略第一步。 删除Node.js 一、程序和功能处找到Node.js,并删除 二、删除Node.js相关的目录文件 C:\Program Fil…

Science:北京脑研究中心李莹实验室揭示性满足感的分子机制

短暂的社交经历&#xff08;例如&#xff0c;性经历&#xff09;可导致内部状态的长期变化并影响社会行为&#xff0c;如交配、攻击。例如&#xff0c;在成功交配射精后&#xff0c;许多物种迅速表现出对交配倾向的抑制有数小时、数天或更长时间&#xff0c;这种效应称为性满足…

【报复性赚钱】2023年5大风口行业

今天就来和大家分享一下&#xff0c;在时代的洪流下&#xff0c;普通人如何顺应大势抓住机遇&#xff01; 实现人在风口上&#xff0c;猪都会飞起来。 根据对市场的观察及各平台数据分析结果&#xff0c;结合国家政策和经济专家的分析&#xff0c;小编预测了2023年将会迎来大…

“1+1>2”!《我要投资》与天际汽车再度“双向奔赴”!

文|螳螂观察 作者| 图霖 胡海泉老师重磅回归、创始人现场真情告白……新一季的《我要投资》&#xff0c;不仅维持了往季在专业度上的高水准&#xff0c;也贡献了不少高话题度的“出圈”时刻。 在竞争激烈的的综艺节目竞技场&#xff0c;能举办数季的节目&#xff0c;往往都是…

Linux修改文件时间或创建新文件:touch

每个文件在Linux下面都记录了许多的时间参数&#xff0c;其实是三个主要的变动时间 修改时间&#xff08;modification time&#xff0c;mtime&#xff09;&#xff1a;当该文件的【内容数据】变更时&#xff0c;就会更新这个时间&#xff0c;内容数据是指文件的内容&#xff…

Zabbix 构建监控告警平台(一)--部署安装

监控对象监控收集信息方式Zabbix 部署 1.监控对象 源代码: *.html *.jsp *.php *.py 数据库&#xff1a; MySQL,MariaDB,Oracle,SQL Server,DB2 应用软件&#xff1a;Nginx,Apache,PHP,Tomcat agent 集群&#xff1a; LVS,Keepalived,HAproxy…

期望风险, 经验风险和结构风险

经验风险模型关于所有训练集上的平均损失称为经验风险或经验损失.公式如下:至此, 我们通过计算单点误差损失的平均值来衡量(刻画)模型对训练集拟合的好坏, 但是我们如何衡量模型对未知数据的拟合能力呢, 也就是如何衡量模型在全体数据集上的性能, 因此我们引入概率论中两个随机…

终于周末啦,继续来总结一下Python的一些知识点啦

目录 Python概念梳理 常见概念梳理 Python经典判断题 判断题 选择题 Python概念梳理 常见概念梳理 Python中&#xff0c;不仅仅变量的值是可以变化的&#xff0c;类型也是可以随时变化的 1、Python的变量必须初始化否则提示 is not defined 2、if、while中定义的变量在…

【C++】static成员

&#x1f499;作者&#xff1a;阿润菜菜 &#x1f4d6;专栏&#xff1a;C 目录 概念 特性 出个题 概念 声明为static的类成员称为类的静态成员&#xff0c;用static修饰的成员变量&#xff0c;称之为静态成员变量&#xff1b; 用static修饰的成员函数&#xff0c;称之为静态…