软件安装
yum install -y rsync* openssh*
yum install -y ld-linux.so.2
groupadd hadoop
useradd hadoop -g hadoop
mkdir /usr/local/hadoop
mkdir -p /usr/local/java
service iptables stop
ssh-keygen -t rsa 192.168.31.243配置 (192.168.31.165配置相同)
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
vim core-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration> 红色为需要修改的地方
<property>
<name>hadoop.tmp.dir</name>
<value>/usr/local/hadoop/tmp</value>
<description>A base for other temporary directories.</description>
</property>
<!-- file system properties -->
<property>
<name>fs.default.name</name>
<value>hdfs://192.168.31.243:9000</value>
</property>
</configuration>
vim hdfs-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>dfs.replication</name>
<value>3</value>
</property>
</configuration>
vim mapred-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name> mapred.job.tracker</name>
<value>http://192.168.21.243:9001</value>
</property>
</configuration>
cp masters masters.bak
vim masters
localhost
192.168.31.243
cp slave slave.bak 192.168.31.165配置
vim /usr/local/hadoop/conf/slaves
localhost
192.168.31.165
/usr/local/hadoop/bin/hadoop namenode -format
Warning: $HADOOP_HOME is deprecated.
16/09/21 22:51:13 INFO namenode.NameNode: STARTUP_MSG:
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG: host = java.net.UnknownHostException: centos6: centos6
STARTUP_MSG: args = [-format]
STARTUP_MSG: version = 1.0.0
STARTUP_MSG: build = https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.0 -r 1214675; compiled by 'hortonfo' on Thu Dec 15 16:36:35 UTC 2011
************************************************************/
16/09/21 22:51:14 INFO util.GSet: VM type = 32-bit
16/09/21 22:51:14 INFO util.GSet: 2% max memory = 19.33375 MB
16/09/21 22:51:14 INFO util.GSet: capacity = 2^22 = 4194304 entries
16/09/21 22:51:14 INFO util.GSet: recommended=4194304, actual=4194304
16/09/21 22:51:14 INFO namenode.FSNamesystem: fsOwner=root
16/09/21 22:51:14 INFO namenode.FSNamesystem: supergroup=supergroup
16/09/21 22:51:14 INFO namenode.FSNamesystem: isPermissionEnabled=true
16/09/21 22:51:14 INFO namenode.FSNamesystem: dfs.block.invalidate.limit=100
16/09/21 22:51:14 INFO namenode.FSNamesystem: isAccessTokenEnabled=false accessKeyUpdateInterval=0 min(s), accessTokenLifetime=0 min(s)
16/09/21 22:51:14 INFO namenode.NameNode: Caching file names occuring more than 10 times
16/09/21 22:51:14 INFO common.Storage: Image file of size 110 saved in 0 seconds.
16/09/21 22:51:14 INFO common.Storage: Storage directory /usr/local/hadoop/tmp/dfs/name has been successfully formatted.
16/09/21 22:51:14 INFO namenode.NameNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at java.net.UnknownHostException: centos6: centos6
************************************************************/
/usr/local/hadoop/bin/start-all.sh
Warning: $HADOOP_HOME is deprecated.
starting namenode, logging to /usr/local/hadoop/libexec/../logs/hadoop-root-namenode-centos6.out
The authenticity of host 'localhost (::1)' can't be established.
RSA key fingerprint is 81:d9:c6:54:a9:99:27:c0:f7:5f:c3:15:d5:84:a0:99.
Are you sure you want to continue connecting (yes/no)? yes
localhost: Warning: Permanently added 'localhost' (RSA) to the list of known hosts.
root@localhost's password:
localhost: starting datanode, logging to /usr/local/hadoop/libexec/../logs/hadoop-root-datanode-centos6.out
The authenticity of host '192.168.31.243 (192.168.31.243)' can't be established.
RSA key fingerprint is 81:d9:c6:54:a9:99:27:c0:f7:5f:c3:15:d5:84:a0:99.
Are you sure you want to continue connecting (yes/no)? yes
192.168.31.243: Warning: Permanently added '192.168.31.243' (RSA) to the list of known hosts.
root@192.168.31.243's password:
192.168.31.243: starting secondarynamenode, logging to /usr/local/hadoop/libexec/../logs/hadoop-root-secondarynamenode-centos6.out
starting jobtracker, logging to /usr/local/hadoop/libexec/../logs/hadoop-root-jobtracker-centos6.out
root@localhost's password:
localhost: starting tasktracker, logging to /usr/local/hadoop/libexec/../logs/hadoop-root-tasktracker-centos6.out