# 此时可以通过ssh远程连接Docker容器了
$ ssh root@10.211.55.4 -p 9999
# 先初始化namenode
admin@Ben:/$ cd /software/hadoop-2.7.1/bin
admin@Ben:/software/hadoop-2.7.1/sbin$ ./hdfs namenode -format
# 看到类似下面的信息就说明初始化namenode成功了
16/06/06 03:27:57 INFO namenode.FSNamesystem: Retry cache will use 0.03 of total heap and retry cache entry expiry time is 600000 millis
16/06/06 03:27:57 INFO util.GSet: Computing capacity for map NameNodeRetryCache
16/06/06 03:27:57 INFO util.GSet: VM type = 64-bit
16/06/06 03:27:57 INFO util.GSet: 0.029999999329447746% max memory 889 MB = 273.1 KB
16/06/06 03:27:57 INFO util.GSet: capacity = 2^15 = 32768 entries
16/06/06 03:27:57 INFO namenode.FSImage: Allocated new BlockPoolId: BP-581626940-172.17.0.2-1465183677567
16/06/06 03:27:57 INFO common.Storage: Storage directory /software/hadoop-2.7.1/hdfs/name has been successfully formatted.
16/06/06 03:27:57 INFO namenode.NNStorageRetentionManager: Going to retain 1 images with txid >= 0
16/06/06 03:27:57 INFO util.ExitUtil: Exiting with status 0
16/06/06 03:27:57 INFO namenode.NameNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at Ben/172.17.0.2
************************************************************/
# 启动所有服务
admin@Ben:/$ cd /software/hadoop-2.7.1/sbin
admin@Ben:/software/hadoop-2.7.1/sbin$ ./start-all.sh
# 下面的过程就是启动Hadoop的过程,但是始终需要输入ssh的密码,不知道为啥
This script is Deprecated. Instead use start-dfs.sh and start-yarn.sh
Starting namenodes on [Ben]
Ben: Could not create directory '/home/admin/.ssh'.
The authenticity of host 'ben (172.17.0.2)' can't be established.
ECDSA key fingerprint is ae:ec:44:6d:64:48:e8:34:17:33:cf:86:07:20:e3:4d.
Are you sure you want to continue connecting (yes/no)? yes
Ben: Failed to add the host to the list of known hosts (/home/admin/.ssh/known_hosts).
admin@ben's password:
Ben: Could not chdir to home directory /home/admin: No such file or directory
Ben: starting namenode, logging to /software/hadoop-2.7.1/logs/hadoop-admin-namenode-Ben.out
localhost: Could not create directory '/home/admin/.ssh'.
The authenticity of host 'localhost (::1)' can't be established.
ECDSA key fingerprint is ae:ec:44:6d:64:48:e8:34:17:33:cf:86:07:20:e3:4d.
Are you sure you want to continue connecting (yes/no)? yes
localhost: Failed to add the host to the list of known hosts (/home/admin/.ssh/known_hosts).
admin@localhost's password:
localhost: Could not chdir to home directory /home/admin: No such file or directory
localhost: starting datanode, logging to /software/hadoop-2.7.1/logs/hadoop-admin-datanode-Ben.out
Starting secondary namenodes [Ben]
Ben: Could not create directory '/home/admin/.ssh'.
The authenticity of host 'ben (172.17.0.2)' can't be established.
ECDSA key fingerprint is ae:ec:44:6d:64:48:e8:34:17:33:cf:86:07:20:e3:4d.
Are you sure you want to continue connecting (yes/no)? yes
Ben: Failed to add the host to the list of known hosts (/home/admin/.ssh/known_hosts).
admin@ben's password:
Ben: Could not chdir to home directory /home/admin: No such file or directory
Ben: starting secondarynamenode, logging to /software/hadoop-2.7.1/logs/hadoop-admin-secondarynamenode-Ben.out
starting yarn daemons
starting resourcemanager, logging to /software/hadoop-2.7.1/logs/yarn-admin-resourcemanager-Ben.out
localhost: Could not create directory '/home/admin/.ssh'.
The authenticity of host 'localhost (::1)' can't be established.
ECDSA key fingerprint is ae:ec:44:6d:64:48:e8:34:17:33:cf:86:07:20:e3:4d.
Are you sure you want to continue connecting (yes/no)? yes
localhost: Failed to add the host to the list of known hosts (/home/admin/.ssh/known_hosts).
admin@localhost's password:
localhost: Could not chdir to home directory /home/admin: No such file or directory
localhost: starting nodemanager, logging to /software/hadoop-2.7.1/logs/yarn-admin-nodemanager-Ben.out
# 执行jps命令之前需要先把$JAVA_HOME/bin添加到PATH环境变量
admin@Ben:/$ export PATH=/software/jdk7/bin/:$PATH
# 执行jps命令如果能看到下面的6个进程就说明Hadoop启动的没有问题
admin@Ben:/software/hadoop-2.7.1/sbin$ jps
985 Jps
282 DataNode
587 ResourceManager
436 SecondaryNameNode
166 NameNode
691 NodeManager