app开发者平台在数字化时代的重要性与发展趋势解析
896
2022-10-09
3.4实训任务 Hadoop环境搭建与安装
一、官网-Hadoop
Apache Hadoop:/home/bigdata/Opt
②解压hadoop-2.10.1.tar.gz到当前文件目录
tar -zxvf hadoop-2.10.1.tar.gz
解压后的文件目录:
三、配置Hadoop
首先,由于Hadoop是Java进程,所以需要添加JDK。配置Hadoop前要先安装JDK,
1、Hadoop伪分布式安装,先找到配置文件路径
2、修改 core-site.xml 配置文件
输入命令:
vim /home/bigdata/Opt/hadoop-2.10.1/etc/hadoop/core-site.xml
在core-site.xml 中增加配置信息:
需要注意的是配置文件中原本就有
ESC 退出编辑后,输入 :wq
3、修改 hadoop-env.sh 文件配置Hadoop运行环境,用来定义Java环境变量。
输入命令:
vim /home/bigdata/Opt/hadoop-2.10.1/etc/hadoop/hadoop-env.sh
输入下图中配置信息【路径和文件名对应你自己的哈】:
配置信息输入完后,按ESC键,然后 :wq 保存并退出
4、修改hdfs-site.xml文件来配置HDFS
vim /home/bigdata/Opt/hadoop-2.10.1/etc/hadoop/hdfs-site.xml
按 ESC 退出编辑后,输入 :wq
5、修改配置 mapred-site.xml 文件来配置MapReduce 参数
①由于 /home/bigdata/Opt/hadoop-2.10.1/etc/hadoop 目录下只有/mapred-site.xml.template文件
② 下面我们 复制 mapred-site.xml.template 文件生成mapred-site.xml 文件
输入命令:
scp mapred-site.xml.template mapred-site.xml
③修改 mapred-site.xml 配置信息,指明Hadoop的MR将来运行于YARN资源调度系统上
vim /home/bigdata/Opt/hadoop-2.10.1/etc/hadoop/mapred-site.xml
按 ESC 退出编辑后,输入 :wq
6、配置 yarn-site.xml 文件,用于配置集群资源管理系统参数
vim /home/bigdata/Opt/hadoop-2.10.1/etc/hadoop/yarn-site.xml
按 ESC 退出编辑后,输入 :wq
7、配置Hadoop环境变量
需要先使用root权限,使用root登录
su root
输入命令:
vim /etc/profile
#set hadoop enviromentexport HADOOP_HOME=/home/bigdata/Opt/hadoop-2.10.1export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin:$HADOOP_HOME/sbin:$HADOOP_HOME/bin
按 ESC 退出编辑后,输入 :wq
8、刷新配置
输入命令:
source /etc/profile
9、配置完成后,执行 NameNode 的格式化
进入 /home/bigdata/Opt/hadoop-2.10.1/sbin 目录
cd /home/bigdata/Opt/hadoop-2.10.1/sbin
执行命令:
hdfs namenode -format
[root@localhost hadoop]# cd /home/bigdata/Opt/hadoop-2.10.1/sbin[root@localhost sbin]# hdfs namenode -format22/04/24 10:03:35 INFO namenode.NameNode: STARTUP_MSG: /************************************************************STARTUP_MSG: Starting NameNodeSTARTUP_MSG: host = localhost/127.0.0.1STARTUP_MSG: args = [-format]STARTUP_MSG: version = 2.10.1STARTUP_MSG: classpath = /home/bigdata/Opt/hadoop-2.10.1/etc/hadoop:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/commons-collections-3.2.2.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/servlet-api-2.5.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/jetty-6.1.26.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/jetty-util-6.1.26.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/jetty-sslengine-6.1.26.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/jsp-api-2.1.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/jersey-core-1.9.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/jersey-json-1.9.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/jettison-1.1.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/jaxb-impl-2.2.3-1.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/jaxb-api-2.2.2.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/stax-api-1.0-2.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/activation-1.1.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/jackson-core-asl-1.9.13.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/jackson-mapper-asl-1.9.13.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/jackson-jaxrs-1.9.13.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/jackson-xc-1.9.13.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/jersey-server-1.9.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/asm-3.2.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/log4j-1.2.17.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/jets3t-0.9.0.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/java-xmlbuilder-0.4.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/commons-lang-2.6.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/commons-configuration-1.6.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/commons-digester-1.8.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/commons-beanutils-1.9.4.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/commons-lang3-3.4.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/slf4j-api-1.7.25.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/avro-1.7.7.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/paranamer-2.3.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/snappy-java-1.0.5.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/commons-compress-1.19.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/protobuf-java-2.5.0.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/gson-2.2.4.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/hadoop-auth-2.10.1.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/nimbus-jose-jwt-7.9.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/jcip-annotations-1.0-1.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/json-smart-1.3.1.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/apacheds-kerberos-codec-2.0.0-M15.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/apacheds-i18n-2.0.0-M15.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/api-asn1-api-1.0.0-M20.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/api-util-1.0.0-M20.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/zookeeper-3.4.14.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/spotbugs-annotations-3.1.9.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/audience-annotations-0.5.0.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/netty-3.10.6.Final.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/curator-framework-2.13.0.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/curator-client-2.13.0.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/jsch-0.1.55.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/curator-recipes-2.13.0.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/htrace-core4-4.1.0-incubating.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/stax2-api-3.1.4.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/woodstox-core-5.0.3.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/junit-4.11.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/hamcrest-core-1.3.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/mockito-all-1.8.5.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/hadoop-annotations-2.10.1.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/guava-11.0.2.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/jsr305-3.0.2.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/commons-cli-1.2.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/commons-math3-3.1.1.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/xmlenc-0.52.jar:/home/bigdata/Opt/hadoop-2.10.1/share/hadoop/common/lib/ build = -r 1827467c9a56f133025f28557bfc2c562d78e816; compiled by 'centos' on 2020-09-14T13:17ZSTARTUP_MSG: java = 1.8.0_331************************************************************/22/04/24 10:03:35 INFO namenode.NameNode: registered UNIX signal handlers for [TERM, HUP, INT]22/04/24 10:03:35 INFO namenode.NameNode: createNameNode [-format]Formatting using clusterid: CID-b591d3f7-fbc8-4c53-84df-5b3722ef045622/04/24 10:03:36 INFO namenode.FSEditLog: Edit logging is async:true22/04/24 10:03:36 INFO namenode.FSNamesystem: KeyProvider: null22/04/24 10:03:36 INFO namenode.FSNamesystem: fsLock is fair: true22/04/24 10:03:36 INFO namenode.FSNamesystem: Detailed lock hold time metrics enabled: false22/04/24 10:03:36 INFO namenode.FSNamesystem: fsOwner = root (auth:SIMPLE)22/04/24 10:03:36 INFO namenode.FSNamesystem: supergroup = supergroup22/04/24 10:03:36 INFO namenode.FSNamesystem: isPermissionEnabled = true22/04/24 10:03:36 INFO namenode.FSNamesystem: HA Enabled: false22/04/24 10:03:36 INFO common.Util: dfs.datanode.fileio.profiling.sampling.percentage set to 0. Disabling file IO profiling22/04/24 10:03:36 INFO blockmanagement.DatanodeManager: dfs.block.invalidate.limit: configured=1000, counted=60, effected=100022/04/24 10:03:36 INFO blockmanagement.DatanodeManager: dfs.namenode.datanode.registration.ip-hostname-check=true22/04/24 10:03:36 INFO blockmanagement.BlockManager: dfs.namenode.startup.delay.block.deletion.sec is set to 000:00:00:00.00022/04/24 10:03:36 INFO blockmanagement.BlockManager: The block deletion will start around 2022 Apr 24 10:03:3622/04/24 10:03:36 INFO util.GSet: Computing capacity for map BlocksMap22/04/24 10:03:36 INFO util.GSet: VM type = 64-bit22/04/24 10:03:36 INFO util.GSet: 2.0% max memory 889 MB = 17.8 MB22/04/24 10:03:36 INFO util.GSet: capacity = 2^21 = 2097152 entries22/04/24 10:03:36 INFO blockmanagement.BlockManager: dfs.block.access.token.enable=false22/04/24 10:03:36 WARN conf.Configuration: No unit for dfs.heartbeat.interval(3) assuming SECONDS22/04/24 10:03:36 WARN conf.Configuration: No unit for dfs.namenode.safemode.extension(30000) assuming MILLISECONDS22/04/24 10:03:36 INFO blockmanagement.BlockManagerSafeMode: dfs.namenode.safemode.threshold-pct = 0.999000012874603322/04/24 10:03:36 INFO blockmanagement.BlockManagerSafeMode: dfs.namenode.safemode.min.datanodes = 022/04/24 10:03:36 INFO blockmanagement.BlockManagerSafeMode: dfs.namenode.safemode.extension = 3000022/04/24 10:03:36 INFO blockmanagement.BlockManager: defaultReplication = 122/04/24 10:03:36 INFO blockmanagement.BlockManager: maxReplication = 51222/04/24 10:03:36 INFO blockmanagement.BlockManager: minReplication = 122/04/24 10:03:36 INFO blockmanagement.BlockManager: maxReplicationStreams = 222/04/24 10:03:36 INFO blockmanagement.BlockManager: replicationRecheckInterval = 300022/04/24 10:03:36 INFO blockmanagement.BlockManager: encryptDataTransfer = false22/04/24 10:03:36 INFO blockmanagement.BlockManager: maxNumBlocksToLog = 100022/04/24 10:03:36 INFO namenode.FSNamesystem: Append Enabled: true22/04/24 10:03:36 INFO namenode.FSDirectory: GLOBAL serial map: bits=24 maxEntries=1677721522/04/24 10:03:36 INFO util.GSet: Computing capacity for map INodeMap22/04/24 10:03:36 INFO util.GSet: VM type = 64-bit22/04/24 10:03:36 INFO util.GSet: 1.0% max memory 889 MB = 8.9 MB22/04/24 10:03:36 INFO util.GSet: capacity = 2^20 = 1048576 entries22/04/24 10:03:36 INFO namenode.FSDirectory: ACLs enabled? false22/04/24 10:03:36 INFO namenode.FSDirectory: XAttrs enabled? true22/04/24 10:03:36 INFO namenode.NameNode: Caching file names occurring more than 10 times22/04/24 10:03:36 INFO snapshot.SnapshotManager: Loaded config captureOpenFiles: falseskipCaptureAccessTimeOnlyChange: false22/04/24 10:03:36 INFO util.GSet: Computing capacity for map cachedBlocks22/04/24 10:03:36 INFO util.GSet: VM type = 64-bit22/04/24 10:03:36 INFO util.GSet: 0.25% max memory 889 MB = 2.2 MB22/04/24 10:03:36 INFO util.GSet: capacity = 2^18 = 262144 entries22/04/24 10:03:36 INFO metrics.TopMetrics: NNTop conf: dfs.namenode-.window.num.buckets = 1022/04/24 10:03:36 INFO metrics.TopMetrics: NNTop conf: dfs.namenode-.num.users = 1022/04/24 10:03:36 INFO metrics.TopMetrics: NNTop conf: dfs.namenode-.windows.minutes = 1,5,2522/04/24 10:03:36 INFO namenode.FSNamesystem: Retry cache on namenode is enabled22/04/24 10:03:36 INFO namenode.FSNamesystem: Retry cache will use 0.03 of total heap and retry cache entry expiry time is 600000 millis22/04/24 10:03:36 INFO util.GSet: Computing capacity for map NameNodeRetryCache22/04/24 10:03:36 INFO util.GSet: VM type = 64-bit22/04/24 10:03:36 INFO util.GSet: 0.029999999329447746% max memory 889 MB = 273.1 KB22/04/24 10:03:36 INFO util.GSet: capacity = 2^15 = 32768 entries22/04/24 10:03:36 INFO namenode.FSImage: Allocated new BlockPoolId: BP-1974055419-127.0.0.1-165081981648122/04/24 10:03:36 INFO common.Storage: Storage directory /home/bigdata/Opt/hadoop-2.10.1/tmp/dfs/name has been successfully formatted.22/04/24 10:03:36 INFO namenode.FSImageFormatProtobuf: Saving image file /home/bigdata/Opt/hadoop-2.10.1/tmp/dfs/name/current/fsimage.ckpt_0000000000000000000 using no compression22/04/24 10:03:36 INFO namenode.FSImageFormatProtobuf: Image file /home/bigdata/Opt/hadoop-2.10.1/tmp/dfs/name/current/fsimage.ckpt_0000000000000000000 of size 323 bytes saved in 0 seconds .22/04/24 10:03:36 INFO namenode.NNStorageRetentionManager: Going to retain 1 images with txid >= 022/04/24 10:03:36 INFO namenode.FSImage: FSImageSaver clean checkpoint: txid = 0 when meet shutdown.22/04/24 10:03:36 INFO namenode.NameNode: SHUTDOWN_MSG: /************************************************************SHUTDOWN_MSG: Shutting down NameNode at localhost/127.0.0.1************************************************************/
10、开启所有服务
进入 /home/bigdata/Opt/hadoop-2.10.1/sbin 目录
cd /home/bigdata/Opt/hadoop-2.10.1/sbin
执行命令:
./start-all.sh
通过 jps 命令来查看所有服务是否启动
11、开启NameNode和DataNode
进入 /home/bigdata/Opt/hadoop-2.10.1/sbin 目录
cd /home/bigdata/Opt/hadoop-2.10.1/sbin
执行命令:
./start-dfs.sh
12、Hadoop中HDFS还提供Web访问页面,默认端口 50070,通过HTTP协议访问
端口 用途 || 9000 | fs.defaultFS,如:hdfs://172.25.40.171:9000 || 9001 | dfs.namenode.rpc-address,DataNode会连接这个端口 || 50070 | dfs.namenode.|| 50470 | dfs.namenode.|| 50100 | dfs.namenode.backup.address || 50105 | dfs.namenode.backup.|| 50090 | dfs.namenode.secondary.|| 50091 | dfs.namenode.secondary.|| 50020 | dfs.datanode.ipc.address || 50075 | dfs.datanode.|| 50475 | dfs.datanode.|| 50010 | dfs.datanode.address,DataNode的数据传输端口 || 8480 | dfs.journalnode.rpc-address || 8481 | dfs.journalnode.|| 8032 | yarn.resourcemanager.address || 8088 | yarn.resourcemanager.webapp.address,YARN的|| 8090 | yarn.resourcemanager.webapp.|| 8030 | yarn.resourcemanager.scheduler.address || 8031 | yarn.resourcemanager.resource-tracker.address || 8033 | yarn.resourcemanager.admin.address || 8042 | yarn.nodemanager.webapp.address || 8040 | yarn.nodemanager.localizer.address || 8188 | yarn.timeline-service.webapp.address || 10020 | mapreduce.jobhistory.address || 19888 | mapreduce.jobhistory.webapp.address || 2888 | ZooKeeper,如果是Leader,用来监听Follower的连接 || 3888 | ZooKeeper,用于Leader选举 || 2181 | ZooKeeper,用来监听客户端的连接 || 60010 | hbase.master.info.port,HMaster的|| 60000 | hbase.master.port,HMaster的RPC端口 || 60030 | hbase.regionserver.info.port,HRegionServer的|| 60020 | hbase.regionserver.port,HRegionServer的RPC端口 || 8080 | hbase.rest.port,HBase REST server的端口 || 10000 | hive.server2.thrift.port || 9083 | hive.metastore.uris |
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~