一、本地运行方式
1 创建在hadoop-3.3.5文件下面创建一个wcinput文件夹
2 回到Hadoop目录/opt/module/hadoop-3.3.5 执行程序如下
3 查看执行后的结果
二 、编写集群分发脚本
1 在其中一台虚拟机上创建一个文件
2 给用户授权并能操作 /opt/module
3 通过命令进行文件拷贝,拷贝给hadoop 3,需要知道hadoop 3的密码
[antares@hadoop2 hadoop-3.3.5]$ ls
bin include lib LICENSE-binary LICENSE.txt NOTICE.txt sbin wcinput
etc kang.txt libexec licenses-binary NOTICE-binary README.txt share wcoutput
[antares@hadoop2 hadoop-3.3.5]$ pwd
/opt/module/hadoop-3.3.5
[antares@hadoop2 hadoop-3.3.5]$ scp -r /opt/module/hadoop-3.3.5/kang.txt antares@hadoop3:/opt/module/hadoop-3.3.5/
The authenticity of host 'hadoop3 (192.168.193.176)' can't be established.
ECDSA key fingerprint is SHA256:HmeFoPbjR1dLiPcwjnlsYhOq3EiaJirR7H9jcjQnBfU.
ECDSA key fingerprint is MD5:d2:d9:4f:61:0b:5a:65:c1:c0:48:d7:b4:c2:f2:1f:1a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'hadoop3,192.168.193.176' (ECDSA) to the list of known hosts.
antares@hadoop3's password:
kang.txt
另外一台的操作同样使用上述命令,同意(yes)后再输入password 接口拷贝成功。可登录刚拷贝的虚拟机查看是否已经拷贝成功。