hadoop2.3.0单点伪分布与多点分布的配置(一)

2014-11-24 16:37:18 · 作者: · 浏览: 0

机器mac book,virtualbox4.3.6,virtualbox安装ubunt13.10,在多点分布环境中,配置好一个机器后,clone出另外2个,一共三台机器。

1. Configure the Environment

Bash语言: sudo apt-get install -y openjdk-7-jdk openssh-server

sudo addgroup hadoop

sudo adduser —ingroup hadoop hadoop # create password

sudo visudo

hadoop ALL=(ALL) ALL # hadoop user can use sudo

su - hadoop # need password

ssh-keygen -t rsa -P "" # Enter file (/home/hadoop/.ssh/id_rsa)

cat /home/hadoop/.ssh/id_rsa.pub >> /home/hadoop/.ssh/authorized_keys

wget http://apache.fayea.com/apache-mirror/hadoop/common/hadoop-2.3.0/hadoop-2.3.0.tar.gz

tar zxvf hadoop-2.3.0.tar.gz

sudo cp -r hadoop-2.3.0/ /opt

cd /opt

sudo ln -s hadoop-2.3.0 hadoop

sudo chown -R hadoop:hadoop hadoop-2.3.0

sed -i '$a \\nexport JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64' hadoop/etc/hadoop/hadoop-env.sh

2. Configure hadoop single Node environment

cp mapred-site.xml.template mapred-site.xml

vi mapred-site.xml

mapreduce.cluster.temp.dir

No description

true

mapreduce.cluster.local.dir

No description

true

vi yarn-site.xml

yarn.resourcemanager.resource-tracker.address

127.0.0.1:8021

host is the hostname of the resource manager and port is the port on which the NodeManagers contact the Resource Manager.

yarn.resourcemanager.scheduler.address

127.0.0.1:8022

host is the hostname of the resourcemanager and port is the port on which the Applications in the cluster talk to the Resource Manager.

yarn.resourcemanager.scheduler.class

org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler

In case you do not want to use the default scheduler

yarn.resourcemanager.address

127.0.0.1:8023

the host is the hostname of the ResourceManager and the port is the port on which the clients can talk to the Resource Manager.

yarn.nodemanager.local-dirs

the local directories used by the nodemanager

yarn.nodemanager.address

0.0.0.0:8041

the nodemanagers bind to this port

yarn.nodemanager.resource.memory-mb

10240

the amount of memory on the NodeManager in GB

yarn.nodemanager.remote-app-log-dir

/app-logs

directory on hdfs where the application logs are moved to

yarn.nodemanager.log-dirs

the directories used by Nodemanagers as log directories

yarn.nodemanager.aux-services

mapreduce_shuffle

shuffle service that needs to be set for Map Reduce to run

补充配置:

mapred-site.xml

mapreduce.framework.name

yarn

core-site.xml

fs.defaultFS

hdfs://127.0.0.1:9000

hdfs-site.xml

dfs.replication

1

Bash语言: cd /opt/hadoop

bin/hdfs namenode -format

sbin/hadoop-daemon.sh start namenode

sbin/hadoop-daemon.sh start datanode

sbin/yarn-daemon.sh start resourcemanager

sbin/yarn-daemon.sh start nodemanager

jps

# Run a job on this node

bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.3.0.jar pi 5 10

3. Running Problem

14/01/04 05:38:22 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:8023. Already tried 9 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)

netstat -atnp # found tcp6

Solve:

cat /proc/sys/net/ipv6/conf/all/disable_ipv6 # 0 means ipv6 is on, 1 means off

cat /proc/sys/net/ipv6/conf/lo/disable_ipv6

cat /proc/sys/net/ipv6/conf/default/disable_ipv6

ip a | grep inet6 # have means ipv6 is on

vi /etc/sysctl.conf

net.ipv6.conf.all.disable_ipv6=