Hive安装配置mysql为元数据库

  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.
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容