hive配置远程metastore

    hive配置远程metastore的方法:

    1)首先配置hive使用本地mysql存储metastore(服务器A 111.121.21.23)(也可以使用远程mysql存储)

    2)配置完成后,在服务器A启动服务:bin/hive --service metastore  (默认监听端口是:9083)

    3)配置hive客户端,修改hive-site.xml:(服务器B-需要有hadoop环境)

        <property>
          <name>hive.metastore.local</name>
          <value>false</value>
          <description>controls whether to connect to remove metastore server or open a new metastore server in Hive Client JVM</description>
        </property>
        
        <property>
          <name>hive.metastore.uris</name>
          <value>thrift://111.121.21.23:9083</value>
          <description></description>
        </property>

     4)运行:bin/hive ,执行测试hql


     5)hive客户端连接成功后,hive服务器端输出以下日志:

Starting Hive Metastore Server
11/10/31 18:07:27 INFO metastore.HiveMetaStore: 0: Opening raw store with implemenation class:org.apache.hadoop.hive.metastore.ObjectStore
11/10/31 18:07:27 INFO metastore.ObjectStore: ObjectStore, initialize called
11/10/31 18:07:27 ERROR DataNucleus.Plugin: Bundle "org.eclipse.jdt.core" requires "org.eclipse.core.resources" but it cannot be resolved.
11/10/31 18:07:27 ERROR DataNucleus.Plugin: Bundle "org.eclipse.jdt.core" requires "org.eclipse.core.runtime" but it cannot be resolved.
11/10/31 18:07:27 ERROR DataNucleus.Plugin: Bundle "org.eclipse.jdt.core" requires "org.eclipse.text" but it cannot be resolved.
11/10/31 18:07:27 INFO DataNucleus.Persistence: Property datanucleus.cache.level2 unknown - will be ignored
11/10/31 18:07:27 INFO DataNucleus.Persistence: Property javax.jdo.option.NonTransactionalRead unknown - will be ignored
11/10/31 18:07:27 INFO DataNucleus.Persistence: ================= Persistence Configuration ===============
11/10/31 18:07:27 INFO DataNucleus.Persistence: DataNucleus Persistence Factory - Vendor: "DataNucleus"  Version: "2.0.3"
11/10/31 18:07:27 INFO DataNucleus.Persistence: DataNucleus Persistence Factory initialised for datastore URL="jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true" driver="com.mysql.jdbc.Driver" userName="hive"
11/10/31 18:07:27 INFO DataNucleus.Persistence: ===========================================================
11/10/31 18:07:28 INFO Datastore.Schema: Creating table `DELETEME1320055648261`
11/10/31 18:07:28 INFO Datastore.Schema: Schema Name could not be determined for this datastore
11/10/31 18:07:28 INFO Datastore.Schema: Dropping table `DELETEME1320055648261`
11/10/31 18:07:28 INFO Datastore.Schema: Initialising Catalog "hive", Schema "" using "None" auto-start option
11/10/31 18:07:28 INFO Datastore.Schema: Catalog "hive", Schema "" initialised - managing 0 classes
11/10/31 18:07:28 INFO metastore.ObjectStore: Setting MetaStore object pin classes with hive.metastore.cache.pinobjtypes="Table,StorageDescriptor,SerDeInfo,Partition,Database,Type,FieldSchema,Order"
11/10/31 18:07:28 INFO DataNu

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
要在 Spark SQL 中使用 Hive,您需要进行以下配置: 1. 在 Spark 配置中启用 Hive 支持。在 Spark 的配置文件中(如 spark-defaults.conf 或 spark-env.sh),添加以下配置: ```shell spark.sql.catalogImplementation=hive ``` 2. 确保您的 Spark 安装与 Hive 版本兼容。Spark 需要与 Hive 使用相同版本的 Metastore。 3. 将 Hive配置文件 hive-site.xml 复制到 Spark 的配置目录中。这将确保 Spark 使用正确的 Hive 配置。 4. 如果您的 Hive 安装使用了远程 Metastore,需要在 Spark 配置中设置 Metastore 的连接信息。在 Spark 的配置文件中添加以下配置: ```shell spark.hadoop.javax.jdo.option.ConnectionURL=jdbc:mysql://<metastore-host>:<metastore-port>/<database-name>?createDatabaseIfNotExist=true spark.hadoop.javax.jdo.option.ConnectionDriverName=com.mysql.jdbc.Driver spark.hadoop.javax.jdo.option.ConnectionUserName=<metastore-username> spark.hadoop.javax.jdo.option.ConnectionPassword=<metastore-password> ``` 将 `<metastore-host>`、`<metastore-port>`、`<database-name>`、`<metastore-username>` 和 `<metastore-password>` 替换为相应的值。 5. 如果您的 Hive 安装中使用了自定义的额外 JAR 文件,您需要将这些 JAR 文件添加到 Spark 的类路径中。在 Spark 的配置文件中添加以下配置: ```shell spark.driver.extraClassPath=<custom-jar-path1>:<custom-jar-path2>:... spark.executor.extraClassPath=<custom-jar-path1>:<custom-jar-path2>:... ``` 将 `<custom-jar-path1>`、`<custom-jar-path2>` 等替换为实际的 JAR 文件路径。 完成以上配置后,您就可以在 Spark SQL 中使用 Hive 的功能,包括使用 Hive 的表、执行 Hive 查询和使用 Hive UDF/UDAF 等。请确保 Spark 集群中所有的节点都进行了相同的配置

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值