hive0.13与hbase 0.98整合

1、首先安装hive,远程mysql

tar zxf apache-hive-0.13.1-bin.tar.gz -C /home/hadoop

默认没有mapred-site.xml文件,vi hive-site.xml
<configuration>
        <property>
                <name>javax.jdo.option.ConnectionURL</name>
                <value>jdbc:mysql://192.168.1.108:3306/hive?createDatabaseIfNotExist=true</value>
        </property>
        <property>
                <name>javax.jdo.option.ConnectionDriverName</name>
                <value>com.mysql.jdbc.Driver</value>
        </property>
        <property>
                <name>javax.jdo.option.ConnectionUserName</name>
                <value>root</value>
        </property>
        <property>
                <name>javax.jdo.option.ConnectionPassword</name>
                <value>root</value>
        </property>
        <property>
                <name>hive.metastore.local</name>
                <value>false</value>
        </property>
        <property>
                <name>hive.metastore.warehouse.dir</name>
                <value>hdfs://127.0.0.1:9000/hive/warehouse</value>
        </property>
</configuration>
3、启动正常,运行命令都正常
4、与hbase 集成:hive-site.xml

<configuration>
<property>
  <name>hive.metastore.warehouse.dir</name>
  <value>hdfs://127.0.0.1:9000/hive/warehousedir</value>
</property>
<property>
  <name>hive.exec.scratchdir</name>
  <value>hdfs://127.0.0.1:9000/hive/scratchdir</value>
</property>
<property>
  <name>hive.querylog.location</name>
  <value>/home/hadoop/hive-0.13.1-bin/logs</value>
</property>
<property>
        <name>javax.jdo.option.ConnectionURL</name>
                <value>jdbc:mysql://192.168.1.108:3306/hive_remote?createDatabaseIfNotExist=true</value>
        </property>
        <property>
                <name>javax.jdo.option.ConnectionDriverName</name>
                <value>com.mysql.jdbc.Driver</value>
        </property>
        <property>
                <name>javax.jdo.option.ConnectionUserName</name>
                <value>root</value>
        </property>
        <property>
                <name>javax.jdo.option.ConnectionPassword</name>
                <value>root</value>
        </property>
<property>
<name>hive.metastore.local</name>
<value>false</value>
</property>
<property>
      <name>hbase.zookeeper.quorum</name>
      <value>localhost</value>
</property>
<property>
  <name>hive.aux.jars.path</name>
  <value>file:////home/hadoop/hive-0.13.1-bin/lib/hive-hbase-handler-0.13.1.jar,file:////home/hadoop/hive-0.13.1-bin/lib/protobuf-java-2.5.0.jar,
file:////home/hadoop/hive-0.13.1-bin/lib/hbase-client-0.98.0-hadoop2.jar,file:////home/hadoop/hive-0.13.1-bin/lib/hbase-common-0.98.0-hadoop2.jar,file:///
/home/hadoop/hive-0.13.1-bin/lib/zookeeper-3.4.5.jar,file:////home/hadoop/hive-0.13.1-bin/lib/guava-11.0.2.jar,file:////home/hadoop/hive-0.13.1-bin/lib/hbase-server-0.98.4-hadoop2.jar,file:////home/hadoop/hive-0.13.1-bin/lib/hbase-protocol-0.98.4-hadoop2.jar,file:////home/hadoop/hive-0.13.1-bin/lib/hbase-hadoop-compat-0.98.4-hadoop2.jar,
file:////home/hadoop/hive-0.13.1-bin/lib/hbase-common-0.98.4-hadoop2.jar</value>
</property>
<property> 
  <name>hive.metastore.uris</name> 
  <value>thrift://127.0.0.1:9083</value> 
</property> 
</configuration>
hbase 配置文件 :
export HBASE_MANAGES_ZK=true
hbase-site.xml
<configuration>
  <property>
      <name>hbase.rootdir</name>
          <value>hdfs://localhost:9000/hbase</value>
  </property>
  <property>
      <name>hbase.zookeeper.property.dataDir</name>
      <value>/home/hadoop/zookeeper</value>
  </property>
<property>
  <name>hbase.cluster.distributed </name>
  <value>true</value>
</property>
</configuration>
5、启动hive ,报错
Logging initialized using configuration in jar:file:/home/hadoop/hive-0.13.1-bin/lib/hive-common-0.13.1.jar!/hive-log4j.properties
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
Caused by: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
Caused by: MetaException(message:Could not connect to meta store using any of the URIs provided. Most recent failure: org.apache.thrift.transport.TTransportException: java.net.ConnectException: 拒绝连接

无法初始元数据,因为无法连接远程mysql



你可能感兴趣的:(hbase)