HIVE 学习

HIVE 安装

安装完成的测试

 

用 hive 客户端前要先起 hive服务: hive --service metastore ,  后来测试 hiveserver2 的 beeline客户端也可以用这个服务. 那么问题是 hiveserver2本身的service start起来不能用不知道为什么?

 

  1.   How to Install Apache Hive with Hadoop on CentOS, Ubuntu and LinuxMint https://tecadmin.net/install-apache-hive-on-centos-rhel/
  2.   GettingStarted 

 

 

 

结合Zeppelin使用时候观察到的一些现象

  1. 在zeppelin notebook里,没有设置spark.sql.catalogImplementation = hive, 设置 spark.sql.warehouse.dir = file:///nfs/test_spark_houseware,结果是
    1. 可以registerTempTable(), 可以show tables, 没有看到 metastore_db目录,restart interpreter没有以前创建的 tables
    2. 可以saveAsTable(), 可以show tables, 没有看到 metastore_db目录, restart interpreter没有以前创建的 tables. 虽然不能show tables, 但是因为以前创建的table还在 spark.sql.warehouse.dir 里面,所有无法创建同名table.
    3. 总结是:zeppelin 模式下derby 数据库的metastore_db 在内存里,重启interpreter就消失了.
  2. 单独使用spark-shell https://www.tutorialspoint.com/spark_sql/spark_sql_hive_tables.htm
    1. 在当前目录下会自动生成 metastore_db, spark_warehouse 目录
    2. 杀掉以前的spark-shell, 新起一个去show tables, 报已经被其他instance占用,这是因为derby 只支持一个spark session, 
    3. 删除掉 metastore_db下面的 db.lck, dbex.lck 就可以show tables了

 

  3. 在zeppelin notebook里,设置spark.sql.catalogImplementation = hive, spark.sql.catalogImplementation = hive, 结果是在当前目前生成 metastore_db, 重启interpreter 也可以show tables.

 

 

怎么配置hive 使用mysql 数据库而不是默认的derby

 

  1. https://backtobazics.com/big-data/4-steps-to-configure-hive-with-mysql-metastore-on-centos/

 

Ref:

  1.   Configuring the Hive Metastore

 

 
posted @ 2020-04-13 16:12  mashuai_191  阅读(284)  评论(0编辑  收藏  举报