Hadoop 2.5.1 + HBase 0.98 单机
Package path: young@ds85:~/something/download
=====================================================================
1 安装环境
代码:
sudo apt-get install openssh-server
sudo apt-get install default-jdk
sudo apt-get install default-jdk
2 安装hadoop
代码:
wget http://mirror.ox.ac.uk/sites/rsync.apache.org/hadoop/common/hadoop-2.5.1/hadoop-2.5.1.tar.gz
tar xzf hadoop-2.4.0.tar.gz
sudo mv hadoop-2.4.0/ /usr/local
cd /usr/local
sudo ln -s hadoop-2.4.0/ hadoop
tar xzf hadoop-2.4.0.tar.gz
sudo mv hadoop-2.4.0/ /usr/local
cd /usr/local
sudo ln -s hadoop-2.4.0/ hadoop
3 加一个 hadoop 用户
代码:
sudo adduser hadoop
sudo chown -R hadoop:hadoop /usr/local/hadoop*
sudo su - hadoop
ssh-keygen -t rsa -P ""
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
sudo mkdir /usr/local/hadoop/tmp
sudo chown -R hadoop:hadoop /usr/local/hadoop*
sudo su - hadoop
ssh-keygen -t rsa -P ""
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
sudo mkdir /usr/local/hadoop/tmp
4 配置 hadoop
修改 /usr/local/hadoop/etc/hadoop/hadoop-env.sh 在 export JAVA_HOME=${JAVA_HOME} 行前面插入如下内容
代码:
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export HADOOP_CONF_DIR=/usr/local/hadoop/etc/hadoop
export HADOOP_CONF_DIR=/usr/local/hadoop/etc/hadoop
修改 /usr/local/hadoop/etc/hadoop/core-site.xml 在 <configuration> 后面增加
代码:
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/usr/local/hadoop/tmp</value>
</property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/usr/local/hadoop/tmp</value>
</property>
5 格式化 hadoop
代码:
/usr/local/hadoop/bin/hadoop namenode -format
6 启动 hadoop
代码:
/usr/local/hadoop/sbin/start-all.sh
7 测试 hadoop
代码:
/usr/local/hadoop/bin/hadoop fs -df
#8 停止 hadoop
#/usr/local/hadoop/sbin/stop-all.sh
9 退出 hadoop 用户
exit
--------------------------------------
HBASE
1 安装:
代码:
wget http://mirror.bit.edu.cn/apache/hbase/stable/hbase-0.98.6-hadoop2-bin.tar.gz
tar xzf hbase-0.98.6-hadoop2-bin.tar.gz
sudo mv hbase-0.98.6-hadoop2 /usr/local/
cd /usr/local/
sudo ln -s hbase-0.98.6-hadoop2/ hbase
sudo chown -R hadoop:hadoop hbase*
tar xzf hbase-0.98.6-hadoop2-bin.tar.gz
sudo mv hbase-0.98.6-hadoop2 /usr/local/
cd /usr/local/
sudo ln -s hbase-0.98.6-hadoop2/ hbase
sudo chown -R hadoop:hadoop hbase*
2 配置:
代码:
sudo su - hadoop
编辑 /usr/local/hbase/conf/hbase-env.sh 找到 export JAVA_HOME 的行,在后面插入:
代码:
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export HBASE_HOME=/usr/local/hbase
export HBASE_HOME=/usr/local/hbase
编辑 /usr/local/hbase/conf/hbase-site.xml 在 <configuration> 行后面插入:
代码:
<property>
<name>hbase.rootdir</name>
<value>hdfs://localhost:9000/hbase</value>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<name>hbase.rootdir</name>
<value>hdfs://localhost:9000/hbase</value>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
3 启动:
代码:
/usr/local/hbase/bin/start-hbase.sh
4 测试:
代码:
/usr/local/hbase/bin/hbase shell
hbase(main):001:0> status
hbase(main):001:0> status
#5 关闭:
#/usr/local/hbase/bin/stop-hbase.sh