fedora22下安装配置hbase

来源:互联网 发布:反光镜乐队 知乎 编辑:程序博客网 时间:2024/06/05 05:52

hbase-0.98.14-hadoop2-bin
hadoop-2.7.1
zookeeper-3.4.6

ssh免密码登陆:

ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keyschomod 600 ~/.ssh/authorized_keys

输入如下命令验证免密码登录是否成功:
ssh localhost

hadoop配置:

  • 1.总体环境变量

/etc/profile

 export HADOOP_HOME=/opt/hadoop export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin export CLASSPATH=$CLASSPATH:$HADOOP_HOME/lib export HBASE_HOME=/opt/hbase export PATH=$PATH:$HBASE_HOME/bin export ZOOKEEPER=/opt/zookeeper-3.4.6 export PATH=$PATH:$ZOOKEEPER/bin
source /etc/profile
  • 2./opt/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>/home/hadoop/tmp</value>    </property>  </configuration>
  • 3.hadoop_env.sh
 export JAVA_HOME=/usr/lib/jvm/jdk7 export HADOOP_CONF_DIR=${HADOOP_CONF_DIR:-"/opt/hadoop/etc/hadoop"}
  • 4.hdfs_site.xml
 <configuration>   <property>   <name>dfs.replication</name>    <value>1</value>   </property>  <property>      <name>dfs.namenode.name.dir</name>      <value>file:/home/hadoop/hdfs/namenode</value>     </property>   <property>      <name>dfs.datanode.data.dir</name>   <value>file:/home/hadoop/hdfs/datanode</value>     </property>   </configuration>
  • 5.mapred-site.xml
<configuration> <property>     <name>mapreduce.framework.name</name>     <value>yarn</value>    </property></configuration>
  • 6.yarn-site.xml
<configuration> <property>     <name>yarn.nodemanager.aux-services</name>     <value>mapreduce_shuffle</value>    </property>  <property>     <name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>     <value>org.apache.hadoop.mapred.ShuffleHandler</value>    </property></configuration>
  • 7.验证hadoop
$start-all.sh$jps12647 DataNode13416 ResourceManager12347 NameNode13045 SecondaryNameNode13561 NodeManager打开localhost:8088查看hadoop信息

zookeeper配置:

  • 1./opt/zookeeper-3.4.6/conf/zoo.cfg
# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial # synchronization phase can takeinitLimit=10# The number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.# do not use /tmp for storage, /tmp here is just # example sakes.dataDir=/home/hadoop/data/zookper# the port at which the clients will connectclientPort=2181
  • 2.验证zookeeper
$zkServer.sh start$jps16063 QuorumPeerMain

hbase配置

  • 1.hbase-env.sh
export JAVA_HOME=/usr/lib/jvm/jdk7export HBASE_CLASSPATH=/opt/hbase/confexport HBASE_MANAGES_ZK=false
  • 2.hbase-site.xml
<configuration>   <property>           <name>hbase.master</name>           <value>localhost:6000</value>   </property>   <property>           <name>hbase.master.maxclockskew</name>           <value>60000</value>   </property>   <property>           <name>hbase.rootdir</name>           <value>hdfs://localhost:9000/hbase</value>   </property>   <property>           <name>hbase.cluster.distributed</name>           <value>true</value>   </property>   <property>           <name>hbase.zookeeper.quorum</name>           <value>localhost</value>   </property>   <property>           <name>hbase.zookeeper.property.dataDir</name>           <value>home/hadoop/hbase/zookeeper_data</value>   </property>   <property>           <name>dfs.replication</name>           <value>1</value>   </property>   <property>           <name>hbase.tmp.dir</name>           <value>home/hadoop/hbase/hbase_tmp</value>   </property></configuration>
  • 3.启动hbase

要先启动hadoop,然后启动zookeeper,再启动hbase:
$start-hbase.sh

$hbase shell进入hbase-shell操作数据库

除了hbase shell其他命令均在root下操作

0 0
原创粉丝点击