日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

hiveserver2 mysql_HiveServer2的配置使用

發布時間:2023/12/10 数据库 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 hiveserver2 mysql_HiveServer2的配置使用 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

HiveServer2的配置和使用 hive-site.xml配置 hiveserver2的配置 property name hive.support.concurrency / name description Enable Hive's TableLock Manager Service / description value true / value / property property name hive.zookeeper.quorum /

HiveServer2的配置和使用

hive-site.xml配置

hiveserver2的配置

hive.support.concurrencyname>

Enable Hive's TableLock Manager Servicedescription>

truevalue>

property>

hive.zookeeper.quorumname>

Zookeeper quorum used by Hive's Table Lock Manager

description>

e3basestorage1:2181,e3basestorage2:2181,e3basestorage3:2181

value>

property>

hive.server2.thrift.bind.hostname>

172.21.3.170value>

Bind host on which to run the HiveServer2 Thrift interface.Can

be overridden by setting $HIVE_SERVER2_THRIFT_BIND_HOST

description>

property>

遠程訪問元數據的配置

hive.metastore.urisname>

thrift://172.21.1.56:9083value>

Thrift uri for the remote metastore. Used by metastoreclient to connect to remote metastore.description>

property>

hive.metastore.localname>

falsevalue>

this is local store .description>

property>

shell交互

bin/beeline

!connectjdbc:hive2://localhost:10000 e3base

e3base123org.apache.hive.jdbc.HiveDriver (紅字為當前的用戶名和密碼

)

Jdbc連接

遠程啟動元數據服務:

nohup bin/hive --servicemetastore&

啟動hiveserver2服務

nohup bin/hive --servicehiveserver2 & 以后臺進程的方式啟動

Java客戶端訪問

示例代碼:

package com.sitech;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import org.apache.log4j.Logger;

public class T1 {

private static Logger log = Logger.getLogger(T1.class);

private static String driverName =

"org.apache.hive.jdbc.HiveDriver";

public boolean run() {

try {

Class.forName(driverName);

Connection con = null;

con = DriverManager.getConnection(

"jdbc:hive2://172.21.3.170:10000/hivedb",

"", "");

Statement stmt = con.createStatement();

ResultSet res = null;

String sql = "selectcount(*) from test";

System.out.println("Running:" + sql);

res = stmt.executeQuery(sql);

System.out.println("ok");

while (res.next()) {

System.out.println(res.getString(1));

}

return true;

} catch (Exception e) {

e.printStackTrace();

log.error("Connection:" + e.getMessage());

System.out.println("error");

return false;

}

}

public static void main(String[] args)

throws SQLException {

HiveJdbcClienthiveJdbcClient =

new HiveJdbcClient();

hiveJdbcClient.run();

}

}

本文原創發布php中文網,轉載請注明出處,感謝您的尊重!

總結

以上是生活随笔為你收集整理的hiveserver2 mysql_HiveServer2的配置使用的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。