天天看點

Hadoop Installation on Linux

[hadoop@karei hadoop]$ uname -a

linux karei 2.6.18-371.4.1.el5 #1 smp wed jan 8 18:42:07 est 2014 x86_64 x86_64 x86_64 gnu/linux

[hadoop@karei hadoop]$

[root@karei ~]# clustat

a. install

rpm -ihv jdk-8u45-linux-i586.rpm

b. set environment variables

export java_home=/usr/java/jdk1.8.0_45

export path=$path:$java_home/bin

export classpath=.:$java_home/lib/dt.jar:$java_home/lib/tools.jar

note: 

user: vi ~/.bash_profile --> source ~/.bash_profile

system: vi /etc/profile --> source /etc/profile

a. gunzip hadoop-2.7.0.tar.gz

b. tar -xvf hadoop-2.7.0.tar.gz -c /usr/local/

c. cd /usr/local/

d. mv hadoop-2.7.0 hadoop

export hadoop_home=/usr/local/hadoop

export path=$path:$hadoop_home/bin

export path=$path:$hadoop_home/sbin

#export java_library_path=$hadoop_home/lib/native:$java_library_path

export hadoop_conf_dir=$hadoop_home/etc/hadoop

export hadoop_mapred_home=$hadoop_home

export hadoop_common_home=$hadoop_home

export hadoop_hdfs_home=$hadoop_home

export yarn_home=$hadoop_home

#export hadoop_common_lib_native_dir=$hadoop_home/lib/native

#export hadoop_opts="$hadoop_opts -djava.library.path=$hadoop_home/lib" 

a. create group

groupadd bigdata

b. create user

adduser hadoop

c. add user into group

usermod -a -g bigdata hadoop

d. set password for user

passwd hadoop

e. chown hadoop home directory

chown hadoop:bigdata /usr/local/hadoop

a. ssh-keygen -t rsa 

b. ssh-copy-id <username>@<remote-host>

[root@karei hadoop]#

[root@karei hadoop]# cat $hadoop_home/etc/hadoop/masters

karei

hemei

[root@karei hadoop]# cat $hadoop_home/etc/hadoop/slaves

gerra

lephi

a. configure $hadoop_home/etc/hadoop/core-site.xml

b. configure $hadoop_home/etc/hadoop/yarn-site.xml

c. configure $hadoop_home/etc/hadoop/mapred-site.xml

d. configure $hadoop_home/etc/hadoop/hdfs-site.xml

[root@karei hadoop]# ./bin/hadoop namenode -format

[hadoop@karei hadoop]$ ./sbin/start-all.sh 

note: java hotspot(tm) server vm warning

solve: set environment about hadoop_common_lib_native_dir and hadoop_opts

export hadoop_common_lib_native_dir=$hadoop_home/lib/native

export hadoop_opts="$hadoop_opts -djava.library.path=$hadoop_home/lib"

[hadoop@karei hadoop]$ jps