杨校老师课堂之Hadoop环境搭建(二)

2022-05-07 15:07:03 浏览数 (1)

1. 了解Hadoop配置文件
  • 1.1 当前所处位置,及内部文件如下
代码语言:javascript复制
[root@hadoop1 hadoop-2.7.4]# ll
总用量 116
drwxr-xr-x.  2 20415 101   194 8月   1 2017 bin
drwxr-xr-x.  3 20415 101    20 8月   1 2017 etc
drwxr-xr-x.  2 20415 101   106 8月   1 2017 include
drwxr-xr-x.  3 20415 101    20 8月   1 2017 lib
drwxr-xr-x.  2 20415 101   239 8月   1 2017 libexec
-rw-r--r--.  1 20415 101 86424 8月   1 2017 LICENSE.txt
-rw-r--r--.  1 20415 101 14978 8月   1 2017 NOTICE.txt
-rw-r--r--.  1 20415 101  1366 8月   1 2017 README.txt
drwxr-xr-x.  2 20415 101  4096 8月   1 2017 sbin
drwxr-xr-x.  4 20415 101    31 8月   1 2017 share
drwxr-xr-x. 19 20415 101  4096 8月   1 2017 src
  • 1.2 首先查看所有配置文件
代码语言:javascript复制
# 切换至hadoop内部配置文件所处位置
[root@hadoop1 hadoop-2.7.4]# cd  etc/hadoop/
# 查询所有配置文件
[root@hadoop1 hadoop]# ll
总用量 152
-rw-r--r--. 1 20415 101  4436 8月   1 2017 capacity-scheduler.xml
-rw-r--r--. 1 20415 101  1335 8月   1 2017 configuration.xsl
-rw-r--r--. 1 20415 101   318 8月   1 2017 container-executor.cfg
-rw-r--r--. 1 20415 101   774 8月   1 2017 core-site.xml
-rw-r--r--. 1 20415 101  3670 8月   1 2017 hadoop-env.cmd
-rw-r--r--. 1 20415 101  4224 8月   1 2017 hadoop-env.sh
-rw-r--r--. 1 20415 101  2598 8月   1 2017 hadoop-metrics2.properties
-rw-r--r--. 1 20415 101  2490 8月   1 2017 hadoop-metrics.properties
-rw-r--r--. 1 20415 101  9683 8月   1 2017 hadoop-policy.xml
-rw-r--r--. 1 20415 101   775 8月   1 2017 hdfs-site.xml
-rw-r--r--. 1 20415 101  1449 8月   1 2017 httpfs-env.sh
-rw-r--r--. 1 20415 101  1657 8月   1 2017 httpfs-log4j.properties
-rw-r--r--. 1 20415 101    21 8月   1 2017 httpfs-signature.secret
-rw-r--r--. 1 20415 101   620 8月   1 2017 httpfs-site.xml
-rw-r--r--. 1 20415 101  3518 8月   1 2017 kms-acls.xml
-rw-r--r--. 1 20415 101  1527 8月   1 2017 kms-env.sh
-rw-r--r--. 1 20415 101  1631 8月   1 2017 kms-log4j.properties
-rw-r--r--. 1 20415 101  5540 8月   1 2017 kms-site.xml
-rw-r--r--. 1 20415 101 11237 8月   1 2017 log4j.properties
-rw-r--r--. 1 20415 101   951 8月   1 2017 mapred-env.cmd
-rw-r--r--. 1 20415 101  1383 8月   1 2017 mapred-env.sh
-rw-r--r--. 1 20415 101  4113 8月   1 2017 mapred-queues.xml.template
-rw-r--r--. 1 20415 101   758 8月   1 2017 mapred-site.xml.template
-rw-r--r--. 1 20415 101    10 8月   1 2017 slaves
-rw-r--r--. 1 20415 101  2316 8月   1 2017 ssl-client.xml.example
-rw-r--r--. 1 20415 101  2697 8月   1 2017 ssl-server.xml.example
-rw-r--r--. 1 20415 101  2250 8月   1 2017 yarn-env.cmd
-rw-r--r--. 1 20415 101  4567 8月   1 2017 yarn-env.sh
-rw-r--r--. 1 20415 101   690 8月   1 2017 yarn-site.xml
2. 修改Hadoop配置文件
  • 2.1 采用vim命令进行修改hadoop-env.sh
代码语言:javascript复制
[root@hadoop1 hadoop]# vim hadoop-env.sh 
  • 2.2 修改core-site.xml
代码语言:javascript复制
<configuration>
        <property>
                <name>fs.defaultFS</name>
                <value>hdfs://hadoop1:9000</value>
        </property>
        
        <property>
                <name>hadoop.tmp.dir</name>
                <value>/usr/local/hadoop/hadoop-2.7.4/tmp</value>
        </property>
</configuration>
  • 2.3 修改hdfs-site.xml
代码语言:javascript复制
<configuration>
        <property>
                <name>dfs.replication</name>
                <value>1</value>
        </property>
</configuration>
3. 初始化文件系统
  • 3.1 初始化名称节点
代码语言:javascript复制
[root@hadoop1 hadoop]# hdfs namenode -format
22/03/23 12:45:51 INFO namenode.NameNode: STARTUP_MSG: 
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG:   host = hadoop1/192.168.101.166
STARTUP_MSG:   args = [-format]
STARTUP_MSG:   version = 2.7.4
/*
* 提示:该行代码过长,系统自动注释不进行高亮。一键复制会移除系统注释 
* STARTUP_MSG:   classpath = /usr/local/hadoop/hadoop-2.7.4/etc/hadoop:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/commons-compress-1.4.1.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/commons-cli-1.2.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/jettison-1.1.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/curator-framework-2.7.1.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/java-xmlbuilder-0.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/slf4j-api-1.7.10.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/commons-digester-1.8.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/httpclient-4.2.5.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/api-asn1-api-1.0.0-M20.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/protobuf-java-2.5.0.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/jersey-server-1.9.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/mockito-all-1.8.5.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/commons-httpclient-3.1.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/jersey-core-1.9.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/xmlenc-0.52.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/jackson-mapper-asl-1.9.13.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/jersey-json-1.9.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/curator-client-2.7.1.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/avro-1.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/commons-net-3.1.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/jackson-xc-1.9.13.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/log4j-1.2.17.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/gson-2.2.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/hamcrest-core-1.3.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/commons-io-2.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/commons-configuration-1.6.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/activation-1.1.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/api-util-1.0.0-M20.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/jets3t-0.9.0.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/apacheds-i18n-2.0.0-M15.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/jetty-util-6.1.26.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/commons-collections-3.2.2.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/zookeeper-3.4.6.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/jackson-core-asl-1.9.13.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/commons-beanutils-core-1.8.0.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/jsch-0.1.54.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/jaxb-impl-2.2.3-1.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/commons-math3-3.1.1.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/servlet-api-2.5.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/commons-logging-1.1.3.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/jsr305-3.0.0.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/commons-beanutils-1.7.0.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/xz-1.0.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/jaxb-api-2.2.2.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/jetty-sslengine-6.1.26.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/curator-recipes-2.7.1.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/snappy-java-1.0.4.1.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/guava-11.0.2.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/httpcore-4.2.5.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/hadoop-auth-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/junit-4.11.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/jackson-jaxrs-1.9.13.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/paranamer-2.3.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/netty-3.6.2.Final.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/jsp-api-2.1.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/asm-3.2.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/stax-api-1.0-2.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/apacheds-kerberos-codec-2.0.0-M15.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/commons-codec-1.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/hadoop-annotations-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/jetty-6.1.26.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/htrace-core-3.1.0-incubating.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/lib/commons-lang-2.6.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/hadoop-nfs-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/hadoop-common-2.7.4-tests.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/common/hadoop-common-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/lib/xml-apis-1.3.04.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/lib/commons-cli-1.2.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/lib/netty-all-4.0.23.Final.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/lib/protobuf-java-2.5.0.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/lib/jersey-server-1.9.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/lib/jersey-core-1.9.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/lib/xmlenc-0.52.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/lib/jackson-mapper-asl-1.9.13.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/lib/leveldbjni-all-1.8.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/lib/log4j-1.2.17.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/lib/commons-io-2.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/lib/jetty-util-6.1.26.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/lib/jackson-core-asl-1.9.13.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/lib/xercesImpl-2.9.1.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/lib/servlet-api-2.5.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/lib/commons-logging-1.1.3.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/lib/jsr305-3.0.0.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/lib/guava-11.0.2.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/lib/commons-daemon-1.0.13.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/lib/netty-3.6.2.Final.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/lib/asm-3.2.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/lib/commons-codec-1.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/lib/jetty-6.1.26.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/lib/htrace-core-3.1.0-incubating.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/lib/commons-lang-2.6.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/hadoop-hdfs-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/hadoop-hdfs-2.7.4-tests.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/hdfs/hadoop-hdfs-nfs-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/commons-compress-1.4.1.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/guice-3.0.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/commons-cli-1.2.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/jettison-1.1.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/protobuf-java-2.5.0.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/jersey-server-1.9.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/jersey-core-1.9.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/jackson-mapper-asl-1.9.13.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/jersey-json-1.9.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/jackson-xc-1.9.13.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/leveldbjni-all-1.8.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/guice-servlet-3.0.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/log4j-1.2.17.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/commons-io-2.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/activation-1.1.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/jetty-util-6.1.26.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/commons-collections-3.2.2.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/zookeeper-3.4.6.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/jersey-guice-1.9.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/jackson-core-asl-1.9.13.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/jaxb-impl-2.2.3-1.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/javax.inject-1.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/jersey-client-1.9.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/servlet-api-2.5.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/commons-logging-1.1.3.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/jsr305-3.0.0.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/xz-1.0.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/jaxb-api-2.2.2.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/guava-11.0.2.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/zookeeper-3.4.6-tests.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/jackson-jaxrs-1.9.13.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/netty-3.6.2.Final.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/asm-3.2.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/stax-api-1.0-2.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/aopalliance-1.0.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/commons-codec-1.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/jetty-6.1.26.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/lib/commons-lang-2.6.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/hadoop-yarn-client-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/hadoop-yarn-server-resourcemanager-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/hadoop-yarn-common-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/hadoop-yarn-applications-distributedshell-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/hadoop-yarn-applications-unmanaged-am-launcher-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/hadoop-yarn-api-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/hadoop-yarn-server-tests-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/hadoop-yarn-server-web-proxy-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/hadoop-yarn-server-sharedcachemanager-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/hadoop-yarn-server-common-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/hadoop-yarn-server-nodemanager-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/hadoop-yarn-server-applicationhistoryservice-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/yarn/hadoop-yarn-registry-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/lib/commons-compress-1.4.1.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/lib/guice-3.0.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/lib/protobuf-java-2.5.0.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/lib/jersey-server-1.9.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/lib/jersey-core-1.9.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/lib/jackson-mapper-asl-1.9.13.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/lib/avro-1.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/lib/leveldbjni-all-1.8.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/lib/guice-servlet-3.0.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/lib/log4j-1.2.17.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/lib/hamcrest-core-1.3.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/lib/commons-io-2.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/lib/jersey-guice-1.9.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/lib/jackson-core-asl-1.9.13.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/lib/javax.inject-1.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/lib/xz-1.0.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/lib/snappy-java-1.0.4.1.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/lib/junit-4.11.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/lib/paranamer-2.3.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/lib/netty-3.6.2.Final.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/lib/asm-3.2.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/lib/aopalliance-1.0.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/lib/hadoop-annotations-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/hadoop-mapreduce-client-hs-plugins-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/hadoop-mapreduce-client-app-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/hadoop-mapreduce-client-common-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-2.7.4-tests.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/hadoop-mapreduce-client-core-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/hadoop-mapreduce-client-hs-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/share/hadoop/mapreduce/hadoop-mapreduce-client-shuffle-2.7.4.jar:/usr/local/hadoop/hadoop-2.7.4/contrib/capacity-scheduler/*.jar
*/
STARTUP_MSG:   build = https://shv@git-wip-us.apache.org/repos/asf/hadoop.git -r cd915e1e8d9d0131462a0b7301586c175728a282; compiled by 'kshvachk' on 2017-08-01T00:29Z
STARTUP_MSG:   java = 1.8.0_291
************************************************************/
22/03/23 12:45:51 INFO namenode.NameNode: registered UNIX signal handlers for [TERM, HUP, INT]
22/03/23 12:45:51 INFO namenode.NameNode: createNameNode [-format]
Formatting using clusterid: CID-e9ba1e78-c6f2-4c57-a449-74d280c526ee
22/03/23 12:45:52 INFO namenode.FSNamesystem: No KeyProvider found.
22/03/23 12:45:52 INFO namenode.FSNamesystem: fsLock is fair: true
22/03/23 12:45:52 INFO namenode.FSNamesystem: Detailed lock hold time metrics enabled: false
22/03/23 12:45:53 INFO blockmanagement.DatanodeManager: dfs.block.invalidate.limit=1000
22/03/23 12:45:53 INFO blockmanagement.DatanodeManager: dfs.namenode.datanode.registration.ip-hostname-check=true
22/03/23 12:45:53 INFO blockmanagement.BlockManager: dfs.namenode.startup.delay.block.deletion.sec is set to 000:00:00:00.000
22/03/23 12:45:53 INFO blockmanagement.BlockManager: The block deletion will start around 2022 三月 23 12:45:53
22/03/23 12:45:53 INFO util.GSet: Computing capacity for map BlocksMap
22/03/23 12:45:53 INFO util.GSet: VM type       = 64-bit
22/03/23 12:45:53 INFO util.GSet: 2.0% max memory 889 MB = 17.8 MB
22/03/23 12:45:53 INFO util.GSet: capacity      = 2^21 = 2097152 entries
22/03/23 12:45:53 INFO blockmanagement.BlockManager: dfs.block.access.token.enable=false
22/03/23 12:45:53 INFO blockmanagement.BlockManager: defaultReplication         = 1
22/03/23 12:45:53 INFO blockmanagement.BlockManager: maxReplication             = 512
22/03/23 12:45:53 INFO blockmanagement.BlockManager: minReplication             = 1
22/03/23 12:45:53 INFO blockmanagement.BlockManager: maxReplicationStreams      = 2
22/03/23 12:45:53 INFO blockmanagement.BlockManager: replicationRecheckInterval = 3000
22/03/23 12:45:53 INFO blockmanagement.BlockManager: encryptDataTransfer        = false
22/03/23 12:45:53 INFO blockmanagement.BlockManager: maxNumBlocksToLog          = 1000
22/03/23 12:45:53 INFO namenode.FSNamesystem: fsOwner             = root (auth:SIMPLE)
22/03/23 12:45:53 INFO namenode.FSNamesystem: supergroup          = supergroup
22/03/23 12:45:53 INFO namenode.FSNamesystem: isPermissionEnabled = true
22/03/23 12:45:53 INFO namenode.FSNamesystem: HA Enabled: false
22/03/23 12:45:53 INFO namenode.FSNamesystem: Append Enabled: true
22/03/23 12:45:55 INFO util.GSet: Computing capacity for map INodeMap
22/03/23 12:45:55 INFO util.GSet: VM type       = 64-bit
22/03/23 12:45:55 INFO util.GSet: 1.0% max memory 889 MB = 8.9 MB
22/03/23 12:45:55 INFO util.GSet: capacity      = 2^20 = 1048576 entries
22/03/23 12:45:55 INFO namenode.FSDirectory: ACLs enabled? false
22/03/23 12:45:55 INFO namenode.FSDirectory: XAttrs enabled? true
22/03/23 12:45:55 INFO namenode.FSDirectory: Maximum size of an xattr: 16384
22/03/23 12:45:55 INFO namenode.NameNode: Caching file names occuring more than 10 times
22/03/23 12:45:55 INFO util.GSet: Computing capacity for map cachedBlocks
22/03/23 12:45:55 INFO util.GSet: VM type       = 64-bit
22/03/23 12:45:55 INFO util.GSet: 0.25% max memory 889 MB = 2.2 MB
22/03/23 12:45:55 INFO util.GSet: capacity      = 2^18 = 262144 entries
22/03/23 12:45:55 INFO namenode.FSNamesystem: dfs.namenode.safemode.threshold-pct = 0.9990000128746033
22/03/23 12:45:55 INFO namenode.FSNamesystem: dfs.namenode.safemode.min.datanodes = 0
22/03/23 12:45:55 INFO namenode.FSNamesystem: dfs.namenode.safemode.extension     = 30000
22/03/23 12:45:55 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.window.num.buckets = 10
22/03/23 12:45:55 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.num.users = 10
22/03/23 12:45:55 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.windows.minutes = 1,5,25
22/03/23 12:45:55 INFO namenode.FSNamesystem: Retry cache on namenode is enabled
22/03/23 12:45:55 INFO namenode.FSNamesystem: Retry cache will use 0.03 of total heap and retry cache entry expiry time is 600000 millis
22/03/23 12:45:55 INFO util.GSet: Computing capacity for map NameNodeRetryCache
22/03/23 12:45:55 INFO util.GSet: VM type       = 64-bit
22/03/23 12:45:55 INFO util.GSet: 0.029999999329447746% max memory 889 MB = 273.1 KB
22/03/23 12:45:55 INFO util.GSet: capacity      = 2^15 = 32768 entries
22/03/23 12:45:56 INFO namenode.FSImage: Allocated new BlockPoolId: BP-761487052-192.168.101.166-1648010756451
22/03/23 12:45:56 INFO common.Storage: Storage directory /usr/local/hadoop/hadoop-2.7.4/tmp/dfs/name has been successfully formatted.
22/03/23 12:45:56 INFO namenode.FSImageFormatProtobuf: Saving image file /usr/local/hadoop/hadoop-2.7.4/tmp/dfs/name/current/fsimage.ckpt_0000000000000000000 using no compression
22/03/23 12:45:56 INFO namenode.FSImageFormatProtobuf: Image file /usr/local/hadoop/hadoop-2.7.4/tmp/dfs/name/current/fsimage.ckpt_0000000000000000000 of size 321 bytes saved in 0 seconds.
22/03/23 12:45:56 INFO namenode.NNStorageRetentionManager: Going to retain 1 images with txid >= 0
22/03/23 12:45:56 INFO util.ExitUtil: Exiting with status 0
22/03/23 12:45:56 INFO namenode.NameNode: SHUTDOWN_MSG: 
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at hadoop1/192.168.101.166
************************************************************/
4. 启动HDFS
  • 4.1文件系统初始化成功,启动hdfs
代码语言:javascript复制
[root@hadoop1 hadoop]# start-dfs.sh 
Starting namenodes on [hadoop1]
The authenticity of host 'hadoop1 (fe80::60f5:7b31:bf63:ccef%ens33)' can't be established.
ECDSA key fingerprint is SHA256:dLMHzLDwMPEHWjgXb 5N746rIfizy vrHOaOWh3TsOE.
ECDSA key fingerprint is MD5:5b:3a:cc:9e:2c:8f:37:3c:18:2c:cd:15:c9:a1:f0:11.
Are you sure you want to continue connecting (yes/no)? yes
hadoop1: Warning: Permanently added 'hadoop1,fe80::60f5:7b31:bf63:ccef%ens33' (ECDSA) to the list of known hosts.
root@hadoop1's password: 
hadoop1: starting namenode, logging to /usr/local/hadoop/hadoop-2.7.4/logs/hadoop-root-namenode-hadoop1.out
The authenticity of host 'localhost (::1)' can't be established.
ECDSA key fingerprint is SHA256:dLMHzLDwMPEHWjgXb 5N746rIfizy vrHOaOWh3TsOE.
ECDSA key fingerprint is MD5:5b:3a:cc:9e:2c:8f:37:3c:18:2c:cd:15:c9:a1:f0:11.
Are you sure you want to continue connecting (yes/no)? yes
localhost: Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
root@localhost's password: 
localhost: starting datanode, logging to /usr/local/hadoop/hadoop-2.7.4/logs/hadoop-root-datanode-hadoop1.out
Starting secondary namenodes [0.0.0.0]
The authenticity of host '0.0.0.0 (0.0.0.0)' can't be established.
ECDSA key fingerprint is SHA256:dLMHzLDwMPEHWjgXb 5N746rIfizy vrHOaOWh3TsOE.
ECDSA key fingerprint is MD5:5b:3a:cc:9e:2c:8f:37:3c:18:2c:cd:15:c9:a1:f0:11.
Are you sure you want to continue connecting (yes/no)? yes
0.0.0.0: Warning: Permanently added '0.0.0.0' (ECDSA) to the list of known hosts.
root@0.0.0.0's password: 
0.0.0.0: starting secondarynamenode, logging to /usr/local/hadoop/hadoop-2.7.4/logs/hadoop-root-secondarynamenode-hadoop1.out
  • 4.2 启动之后,通过jps指令查询所有的java进程
代码语言:javascript复制
[root@hadoop1 hadoop]# jps
70164 SecondaryNameNode
69526 NameNode
69883 DataNode
71691 Jps

当下,在VMWare内浏览器中进行访问web页面(http://hadoop1:50070)来查看Hadoop的信息

在执行启动hdfs时,需要多次输入密码,带来繁琐,可采用免密方式登录,具体配置可以查看。

提示: 如果想通过物理机进行访问可视化界面网址,需要关闭防火墙哦!

代码语言:javascript复制
[root@hadoop1 hadoop]# systemctl stop firewalld

作者: 杨校

出处: https://mryang.blog.csdn.net

分享是快乐的,也见证了个人成长历程,文章大多都是工作经验总结以及平时学习积累,基于自身认知不足之处在所难免,也请大家指正,共同进步。

本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出, 如有问题, 可邮件(397583050@qq.com)咨询

0 人点赞