linuxidc@slave1:~$ sudo mkdir -p /hadoop/hdfs/name [sudo] password for linuxidc: jerry@slave1:~$ sudo mkdir -p /hadoop/hdfs/data linuxidc@slave1:~$ sudo mkdir -p /hadoop/mapred/mapred_system linuxidc@slave1:~$ sudo mkdir -p /hadoop/mapred/mapred_local linuxidc@slave1:~$ sudo mkdir -p /hadoop/hadooptmp linuxidc@slave1:~$ chown -R hadoop:hadoop /hadoop/ chown: changing ownership of ‘/hadoop/mapred/mapred_local’: Operation not permitted chown: changing ownership of ‘/hadoop/mapred/mapred_system’: Operation not permitted chown: changing ownership of ‘/hadoop/mapred’: Operation not permitted chown: changing ownership of ‘/hadoop/hdfs/data’: Operation not permitted chown: changing ownership of ‘/hadoop/hdfs/name’: Operation not permitted chown: changing ownership of ‘/hadoop/hdfs’: Operation not permitted chown: changing ownership of ‘/hadoop/hadooptmp’: Operation not permitted chown: changing ownership of ‘/hadoop/’: Operation not permitted linuxidc@slave1:~$ sudo chown -R hadoop:hadoop /hadoop/ linuxidc@slave1:~$
在master上生存ssh秘钥然后拷贝到slave1和slave2上的hadoop用户主目录下的.ssh文件目录下
hadoop@master:~$ sudo mkdir ~/.ssh [sudo] password for hadoop: hadoop@master:~$ sudo chown -R hadoop:hadoop ~/.ssh hadoop@master:~$ ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa Generating public/private rsa key pair. Your identification has been saved in /home/hadoop/.ssh/id_rsa. Your public key has been saved in /home/hadoop/.ssh/id_rsa.pub. The key fingerprint is: 36:99:e0:e9:aa:b8:c3:c6:cd:97:59:9f:49:87:0d:bf hadoop@master The key's randomart image is: +--[ RSA 2048]----+ | | | | | . | | . o + | | o S = | | . o + + | |o o = o + . | |.= o = + E | |+o..o | +-----------------+ hadoop@master:~/.ssh$ scp authorized_keys slave1:/home/hadoop/.ssh The authenticity of host 'slave1 (192.168.2.111)' can't be established. ECDSA key fingerprint is 48:93:30:0d:bb:3a:85:da:46:3f:75:76:3e:b7:42:6a. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'slave1,192.168.2.111' (ECDSA) to the list of known hosts. hadoop@slave1's password: scp: /home/hadoop/.ssh/authorized_keys: Permission denied hadoop@master:~/.ssh$ scp authorized_keys slave1:/home/hadoop/.ssh hadoop@slave1's password: authorized_keys 100% 395 0.4KB/s 00:00 hadoop@master:~/.ssh$ scp authorized_keys slave2:/home/hadoop/.ssh The authenticity of host 'slave2 (192.168.2.112)' can't be established. ECDSA key fingerprint is 48:93:30:0d:bb:3a:85:da:46:3f:75:76:3e:b7:42:6a. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'slave2,192.168.2.112' (ECDSA) to the list of known hosts. hadoop@slave2's password: authorized_keys 100% 395 0.4KB/s 00:00 hadoop@master:~/.ssh$
再测试下是否再次ssh连接的时候需要键入密码。结果是不需要的。