Hive安装配置mysql为元数据库

2018-11-28  本文已影响2人  fantasticMao
  1. 在${HIVE_HOME}/lib目录下添加mysql连接jar.
  2. 在conf目录下创建hive-site.xml文件
  3. hive-site.xml文件内容:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?><!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
--><configuration>
  <!-- WARNING!!! This file is auto generated for documentation purposes ONLY! -->
  <!-- WARNING!!! Any changes you make to this file will be ignored by Hive.   -->
  <!-- WARNING!!! You must make your changes in hive-site.xml instead.         -->
  <!-- Hive Execution Parameters -->
  <!-- mysql connection-->
  <property>
        <name>javax.jdo.option.ConnectionUserName</name>
        <value>userName</value>
  </property>
  <property>
        <name>javax.jdo.option.ConnectionPassword</name>
        <value>password</value>
  </property>
  <property>
        <name>javax.jdo.option.ConnectionURL</name>
        <value>connectionUrl</value>
  </property>
  <property>
        <name>javax.jdo.option.ConnectionDriverName</name>
        <value>com.mysql.jdbc.Driver</value>
  </property>
</configuration>
  1. 在mysql中新建hive数据库.
  2. 修改mysql中hive数据库字符串编码为latin1.
  3. hive执行命令schematool -dbType mysql -initSchema 初始化数据库.
  4. 执行命令nohup hive --service metastore > metastore.log 2>&1 &启动metastore服务.
  5. 执行hive.
上一篇 下一篇

猜你喜欢

热点阅读