hadoop1.2备忘录

单机部署

一、JDK

sudo apt-get install openjdk-7-jdk
vim /etc/profile
添加以下内容,若jdk安装目录不同,需修改JAVA_HOME
# java env
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export JRE_HOME=$JAVA_HOME/jre
export HADOOP_HOME=/opt/hadoop-1.2.1
export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$HADOOP_HOME/bin:$PATH
# end

二、配置

wget https://archive.apache.org/dist/hadoop/core/hadoop-1.2.1/hadoop-1.2.1.tar.gz
mv hadoop-1.2.1.tar.gz /opt
tar -zxf hadoop-1.2.1.tar.gz
cd hadoop-1.2.1/conf

vim hadoop-env.sh

修改:

export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64

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>/hadoop</value>
</property>
<property>
  <name>fs.default.name</name>
  <value>hdfs://master:9000</value>
</property>
<property>
  <name>dfs.name.dir</name>
  <value>/hadoop/name</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>
<property>
    <name>dfs.data.dir</name>
    <value>/hadoop/data</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>master:9001</value>
</property>
<property>
    <name>mapred.system.dir</name>
    <value>/hadoop/mapred_system</value>
</property>
<property>
    <name>mapred.local.dir</name>
    <value>/hadoop/mapred_local</value>
</property>
</configuration>


vim masters

修改:

master


vim slaves

修改:

master


三、SSH

cd /root/.ssh
ssh-keygen
cat id_rsa.pub > authorized_keys

四、启动

hadoop namenode -format
start-all.sh

五、检查

jps
hadoop fs -ls /


你可能感兴趣的:(hadoop1.2备忘录)