大数据技术之Hadoop3.1.2版本完全分布式部署
作者:尹正杰
版权声明:原创作品,谢绝转载!否则将追究法律责任。
一.主机环境准备
1>.操作系统环境
[root@node101.yinzhengjie.org.cn ~]# cat /etc/redhat-release CentOS Linux release 7.6.1810 (Core) [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# uname -r 3.10.0-957.el7.x86_64 [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# uname -m x86_64 [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda3 48G 2.1G 46G 5% / devtmpfs 1.9G 0 1.9G 0% /dev tmpfs 1.9G 0 1.9G 0% /dev/shm tmpfs 1.9G 12M 1.9G 1% /run tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup /dev/sda1 297M 120M 177M 41% /boot tmpfs 378M 0 378M 0% /run/user/0 [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# free -h total used free shared buff/cache available Mem: 3.7G 99M 3.0G 11M 565M 3.3G Swap: 2.0G 0B 2.0G [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]#
2>.关闭防火墙
[root@node101.yinzhengjie.org.cn ~]# systemctl stop firewalld [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# systemctl status firewalld ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled) Active: inactive (dead) Docs: man:firewalld(1) Apr 11 10:31:41 node101.yinzhengjie.org.cn systemd[1]: Starting firewalld - dynamic firewall daemon... Apr 11 10:31:41 node101.yinzhengjie.org.cn systemd[1]: Started firewalld - dynamic firewall daemon. Apr 11 18:22:25 node101.yinzhengjie.org.cn systemd[1]: Stopping firewalld - dynamic firewall daemon... Apr 11 18:22:26 node101.yinzhengjie.org.cn systemd[1]: Stopped firewalld - dynamic firewall daemon. [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# systemctl disable firewalld Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service. Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service. [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# sed -i s'#SELINUX=enforcing#SELINUX=disabled#' /etc/selinux/config [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# grep SELINUX= /etc/selinux/config | grep -v ^# SELINUX=disabled [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# getenforce
Disabled
[root@node101.yinzhengjie.org.cn ~]#
3>.配置本机的免密登录(如果不做这步的话,在启动hdfs集群时会报权限被拒绝的错误)
[root@node101.yinzhengjie.org.cn ~]# ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa Generating public/private rsa key pair. Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: SHA256:zViCNdoMvFre2Sury7Sxgy1ciwZx95u0KjBlOSCA5Ek root@node101.yinzhengjie.org.cn The key's randomart image is: +---[RSA 2048]----+ |=E .. o | |= o .B . | | + . .o.+ . | | . * + * | | = * oSoo | | + . o = . | | = =oo + . | | Bo++= . | | . oB=.o | +----[SHA256]-----+ [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ssh-copy-id root@node101.yinzhengjie.org.cn /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub" /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys root@node101.yinzhengjie.org.cn's password: Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'root@node101.yinzhengjie.org.cn'" and check to make sure that only the key(s) you wanted were added. [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ssh-copy-id root@node102.yinzhengjie.org.cn /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub" The authenticity of host 'node102.yinzhengjie.org.cn (172.30.1.102)' can't be established. ECDSA key fingerprint is SHA256:ieFAvspF0h3MithtlM0FgJGwP++/xn8PfiJEnSHGO4w. ECDSA key fingerprint is MD5:d1:24:13:f9:4a:fd:b8:65:d0:c8:d3:fc:9c:fb:12:5a. Are you sure you want to continue connecting (yes/no)? yes /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys root@node102.yinzhengjie.org.cn's password: /etc/bashrc: line 1: /etc/bashrc: Permission denied Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'root@node102.yinzhengjie.org.cn'" and check to make sure that only the key(s) you wanted were added. [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ssh-copy-id root@node103.yinzhengjie.org.cn /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub" The authenticity of host 'node103.yinzhengjie.org.cn (172.30.1.103)' can't be established. ECDSA key fingerprint is SHA256:ieFAvspF0h3MithtlM0FgJGwP++/xn8PfiJEnSHGO4w. ECDSA key fingerprint is MD5:d1:24:13:f9:4a:fd:b8:65:d0:c8:d3:fc:9c:fb:12:5a. Are you sure you want to continue connecting (yes/no)? yes /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys root@node103.yinzhengjie.org.cn's password: /etc/bashrc: line 1: /etc/bashrc: Permission denied Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'root@node103.yinzhengjie.org.cn'" and check to make sure that only the key(s) you wanted were added. [root@node101.yinzhengjie.org.cn ~]#
4>.安装jdk
大家可以自行去Oracle官网下载相应的jdk,我这里给出下载地址:https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html(推荐下载tar.gz的安装包,解压后配置环境变量即可使用)。
[root@node101.yinzhengjie.org.cn ~]# tail -3 /etc/profile #ADD JAVA_PATH JAVA_HOME=/yinzhengjie/softwares/jdk PATH=$PATH:$JAVA_HOME/bin [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# which java /yinzhengjie/softwares/jdk/bin/java [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# java -version java version "1.8.0_201" Java(TM) SE Runtime Environment (build 1.8.0_201-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode) [root@node101.yinzhengjie.org.cn ~]#
5>.下载Hadoop3.1.2版本
[root@node101.yinzhengjie.org.cn ~]# wget http://mirror.bit.edu.cn/apache/hadoop/common/hadoop-3.1.2/hadoop-3.1.2.tar.gz --2019-04-11 08:06:10-- http://mirror.bit.edu.cn/apache/hadoop/common/hadoop-3.1.2/hadoop-3.1.2.tar.gz Resolving mirror.bit.edu.cn (mirror.bit.edu.cn)... 114.247.56.117, 114.247.56.117 Connecting to mirror.bit.edu.cn (mirror.bit.edu.cn)|114.247.56.117|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 332433589 (317M) [application/octet-stream] Saving to: ‘hadoop-3.1.2.tar.gz’ 100%[============================================================================================================================================>] 332,433,589 7.84MB/s in 49s 2019-04-11 08:07:01 (6.52 MB/s) - ‘hadoop-3.1.2.tar.gz’ saved [332433589/332433589] [root@node101.yinzhengjie.org.cn ~]#
二.安装ansible软件
1>.查看yum源,我们此处默认你的服务器是可以联网
[root@node101.yinzhengjie.org.cn ~]# yum repolist Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com repo id repo name status base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 10,019 extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 385 updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 1,511 repolist: 11,915 [root@node101.yinzhengjie.org.cn ~]#
2>. 查看当前的yum支持的ansible版本
[root@node101.yinzhengjie.org.cn ~/Downloads]# yum info ansible Loaded plugins: fastestmirror, langpacks Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com Available Packages Name : ansible Arch : noarch Version : 2.4.2.0 Release : 2.el7 Size : 7.6 M Repo : extras/7/x86_64 Summary : SSH-based configuration management, deployment, and task execution system URL : http://ansible.com License : GPLv3+ Description : : Ansible is a radically simple model-driven configuration management, : multi-node deployment, and remote task execution system. Ansible works : over SSH and does not require any software or daemons to be installed : on remote nodes. Extension modules can be written in any language and : are transferred to managed machines automatically. [root@node101.yinzhengjie.org.cn ~/Downloads]#
3>.安装ansible
[root@node101.yinzhengjie.org.cn ~/Downloads]# yum -y install ansible Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com base | 3.6 kB 00:00:00 extras | 3.4 kB 00:00:00 updates | 3.4 kB 00:00:00 (1/2): extras/7/x86_64/primary_db | 187 kB 00:00:00 (2/2): updates/7/x86_64/primary_db | 3.4 MB 00:00:01 Resolving Dependencies --> Running transaction check ---> Package ansible.noarch 0:2.4.2.0-2.el7 will be installed --> Processing Dependency: sshpass for package: ansible-2.4.2.0-2.el7.noarch --> Processing Dependency: python2-jmespath for package: ansible-2.4.2.0-2.el7.noarch --> Processing Dependency: python-passlib for package: ansible-2.4.2.0-2.el7.noarch --> Processing Dependency: python-paramiko for package: ansible-2.4.2.0-2.el7.noarch --> Processing Dependency: python-jinja2 for package: ansible-2.4.2.0-2.el7.noarch --> Processing Dependency: python-httplib2 for package: ansible-2.4.2.0-2.el7.noarch --> Running transaction check ---> Package python-httplib2.noarch 0:0.9.2-1.el7 will be installed ---> Package python-jinja2.noarch 0:2.7.2-2.el7 will be installed --> Processing Dependency: python-babel >= 0.8 for package: python-jinja2-2.7.2-2.el7.noarch --> Processing Dependency: python-markupsafe for package: python-jinja2-2.7.2-2.el7.noarch ---> Package python-paramiko.noarch 0:2.1.1-9.el7 will be installed ---> Package python-passlib.noarch 0:1.6.5-2.el7 will be installed ---> Package python2-jmespath.noarch 0:0.9.0-3.el7 will be installed ---> Package sshpass.x86_64 0:1.06-2.el7 will be installed --> Running transaction check ---> Package python-babel.noarch 0:0.9.6-8.el7 will be installed ---> Package python-markupsafe.x86_64 0:0.11-10.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ========================================================================================================================================================================================================================================== Package Arch Version Repository Size ========================================================================================================================================================================================================================================== Installing: ansible noarch 2.4.2.0-2.el7 extras 7.6 M Installing for dependencies: python-babel noarch 0.9.6-8.el7 base 1.4 M python-httplib2 noarch 0.9.2-1.el7 extras 115 k python-jinja2 noarch 2.7.2-2.el7 base 515 k python-markupsafe x86_64 0.11-10.el7 base 25 k python-paramiko noarch 2.1.1-9.el7 updates 269 k python-passlib noarch 1.6.5-2.el7 extras 488 k python2-jmespath noarch 0.9.0-3.el7 extras 39 k sshpass x86_64 1.06-2.el7 extras 21 k Transaction Summary ========================================================================================================================================================================================================================================== Install 1 Package (+8 Dependent packages) Total download size: 10 M Installed size: 51 M Downloading packages: python-httplib2-0.9.2-1.el7.no FAILED http://mirrors.cloud.aliyuncs.com/centos/7/extras/x86_64/Packages/python-httplib2-0.9.2-1.el7.noarch.rpm: [Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com; Unknown error" ] 0.0 B/s | 0 B --:--:-- ETA Trying other mirror. python-jinja2-2.7.2-2.el7.noar FAILED http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/Packages/python-jinja2-2.7.2-2.el7.noarch.rpm: [Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com; Unknown error" ] 0.0 B/s | 0 B --:--:-- ETA Trying other mirror. (1/9): python-markupsafe-0.11-10.el7.x86_64.rpm | 25 kB 00:00:00 (2/9): python-babel-0.9.6-8.el7.noarch.rpm | 1.4 MB 00:00:00 (3/9): python-paramiko-2.1.1-9.el7.noarch.rpm | 269 kB 00:00:01 (4/9): ansible-2.4.2.0-2.el7.noarch.rpm | 7.6 MB 00:00:04 (5/9): python2-jmespath-0.9.0-3.el7.noarch.rpm | 39 kB 00:00:00 (6/9): sshpass-1.06-2.el7.x86_64.rpm | 21 kB 00:00:00 (7/9): python-httplib2-0.9.2-1.el7.noarch.rpm | 115 kB 00:00:00 (8/9): python-jinja2-2.7.2-2.el7.noarch.rpm | 515 kB 00:00:00 (9/9): python-passlib-1.6.5-2.el7.noarch.rpm | 488 kB 00:00:05 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Total 1.7 MB/s | 10 MB 00:00:06 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : python-httplib2-0.9.2-1.el7.noarch 1/9 Installing : sshpass-1.06-2.el7.x86_64 2/9 Installing : python-babel-0.9.6-8.el7.noarch 3/9 Installing : python-paramiko-2.1.1-9.el7.noarch 4/9 Installing : python2-jmespath-0.9.0-3.el7.noarch 5/9 Installing : python-passlib-1.6.5-2.el7.noarch 6/9 Installing : python-markupsafe-0.11-10.el7.x86_64 7/9 Installing : python-jinja2-2.7.2-2.el7.noarch 8/9 Installing : ansible-2.4.2.0-2.el7.noarch 9/9 Verifying : python-markupsafe-0.11-10.el7.x86_64 1/9 Verifying : python-jinja2-2.7.2-2.el7.noarch 2/9 Verifying : python-passlib-1.6.5-2.el7.noarch 3/9 Verifying : python2-jmespath-0.9.0-3.el7.noarch 4/9 Verifying : python-paramiko-2.1.1-9.el7.noarch 5/9 Verifying : python-babel-0.9.6-8.el7.noarch 6/9 Verifying : ansible-2.4.2.0-2.el7.noarch 7/9 Verifying : sshpass-1.06-2.el7.x86_64 8/9 Verifying : python-httplib2-0.9.2-1.el7.noarch 9/9 Installed: ansible.noarch 0:2.4.2.0-2.el7 Dependency Installed: python-babel.noarch 0:0.9.6-8.el7 python-httplib2.noarch 0:0.9.2-1.el7 python-jinja2.noarch 0:2.7.2-2.el7 python-markupsafe.x86_64 0:0.11-10.el7 python-paramiko.noarch 0:2.1.1-9.el7 python-passlib.noarch 0:1.6.5-2.el7 python2-jmespath.noarch 0:0.9.0-3.el7 sshpass.x86_64 0:1.06-2.el7 Complete! [root@node101.yinzhengjie.org.cn ~/Downloads]# [root@node101.yinzhengjie.org.cn ~/Downloads]# yum -y install ansible
4>.编辑ansible的主机配置文件
[root@node101.yinzhengjie.org.cn ~]# tail -5 /etc/ansible/hosts [namenode] node101.yinzhengjie.org.cn [datanode] node[101:103].yinzhengjie.org.cn [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]#
5>.测试是否ansible是否可用
[root@node101.yinzhengjie.org.cn ~]# ansible namenode -m ping node101.yinzhengjie.org.cn | SUCCESS => { "changed": false, "ping": "pong" } [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ansible datanode -m ping node101.yinzhengjie.org.cn | SUCCESS => { "changed": false, "ping": "pong" } node102.yinzhengjie.org.cn | SUCCESS => { "changed": false, "ping": "pong" } node103.yinzhengjie.org.cn | SUCCESS => { "changed": false, "ping": "pong" } [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ansible all -m shell -a 'ln -s /yinzhengjie/softwares/jdk1.8.0_201/bin/jps /usr/local/bin/' [WARNING]: Consider using file module with state=link rather than running ln node101.yinzhengjie.org.cn | SUCCESS | rc=0 >> node103.yinzhengjie.org.cn | SUCCESS | rc=0 >> node102.yinzhengjie.org.cn | SUCCESS | rc=0 >> [root@node101.yinzhengjie.org.cn ~]#
三.编辑hadoop 3.1.2相关配置文件
1>.解压配置文件到指定目录并配置环境变量
[root@node101.yinzhengjie.org.cn ~]# tar -zxf hadoop-3.1.2.tar.gz -C /yinzhengjie/softwares/ [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# ll /yinzhengjie/softwares/hadoop-3.1.2/ total 176 drwxr-xr-x 2 1001 1002 183 Jan 28 19:35 bin drwxr-xr-x 3 1001 1002 20 Jan 28 17:44 etc drwxr-xr-x 2 1001 1002 106 Jan 28 19:35 include drwxr-xr-x 3 1001 1002 20 Jan 28 19:35 lib drwxr-xr-x 4 1001 1002 288 Jan 28 19:36 libexec -rw-rw-r-- 1 1001 1002 147145 Jan 23 07:07 LICENSE.txt -rw-rw-r-- 1 1001 1002 21867 Jan 23 07:07 NOTICE.txt -rw-rw-r-- 1 1001 1002 1366 Jan 23 07:07 README.txt drwxr-xr-x 3 1001 1002 4096 Jan 28 17:44 sbin drwxr-xr-x 4 1001 1002 31 Jan 28 20:05 share [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# mkdir -pv /data/hadoop/{hdfs,yarn,mapreduce} mkdir: created directory ‘/data’ mkdir: created directory ‘/data/hadoop’ mkdir: created directory ‘/data/hadoop/hdfs’ mkdir: created directory ‘/data/hadoop/yarn’ mkdir: created directory ‘/data/hadoop/mapreduce’ [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# mkdir -pv /data/hadoop/{hdfs,yarn,mapreduce}
[root@node101.yinzhengjie.org.cn ~]# tail -3 /etc/profile #Add HADOOP_HOME PATH HADOOP_HOME=/yinzhengjie/softwares/hadoop-3.1.2 PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin [root@node101.yinzhengjie.org.cn ~]#
2>.编辑hadoop相关配置文件
[root@node101.yinzhengjie.org.cn ~]# vi /yinzhengjie/softwares/hadoop-3.1.2/etc/hadoop/hadoop-env.sh [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# tail -5 /yinzhengjie/softwares/hadoop-3.1.2/etc/hadoop/hadoop-env.sh #Add Hadoop Path by yinzhengjie export JAVA_HOME=/yinzhengjie/softwares/jdk export HDFS_NAMENODE_USER=root export HDFS_DATANODE_USER=root export HDFS_SECONDARYNAMENODE_USER=root [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# vi /yinzhengjie/softwares/hadoop-3.1.2/etc/hadoop/core-site.xml [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# cat /yinzhengjie/softwares/hadoop-3.1.2/etc/hadoop/core-site.xml <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>fs.defaultFS</name> <value>hdfs://node101.yinzhengjie.org.cn:9820</value> </property> <property> <name>hadoop.tmp.dir</name> <value>/data/hadoop/hdfs</value> </property> </configuration> [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# vi /yinzhengjie/softwares/hadoop-3.1.2/etc/hadoop/hdfs-site.xml [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# cat /yinzhengjie/softwares/hadoop-3.1.2/etc/hadoop/hdfs-site.xml <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>dfs.replication</name> <value>2</value> </property> <property> <name>dfs.namenode.secondary.http-address</name> <value>node101.yinzhengjie.org.cn:9868</value> </property> </configuration> [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# vi /yinzhengjie/softwares/hadoop-3.1.2/etc/hadoop/workers [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# cat /yinzhengjie/softwares/hadoop-3.1.2/etc/hadoop/workers node101.yinzhengjie.org.cn node102.yinzhengjie.org.cn node103.yinzhengjie.org.cn [root@node101.yinzhengjie.org.cn ~]#
3>.将node101.yinzhengjie.org.cn节点的数据及配置文件分发到其他节点中
[root@node101.yinzhengjie.org.cn ~]# scp -r /yinzhengjie/softwares/hadoop-3.1.2/ node102.yinzhengjie.org.cn:/yinzhengjie/softwares/ ..............(此处省略输出,你懂得,文件太多屏幕显示不了!) bg.jpg 100% 486 477.9KB/s 00:00 h3.jpg 100% 431 257.5KB/s 00:00 icon_success_sml.gif 100% 990 867.2KB/s 00:00 icon_info_sml.gif 100% 606 80.4KB/s 00:00 breadcrumbs.jpg 100% 349 27.6KB/s 00:00 expanded.gif 100% 52 46.3KB/s 00:00 apache-maven-project-2.png 100% 33KB 17.2MB/s 00:00 icon_error_sml.gif 100% 1010 987.3KB/s 00:00 logo_apache.jpg 100% 33KB 13.2MB/s 00:00 icon_warning_sml.gif 100% 576 562.8KB/s 00:00 newwindow.png 100% 220 238.6KB/s 00:00 maven-logo-2.gif 100% 26KB 11.8MB/s 00:00 banner.jpg 100% 872 316.7KB/s 00:00 logo_maven.jpg 100% 26KB 12.0MB/s 00:00 collapsed.gif 100% 820 729.3KB/s 00:00 external.png 100% 230 220.6KB/s 00:00 h5.jpg 100% 357 365.5KB/s 00:00 build-by-maven-white.png 100% 2260 2.8MB/s 00:00 build-by-maven-black.png 100% 2294 2.2MB/s 00:00 maven-feather.png 100% 3330 3.2MB/s 00:00 index.html 100% 36KB 16.4MB/s 00:00 project-reports.html 100% 24KB 14.1MB/s 00:00 hdfs.h 100% 38KB 586.3KB/s 00:00 Pipes.hh 100% 6330 4.5MB/s 00:00 SerialUtils.hh 100% 4567 2.5MB/s 00:00 StringUtils.hh 100% 2441 1.2MB/s 00:00 TemplateFactory.hh 100% 3319 2.8MB/s 00:00 SecurityAuth-root.audit 100% 0 0.0KB/s 00:00 hadoop-root-namenode-node101.yinzhengjie.org.cn.out 100% 6151 1.6MB/s 00:00 hadoop-root-namenode-node101.yinzhengjie.org.cn.log 100% 40KB 4.6MB/s 00:00 hadoop-root-datanode-node101.yinzhengjie.org.cn.out 100% 695 695.6KB/s 00:00 hadoop-root-datanode-node101.yinzhengjie.org.cn.log 100% 34KB 17.3MB/s 00:00 hadoop-root-secondarynamenode-node101.yinzhengjie.org.cn.out 100% 695 752.9KB/s 00:00 hadoop-root-secondarynamenode-node101.yinzhengjie.org.cn.log 100% 33KB 12.8MB/s 00:00 [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# scp -r /yinzhengjie/softwares/hadoop-3.1.2/ node103.yinzhengjie.org.cn:/yinzhengjie/softwares/ ........ maven-feather.png 100% 3330 3.0MB/s 00:00 bg.jpg 100% 486 479.9KB/s 00:00 h3.jpg 100% 431 342.5KB/s 00:00 icon_success_sml.gif 100% 990 1.3MB/s 00:00 icon_info_sml.gif 100% 606 618.2KB/s 00:00 breadcrumbs.jpg 100% 349 337.4KB/s 00:00 expanded.gif 100% 52 24.7KB/s 00:00 apache-maven-project-2.png 100% 33KB 6.1MB/s 00:00 icon_error_sml.gif 100% 1010 885.3KB/s 00:00 logo_apache.jpg 100% 33KB 13.3MB/s 00:00 icon_warning_sml.gif 100% 576 794.2KB/s 00:00 newwindow.png 100% 220 118.6KB/s 00:00 maven-logo-2.gif 100% 26KB 12.8MB/s 00:00 banner.jpg 100% 872 1.1MB/s 00:00 logo_maven.jpg 100% 26KB 12.5MB/s 00:00 collapsed.gif 100% 820 1.1MB/s 00:00 external.png 100% 230 138.1KB/s 00:00 h5.jpg 100% 357 342.5KB/s 00:00 build-by-maven-white.png 100% 2260 2.2MB/s 00:00 build-by-maven-black.png 100% 2294 512.3KB/s 00:00 maven-feather.png 100% 3330 2.0MB/s 00:00 index.html 100% 36KB 15.3MB/s 00:00 project-reports.html 100% 24KB 13.0MB/s 00:00 hdfs.h 100% 38KB 15.0MB/s 00:00 Pipes.hh 100% 6330 5.4MB/s 00:00 SerialUtils.hh 100% 4567 3.3MB/s 00:00 StringUtils.hh 100% 2441 2.0MB/s 00:00 TemplateFactory.hh 100% 3319 3.8MB/s 00:00 SecurityAuth-root.audit 100% 0 0.0KB/s 00:00 hadoop-root-namenode-node101.yinzhengjie.org.cn.out 100% 6151 4.2MB/s 00:00 hadoop-root-namenode-node101.yinzhengjie.org.cn.log 100% 40KB 13.0MB/s 00:00 hadoop-root-datanode-node101.yinzhengjie.org.cn.out 100% 695 251.3KB/s 00:00 hadoop-root-datanode-node101.yinzhengjie.org.cn.log 100% 34KB 14.3MB/s 00:00 hadoop-root-secondarynamenode-node101.yinzhengjie.org.cn.out 100% 695 770.6KB/s 00:00 hadoop-root-secondarynamenode-node101.yinzhengjie.org.cn.log 100% 33KB 15.9MB/s 00:00 [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# scp /etc/profile node102.yinzhengjie.org.cn:/etc/ profile 100% 2015 724.2KB/s 00:00 [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# scp /etc/profile node103.yinzhengjie.org.cn:/etc/ profile 100% 2015 109.9KB/s 00:00 [root@node101.yinzhengjie.org.cn ~]#
4>.格式化HDFS文件系统(目的是生成初始的元数据信息,生成的信息会存放在我们hdfs-core-site.xml配置文件中指定的工作目录下!温馨提示,在搭建集群的时执行一次就ok啦!千万别每次启动就执行!)
[root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# ll /data/hadoop/hdfs/ total 0 [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# hdfs namenode -format WARNING: /yinzhengjie/softwares/hadoop-3.1.2/logs does not exist. Creating. 2019-04-11 08:51:23,465 INFO namenode.NameNode: STARTUP_MSG: /************************************************************ STARTUP_MSG: Starting NameNode STARTUP_MSG: host = node101.yinzhengjie.org.cn/172.30.1.101 STARTUP_MSG: args = [-format] STARTUP_MSG: version = 3.1.2 STARTUP_MSG: classpath = /yinzhengjie/softwares/hadoop-3.1.2/etc/hadoop:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/accessors-smart-1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/asm-5.0.4.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/audience-annotations-0.5.0.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/avro-1.7.7.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/commons-beanutils-1.9.3.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/commons-cli-1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/commons-codec-1.11.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/commons-collections-3.2.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/commons-compress-1.18.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/commons-configuration2-2.1.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/commons-io-2.5.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/commons-lang-2.6.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/commons-lang3-3.4.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/commons-logging-1.1.3.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/commons-math3-3.1.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/commons-net-3.6.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/curator-client-2.13.0.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/curator-framework-2.13.0.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/curator-recipes-2.13.0.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/gson-2.2.4.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/guava-11.0.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/hadoop-annotations-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/hadoop-auth-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/htrace-core4-4.1.0-incubating.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/httpclient-4.5.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/httpcore-4.4.4.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jackson-annotations-2.7.8.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jackson-core-2.7.8.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jackson-core-asl-1.9.13.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jackson-databind-2.7.8.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jackson-jaxrs-1.9.13.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jackson-mapper-asl-1.9.13.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jackson-xc-1.9.13.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/javax.servlet-api-3.1.0.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jaxb-api-2.2.11.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jaxb-impl-2.2.3-1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jcip-annotations-1.0-1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jersey-core-1.19.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jersey-json-1.19.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jersey-server-1.19.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jersey-servlet-1.19.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jettison-1.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jetty-http-9.3.24.v20180605.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jetty-io-9.3.24.v20180605.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jetty-security-9.3.24.v20180605.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jetty-server-9.3.24.v20180605.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jetty-servlet-9.3.24.v20180605.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jetty-util-9.3.24.v20180605.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jetty-webapp-9.3.24.v20180605.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jetty-xml-9.3.24.v20180605.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jsch-0.1.54.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/json-smart-2.3.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jsp-api-2.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jsr305-3.0.0.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jsr311-api-1.1.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/kerb-admin-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/kerb-client-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/kerb-common-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/kerb-core-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/kerb-crypto-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/kerb-identity-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/kerb-server-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/kerb-simplekdc-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/kerb-util-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/kerby-asn1-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/kerby-config-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/kerby-pkix-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/kerby-util-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/kerby-xdr-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/log4j-1.2.17.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/netty-3.10.5.Final.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/nimbus-jose-jwt-4.41.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/paranamer-2.3.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/protobuf-java-2.5.0.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/re2j-1.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/slf4j-api-1.7.25.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/snappy-java-1.0.5.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/stax2-api-3.1.4.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/token-provider-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/woodstox-core-5.0.3.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/zookeeper-3.4.13.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/jul-to-slf4j-1.7.25.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/lib/metrics-core-3.2.4.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/hadoop-common-3.1.2-tests.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/hadoop-common-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/hadoop-nfs-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/common/hadoop-kms-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/commons-daemon-1.0.13.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jetty-util-ajax-9.3.24.v20180605.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/leveldbjni-all-1.8.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/netty-all-4.0.52.Final.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/okhttp-2.7.5.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/okio-1.6.0.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/hadoop-auth-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/commons-codec-1.11.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/log4j-1.2.17.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/httpclient-4.5.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/httpcore-4.4.4.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/commons-logging-1.1.3.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/nimbus-jose-jwt-4.41.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jcip-annotations-1.0-1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/json-smart-2.3.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/accessors-smart-1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/asm-5.0.4.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/zookeeper-3.4.13.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/audience-annotations-0.5.0.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/netty-3.10.5.Final.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/curator-framework-2.13.0.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/curator-client-2.13.0.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/guava-11.0.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jsr305-3.0.0.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/kerb-simplekdc-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/kerb-client-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/kerby-config-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/kerb-core-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/kerby-pkix-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/kerby-asn1-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/kerby-util-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/kerb-common-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/kerb-crypto-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/commons-io-2.5.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/kerb-util-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/token-provider-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/kerb-admin-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/kerb-server-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/kerb-identity-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/kerby-xdr-1.0.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jersey-core-1.19.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jsr311-api-1.1.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jersey-server-1.19.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/javax.servlet-api-3.1.0.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/json-simple-1.1.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jetty-server-9.3.24.v20180605.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jetty-http-9.3.24.v20180605.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jetty-util-9.3.24.v20180605.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jetty-io-9.3.24.v20180605.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jetty-webapp-9.3.24.v20180605.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jetty-xml-9.3.24.v20180605.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jetty-servlet-9.3.24.v20180605.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jetty-security-9.3.24.v20180605.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/hadoop-annotations-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/commons-cli-1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/commons-math3-3.1.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/commons-net-3.6.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/commons-collections-3.2.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jersey-servlet-1.19.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jersey-json-1.19.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jettison-1.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jaxb-impl-2.2.3-1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jaxb-api-2.2.11.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jackson-core-asl-1.9.13.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jackson-mapper-asl-1.9.13.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jackson-jaxrs-1.9.13.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jackson-xc-1.9.13.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/commons-lang-2.6.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/commons-beanutils-1.9.3.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/commons-configuration2-2.1.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/commons-lang3-3.4.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/avro-1.7.7.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/paranamer-2.3.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/snappy-java-1.0.5.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/commons-compress-1.18.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/re2j-1.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/protobuf-java-2.5.0.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/gson-2.2.4.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jsch-0.1.54.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/curator-recipes-2.13.0.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/htrace-core4-4.1.0-incubating.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jackson-databind-2.7.8.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jackson-annotations-2.7.8.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/jackson-core-2.7.8.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/stax2-api-3.1.4.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/lib/woodstox-core-5.0.3.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/hadoop-hdfs-3.1.2-tests.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/hadoop-hdfs-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/hadoop-hdfs-nfs-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/hadoop-hdfs-client-3.1.2-tests.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/hadoop-hdfs-client-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/hadoop-hdfs-native-client-3.1.2-tests.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/hadoop-hdfs-native-client-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/hadoop-hdfs-rbf-3.1.2-tests.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/hadoop-hdfs-rbf-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/hdfs/hadoop-hdfs-httpfs-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/mapreduce/lib/hamcrest-core-1.3.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/mapreduce/lib/junit-4.11.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/mapreduce/hadoop-mapreduce-client-app-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/mapreduce/hadoop-mapreduce-client-common-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/mapreduce/hadoop-mapreduce-client-core-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/mapreduce/hadoop-mapreduce-client-hs-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/mapreduce/hadoop-mapreduce-client-hs-plugins-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-3.1.2-tests.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/mapreduce/hadoop-mapreduce-client-nativetask-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/mapreduce/hadoop-mapreduce-client-shuffle-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/mapreduce/hadoop-mapreduce-client-uploader-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/mapreduce/hadoop-mapreduce-examples-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/lib/HikariCP-java7-2.4.12.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/lib/aopalliance-1.0.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/lib/dnsjava-2.1.7.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/lib/ehcache-3.3.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/lib/fst-2.50.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/lib/geronimo-jcache_1.0_spec-1.0-alpha-1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/lib/guice-4.0.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/lib/guice-servlet-4.0.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/lib/jackson-jaxrs-base-2.7.8.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/lib/jackson-jaxrs-json-provider-2.7.8.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/lib/jackson-module-jaxb-annotations-2.7.8.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/lib/java-util-1.9.0.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/lib/javax.inject-1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/lib/jersey-client-1.19.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/lib/jersey-guice-1.19.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/lib/json-io-2.5.1.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/lib/metrics-core-3.2.4.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/lib/mssql-jdbc-6.2.1.jre7.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/lib/objenesis-1.0.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/lib/snakeyaml-1.16.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/lib/swagger-annotations-1.5.4.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/hadoop-yarn-api-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/hadoop-yarn-applications-distributedshell-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/hadoop-yarn-applications-unmanaged-am-launcher-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/hadoop-yarn-client-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/hadoop-yarn-common-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/hadoop-yarn-registry-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/hadoop-yarn-server-applicationhistoryservice-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/hadoop-yarn-server-common-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/hadoop-yarn-server-nodemanager-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/hadoop-yarn-server-resourcemanager-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/hadoop-yarn-server-router-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/hadoop-yarn-server-sharedcachemanager-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/hadoop-yarn-server-tests-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/hadoop-yarn-server-timeline-pluginstorage-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/hadoop-yarn-server-web-proxy-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/hadoop-yarn-services-api-3.1.2.jar:/yinzhengjie/softwares/hadoop-3.1.2/share/hadoop/yarn/hadoop-yarn-services-core-3.1.2.jar STARTUP_MSG: build = https://github.com/apache/hadoop.git -r 1019dde65bcf12e05ef48ac71e84550d589e5d9a; compiled by 'sunilg' on 2019-01-29T01:39Z STARTUP_MSG: java = 1.8.0_201 ************************************************************/ 2019-04-11 08:51:23,477 INFO namenode.NameNode: registered UNIX signal handlers for [TERM, HUP, INT] 2019-04-11 08:51:23,658 INFO namenode.NameNode: createNameNode [-format] Formatting using clusterid: CID-f46b1d5c-b489-44e2-b8e0-7e02f938965a 2019-04-11 08:51:24,981 INFO namenode.FSEditLog: Edit logging is async:true 2019-04-11 08:51:25,001 INFO namenode.FSNamesystem: KeyProvider: null 2019-04-11 08:51:25,002 INFO namenode.FSNamesystem: fsLock is fair: true 2019-04-11 08:51:25,003 INFO namenode.FSNamesystem: Detailed lock hold time metrics enabled: false 2019-04-11 08:51:25,025 INFO namenode.FSNamesystem: fsOwner = root (auth:SIMPLE) 2019-04-11 08:51:25,025 INFO namenode.FSNamesystem: supergroup = supergroup 2019-04-11 08:51:25,025 INFO namenode.FSNamesystem: isPermissionEnabled = true 2019-04-11 08:51:25,026 INFO namenode.FSNamesystem: HA Enabled: false 2019-04-11 08:51:25,106 INFO common.Util: dfs.datanode.fileio.profiling.sampling.percentage set to 0. Disabling file IO profiling 2019-04-11 08:51:25,132 INFO blockmanagement.DatanodeManager: dfs.block.invalidate.limit: configured=1000, counted=60, effected=1000 2019-04-11 08:51:25,132 INFO blockmanagement.DatanodeManager: dfs.namenode.datanode.registration.ip-hostname-check=true 2019-04-11 08:51:25,144 INFO blockmanagement.BlockManager: dfs.namenode.startup.delay.block.deletion.sec is set to 000:00:00:00.000 2019-04-11 08:51:25,145 INFO blockmanagement.BlockManager: The block deletion will start around 2019 Apr 11 08:51:25 2019-04-11 08:51:25,148 INFO util.GSet: Computing capacity for map BlocksMap 2019-04-11 08:51:25,148 INFO util.GSet: VM type = 64-bit 2019-04-11 08:51:25,182 INFO util.GSet: 2.0% max memory 839.5 MB = 16.8 MB 2019-04-11 08:51:25,182 INFO util.GSet: capacity = 2^21 = 2097152 entries 2019-04-11 08:51:25,214 INFO blockmanagement.BlockManager: dfs.block.access.token.enable = false 2019-04-11 08:51:25,223 INFO Configuration.deprecation: No unit for dfs.namenode.safemode.extension(30000) assuming MILLISECONDS 2019-04-11 08:51:25,223 INFO blockmanagement.BlockManagerSafeMode: dfs.namenode.safemode.threshold-pct = 0.9990000128746033 2019-04-11 08:51:25,223 INFO blockmanagement.BlockManagerSafeMode: dfs.namenode.safemode.min.datanodes = 0 2019-04-11 08:51:25,224 INFO blockmanagement.BlockManagerSafeMode: dfs.namenode.safemode.extension = 30000 2019-04-11 08:51:25,224 INFO blockmanagement.BlockManager: defaultReplication = 1 2019-04-11 08:51:25,224 INFO blockmanagement.BlockManager: maxReplication = 512 2019-04-11 08:51:25,224 INFO blockmanagement.BlockManager: minReplication = 1 2019-04-11 08:51:25,224 INFO blockmanagement.BlockManager: maxReplicationStreams = 2 2019-04-11 08:51:25,224 INFO blockmanagement.BlockManager: redundancyRecheckInterval = 3000ms 2019-04-11 08:51:25,224 INFO blockmanagement.BlockManager: encryptDataTransfer = false 2019-04-11 08:51:25,224 INFO blockmanagement.BlockManager: maxNumBlocksToLog = 1000 2019-04-11 08:51:25,281 INFO namenode.FSDirectory: GLOBAL serial map: bits=24 maxEntries=16777215 2019-04-11 08:51:25,297 INFO util.GSet: Computing capacity for map INodeMap 2019-04-11 08:51:25,298 INFO util.GSet: VM type = 64-bit 2019-04-11 08:51:25,298 INFO util.GSet: 1.0% max memory 839.5 MB = 8.4 MB 2019-04-11 08:51:25,298 INFO util.GSet: capacity = 2^20 = 1048576 entries 2019-04-11 08:51:25,299 INFO namenode.FSDirectory: ACLs enabled? false 2019-04-11 08:51:25,299 INFO namenode.FSDirectory: POSIX ACL inheritance enabled? true 2019-04-11 08:51:25,299 INFO namenode.FSDirectory: XAttrs enabled? true 2019-04-11 08:51:25,299 INFO namenode.NameNode: Caching file names occurring more than 10 times 2019-04-11 08:51:25,306 INFO snapshot.SnapshotManager: Loaded config captureOpenFiles: false, skipCaptureAccessTimeOnlyChange: false, snapshotDiffAllowSnapRootDescendant: true, maxSnapshotLimit: 65536 2019-04-11 08:51:25,307 INFO snapshot.SnapshotManager: SkipList is disabled 2019-04-11 08:51:25,312 INFO util.GSet: Computing capacity for map cachedBlocks 2019-04-11 08:51:25,313 INFO util.GSet: VM type = 64-bit 2019-04-11 08:51:25,313 INFO util.GSet: 0.25% max memory 839.5 MB = 2.1 MB 2019-04-11 08:51:25,313 INFO util.GSet: capacity = 2^18 = 262144 entries 2019-04-11 08:51:25,328 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.window.num.buckets = 10 2019-04-11 08:51:25,328 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.num.users = 10 2019-04-11 08:51:25,328 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.windows.minutes = 1,5,25 2019-04-11 08:51:25,336 INFO namenode.FSNamesystem: Retry cache on namenode is enabled 2019-04-11 08:51:25,336 INFO namenode.FSNamesystem: Retry cache will use 0.03 of total heap and retry cache entry expiry time is 600000 millis 2019-04-11 08:51:25,341 INFO util.GSet: Computing capacity for map NameNodeRetryCache 2019-04-11 08:51:25,341 INFO util.GSet: VM type = 64-bit 2019-04-11 08:51:25,341 INFO util.GSet: 0.029999999329447746% max memory 839.5 MB = 257.9 KB 2019-04-11 08:51:25,341 INFO util.GSet: capacity = 2^15 = 32768 entries 2019-04-11 08:51:25,441 INFO namenode.FSImage: Allocated new BlockPoolId: BP-210098328-172.30.1.101-1554997885432 2019-04-11 08:51:25,453 INFO common.Storage: Storage directory /data/hadoop/hdfs/dfs/name has been successfully formatted. 2019-04-11 08:51:25,465 INFO namenode.FSImageFormatProtobuf: Saving image file /data/hadoop/hdfs/dfs/name/current/fsimage.ckpt_0000000000000000000 using no compression 2019-04-11 08:51:25,560 INFO namenode.FSImageFormatProtobuf: Image file /data/hadoop/hdfs/dfs/name/current/fsimage.ckpt_0000000000000000000 of size 391 bytes saved in 0 seconds . 2019-04-11 08:51:25,609 INFO namenode.NNStorageRetentionManager: Going to retain 1 images with txid >= 0 2019-04-11 08:51:25,616 INFO namenode.NameNode: SHUTDOWN_MSG: /************************************************************ SHUTDOWN_MSG: Shutting down NameNode at node101.yinzhengjie.org.cn/172.30.1.101 ************************************************************/ [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# ll /data/hadoop/hdfs/ total 0 drwxr-xr-x 3 root root 18 Apr 11 08:51 dfs [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# ll /data/hadoop/hdfs/dfs/ total 0 drwxr-xr-x 3 root root 21 Apr 11 08:51 name [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# ll /data/hadoop/hdfs/dfs/name/current/ total 16 -rw-r--r-- 1 root root 391 Apr 11 08:51 fsimage_0000000000000000000 -rw-r--r-- 1 root root 62 Apr 11 08:51 fsimage_0000000000000000000.md5 -rw-r--r-- 1 root root 2 Apr 11 08:51 seen_txid -rw-r--r-- 1 root root 216 Apr 11 08:51 VERSION [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]#
5>.启动hadoop集群
[root@node101.yinzhengjie.org.cn ~]# ansible all -m shell -a 'jps' node101.yinzhengjie.org.cn | SUCCESS | rc=0 >> 14477 Jps node102.yinzhengjie.org.cn | SUCCESS | rc=0 >> 9874 Jps node103.yinzhengjie.org.cn | SUCCESS | rc=0 >> 9858 Jps [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# start-dfs.sh Starting namenodes on [node101.yinzhengjie.org.cn] Last login: Thu Apr 11 09:57:40 PDT 2019 from 172.30.1.101 on pts/5 Starting datanodes Last login: Thu Apr 11 09:58:11 PDT 2019 on pts/0 Starting secondary namenodes [node101.yinzhengjie.org.cn] Last login: Thu Apr 11 09:58:14 PDT 2019 on pts/0 [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# ansible all -m shell -a 'jps' node101.yinzhengjie.org.cn | SUCCESS | rc=0 >> 15219 NameNode 15576 SecondaryNameNode 15768 Jps node102.yinzhengjie.org.cn | SUCCESS | rc=0 >> 10016 DataNode 10108 Jps node103.yinzhengjie.org.cn | SUCCESS | rc=0 >> 10001 DataNode 10093 Jps [root@node101.yinzhengjie.org.cn ~]#
四.其他命令扩展
博主推荐阅读:Hadoop启动脚本分析。
未完待续......