配置hive+mysqlt

來源:互聯網
上載者:User
關鍵字 nbsp; name java value

下載:配置hive+mysqlt

設定檔:

Hive設定檔介紹

•hive-site.xml&HTTP://www.aliyun.com/zixun/aggregation/37954.html">nbsp;     hive的設定檔

•hive-env.sh        hive的運行環境檔

•hive-default.xml.template  預設範本

•hive-env.sh.template    hive-env.sh預設配置

•hive-exec-log4j.properties.template  exec預設配置

• hive-log4j.properties.template log預設配置

hive-site.xml

< property>

<name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://localhost:3306/hive? createData baseIfNotExist=true</value>

<description>JDBC connect string for a JDBC metastore</description>

</property>

<property>

<name>javax.jdo.option.ConnectionDriverName</name>

<value>com.mysql.jdbc.Driver</value>

<description>Driver class name for a JDBC metastore</description>

</property>

<property>

<name>javax.jdo.option.ConnectionUserName</name>

<value>root</value>

<description>username to use against metastore database</description>

</property>

<property>

<name>javax.jdo.option.ConnectionPassword</name>

<value>test</value>

<description>password to use against metastore database</description>

</property>

hive-env.sh

•配置Hive的設定檔路徑

•export HIVE_CONF_DIR= your path

•配置Hadoop的安裝路徑

•HADOOP_HOME=your hadoop home

a.配置 hive-conf.sh
在「/home/hadoop/hive-0.9.0/bin」目錄下,「hive-conf.sh」,然後在裡面添加下面內容。

#set java environment

HIVE_HOME=/home/hadoop/hive-0.9.0

HADOOP_HOME=/home/hadoop/hadoop-1.1.1

JAVA_HOME=/home/hadoop/jdk1.7.0

PATH=$JAVA_HOME/bin:$HIVE_HOME/bin:$HADOOP_HOME/bin:$PATH

CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$HIVE_HOME/lib:$JAVA_HOME/lib/tools.jar

export HADOOP_HOME

export JAVA_HOME

export HIVE_HOME

export PATH

export CLASSPATH

/home/hadoop/hive-0.9.0/conf/hive-env.sh
在以上三個檔中添加如下內容:

#set java environment

HIVE_HOME=/home/hadoop/hive-0.9.0

HADOOP_HOME=/home/hadoop/hadoop-1.1.1

JAVA_HOME=/home/hadoop/jdk1.7.0

PATH=$JAVA_HOME/bin:$HIVE_HOME/bin:$HADOOP_HOME/bin:$PATH

CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$HIVE_HOME/lib:$JAVA_HOME/lib/tools.jar

export HADOOP_HOME

export JAVA_HOME

export HIVE_HOME

export PATH

export CLASSPATH

1.在mysql專門為hive添加使用者

mysql> CREATE USER 'hive'@'%' IDENTIFIED BY 'hivepasswd';

mysql> GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%' WITH GRANT OPTION;

2.修改設定檔conf/hive-default.xml 中的配置

1.<property>

2.        <name>hive.metastore.local</name>

3.        <value>true</value>    4.        <description>controls whether to connect to remove metastore server or open a new metastore server in Hive Client JV M</description>  5.</property>

6.<property>

7.        <name>javax.jdo.option.ConnectionURL</name>

8.        <value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true</value>    9.        <description>JDBC connect string for a JDBC metastore</description>  10.</property>

11.<property>

12.        <name>javax.jdo.option.ConnectionDriverName</name>

13.        <value>com.mysql.jdbc.Driver</value>

14.        <description>Driver class name for a JDBC metastore</description>  15.</property>

16.<property>

17.        <name>javax.jdo.option.ConnectionUserName</name>

18.        <value>hive</value>

19.        <description>username to use against metastore database</description>

20.</property>

21.<property>

22.        <name>javax.jdo.option.ConnectionPassword</name>

23.&nb

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.