# 关闭selinux
[iyunv@leaf ~]# setenforce 0
[iyunv@leaf ~]# sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config
[iyunv@leaf ~]# cat /etc/selinux/config | grep disabled
# disabled - No SELinux policy is loaded.
SELINUX=disabled
生成密钥对
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[iyunv@leaf ~]# mkdir .ssh
[iyunv@leaf ~]# ssh-keygen -t dsa -P '' -f .ssh/id_dsa
Generating public/private dsa key pair.
Your identification has been saved in .ssh/id_dsa.
Your public key has been saved in .ssh/id_dsa.pub.
The key fingerprint is:
5b:af:7c:45:f3:ff:dc:50:f5:81:4b:1e:5c:c1:86:90 root@leaf
The key's randomart image is:
+--[ DSA 1024]----+
| .o oo.|
| E..oo |
| =...|
| o = +|
| S . + oo|
| o . ...|
| . ... .|
| . .. oo|
| o. =|
+-----------------+
[iyunv@leaf ~]# ssh localhost
The authenticity of host 'localhost (::1)' can't be established.
RSA key fingerprint is d1:0d:ed:eb:e7:d1:2f:02:23:70:ef:11:14:4e:fa:42.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (RSA) to the list of known hosts.
Last login: Wed Aug 30 04:28:01 2017 from 10.0.0.1
[iyunv@leaf ~]#
在第一次登陆的时候需要输入yes,之后再登陆时就可以直接登陆了:
1
2
3
[iyunv@leaf ~]# ssh localhost
Last login: Wed Aug 30 04:44:02 2017 from localhost
[iyunv@leaf ~]#
[iyunv@leaf ~]# hadoop
Usage: hadoop [--config confdir] COMMAND
where COMMAND is one of:
fs run a generic filesystem user client
version print the version
jar <jar> run a jar file
checknative [-a|-h] check native hadoop and compression libraries availability
distcp <srcurl> <desturl> copy file or directories recursively
archive -archiveName NAME -p <parent path> <src>* <dest> create a hadoop archive
classpath prints the class path needed to get the
credential interact with credential providers
Hadoop jar and the required libraries
daemonlog get/set the log level for each daemon
trace view and modify Hadoop tracing settings
or
CLASSNAME run the class named CLASSNAME
Most commands print help when invoked w/o parameters.
[iyunv@leaf ~]# hadoop namenode -format
...
17/08/30 08:41:29 INFO namenode.NNStorageRetentionManager: Going to retain 1 images with txid >= 0
17/08/30 08:41:29 INFO util.ExitUtil: Exiting with status 0
17/08/30 08:41:29 INFO namenode.NameNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at leaf/127.0.0.1
************************************************************/
注意看输出显示是不是跟上面的类似,如果是,则说明操作成功。
(2)启动hadoop服务
执行如下命令:
1
2
3
4
5
6
7
8
9
10
11
12
[iyunv@leaf ~]# start-all.sh
This script is Deprecated. Instead use start-dfs.sh and start-yarn.sh
17/08/30 08:53:22 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Starting namenodes on [localhost]
localhost: starting namenode, logging to /usr/local/hadoop-2.6.5/logs/hadoop-root-namenode-leaf.out
localhost: starting datanode, logging to /usr/local/hadoop-2.6.5/logs/hadoop-root-datanode-leaf.out
Starting secondary namenodes [0.0.0.0]
0.0.0.0: starting secondarynamenode, logging to /usr/local/hadoop-2.6.5/logs/hadoop-root-secondarynamenode-leaf.out
17/08/30 08:53:48 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
starting yarn daemons
starting resourcemanager, logging to /usr/local/hadoop-2.6.5/logs/yarn-root-resourcemanager-leaf.out
localhost: starting nodemanager, logging to /usr/local/hadoop-2.6.5/logs/yarn-root-nodemanager-leaf.out