最近又安装了一次hadoop系列,以前装过几次,但总也是磕磕碰碰的,本来想这次安装一步到位,可惜以前记录不够详细,中间还是过程还是有些遗漏,这次把过程详细记录起来。hadoop-1.1.2, hbase-0.95-hadoop1, hive-0.10 + snappy压缩。中间遇到不少坑,记录下来;由于这次目标是三件套一步到位,因此配置的时候是一块配置了,三台ubuntu机器分别为zmhadoop (hadoop master)、xbhadoop(hbase master)、 gnhadoop
首先下载三件套tar.gz 放到一台机器的/data/cloud目录下, 解压; 最好建立软连接 ln -s hadoop-1.1.2 hadoop; hbase hive同理。
配置三件套首先有要做的几件事:
ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys sudo chmod 400 ~/.ssh/authorized_keys
<property> <name>fs.default.name</name> <value>hdfs://zmhadoop:9000</value> </property> <property> <name>fs.checkpoint.dir</name> <value>/data/cloud/dfs/namesecondary</value> </property> <property> <name>hadoop.tmp.dir</name> <value>/data/cloud/dfs/tmp</value> </property> <property> <name>fs.checkpoint.period</name> <value>1800</value> </property> <property> <name>io.compression.codecs</name> <value>org.apache.hadoop.io.compress.GzipCodec,org.apache.hadoop.io.compress.DefaultCodec,org.apache.hadoop.io.compress.BZip2Codec,org.apache.hadoop.io.compress.SnappyCodec</value> </property> <property> <name>mapred.output.compress</name> <value>true</value> <description>Should the job outputs be compressed? </description> </property> <property> <name>mapred.output.compression.codec</name> <value>org.apache.hadoop.io.compress.SnappyCodec</value> <description>If the job outputs are compressed, how should they be compressed? </description> </property>
<property> <name>dfs.replication</name> <value>2</value> </property> <property> <name>dfs.data.dir</name> <value>/data/cloud/dfs/data</value> </property> <property> <name>dfs.balance.bandwidthPerSec</name> <value>10485760</value> </property> <property> <name>dfs.name.dir</name> <value>/data/cloud/dfs/name</value> </property>
<property> <name>mapred.job.tracker</name> <value>zmhadoop:9001</value> </property> <property> <name>mapred.system.dir</name> <value>/data/cloud/dfs/mapred/system</value> </property> <property> <name>mapred.local.dir</name> <value>/data/cloud/dfs/mapred/local</value> </property> <property> <name>mapred.temp.dir</name> <value>/data/cloud/dfs/mapred/tmp</value> </property> <property> <name>mapred.compress.map.output</name> <value>true</value> </property> <property> <name>mapred.map.output.compression.codec</name> <value>org.apache.hadoop.io.compress.SnappyCodec</value> </property>
export JAVA_HOME=/data/jdk1.7.0_21/ export HBASE_HOME=/data/cloud/hbase export HADOOP_HOME=/data/cloud/hadoop export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HADOOP_HOME/lib/native/Linux-amd64-64:/usr/local/lib export JAVA_LIBRARY_PATH=$HADOOP_HOME/lib/native/Linux-amd64-64 #Extra Java CLASSPATH elements. Optional. export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:$HADOOP_HOME/lib/hadoop-snappy-0.0.1-SNAPSHOT.jar:$HBASE_HOME/conf:$HBASE_HOME/lib/zookeeper-3.4.5.jar:$HBASE_HOME/lib/hbase*.jar
<property> <name>hbase.rootdir</name> <value>hdfs://zmhadoop:9000/hbase</value> </property> <property> <name>hbase.cluster.distributed</name> <value>true</value> </property> <property> <name>hbase.master</name> <value>xbhadoop:60000</value> </property> <property> <name>hbase.master.port</name> <value>60000</value> <description>The port master should bind to.</description> </property> <property> <name>hbase.zookeeper.quorum</name> <value>xbhadoop,zmhadoop,gnhadoop</value> </property>
export JAVA_HOME=/data/jdk1.7.0_21/ export HBASE_OPTS="$HBASE_OPTS -XX:+HeapDumpOnOutOfMemoryError -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode" export HBASE_MANAGES_ZK=false export HBASE_HOME=/data/cloud/hbase export HADOOP_HOME=/data/cloud/hadoop export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HADOOP_HOME/lib/native/Linux-amd64-64/:/usr/local/lib/ export HBASE_LIBRARY_PATH=$HBASE_LIBRARY_PATH:$HBASE_HOME/lib/native/Linux-amd64-64/:/usr/local/lib/:$HBASE_HOME/lib/hadoop-snappy-0.0.1-SNAPSHOT.jar
mysql> CREATE DATABASE metastore; mysql> USE metastore; mysql> SOURCE /usr/lib/hive/scripts/metastore/upgrade/mysql/hive-schema-0.9.0.mysql.sql;
<property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://MYHOST/metastore</value> //自己用mysql登陆一下看行不行 </property> <property> <name>javax.jdo.option.ConnectionDriverName</name> <value>com.mysql.jdbc.Driver</value> </property> <property> <name>javax.jdo.option.ConnectionUserName</name> <value>hiveuser</value> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>password</value> </property> <property> <name>datanucleus.autoCreateSchema</name> <value>false</value> </property> <property> <name>datanucleus.fixedDatastore</name> <value>true</value> </property>
export HBASE_HOME=/data/cloud/hbase export HADOOP_HOME=/data/cloud/hadoop export HIVE_HOME=/data/cloud/hive
$HADOOP_HOME/bin/hadoop format namenode
$HADOOP_HOME/bin/start-all.sh
$HBASE_HOME/bin/start-hbase.sh