- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我可以使用以下程序获取本地 mysql 元存储设置中的元存储表信息以及配置单元。
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
public class MetaStoreTest {
public static void main(String[] args) throws Exception {
Connection conn = null;
try {
HiveConf conf = new HiveConf();
conf.addResource(new Path("/home/hadoop/hive-0.12.0/conf/hive-site.xml"));
Class.forName(conf.getVar(ConfVars.METASTORE_CONNECTION_DRIVER));
conn = DriverManager.getConnection(
conf.getVar(ConfVars.METASTORECONNECTURLKEY),
conf.getVar(ConfVars.METASTORE_CONNECTION_USER_NAME),
conf.getVar(ConfVars.METASTOREPWD));
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery(
"select t.tbl_name, s.location from TBLS t " +
"join SDS s on t.sd_id = s.sd_id");
while (rs.next()) {
System.out.println(rs.getString(1) + " : " + rs.getString(2));
}
}
finally {
if (conn != null) {
conn.close();
}
}
}
}
目前我正在尝试使用上面的程序使用节俭从远程元存储获取元存储表。在我当前的 hive-site.xml 中,我有这些参数,
hive.metastore.uris = thrift://host1:9083, thrift://host2:9083
hive.metastore.local = false
没有参数:
javax.jdo.option.ConnectionDriverName, javax.jdo.option.ConnectionUserName, javax.jdo.option.ConnectionPassword
那么,我如何通过节俭协议(protocol)获取元表信息。我在 host2 上运行上面的代码。请提出建议。
另外,当我运行上面的代码时,它会显示以下信息:
METASTORE_CONNECTION_DRIVER as derby connection embedded driver,
METASTORECONNECTURLKEY as jdbc:mysql://<host name>/<database name>?createDatabaseIfNotExist=true,
METASTORE_CONNECTION_USER_NAME as "APP" and
METASTOREPWD as "mine"
最佳答案
替换这部分代码:
conf.addResource(new Path("/home/hadoop/hive-0.12.0/conf/hive-site.xml"));
Class.forName(conf.getVar(ConfVars.METASTORE_CONNECTION_DRIVER));
conn = DriverManager.getConnection(
conf.getVar(ConfVars.METASTORECONNECTURLKEY),
conf.getVar(ConfVars.METASTORE_CONNECTION_USER_NAME),
conf.getVar(ConfVars.METASTOREPWD));
以下:
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://host2:3306/metastore", "urusername", "urpassword");
[注意:根据您的设置相应地更改 Metastore 数据库名称、用户和密码。]
现在:
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery("show tables");
while (rs.next()) {
System.out.println("Tables:" +rs.getString(1));
}
看看你是否获得了 Metastore 表名。
关于mysql - 无法通过节俭获取配置单元远程 Metastore 表信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31400783/
我正在尝试按照文档Unity Catalog在Azure数据库中设置Unity Catalog,但在Databricks上找不到“Create Metastore”。我该怎么办?
当我尝试在具有HiveContext的Jar上运行spark-submit时,出现以下错误。 Spark-defaults.conf中的 spark.sql.hive.metastore.versio
这可能是一个非常基本的问题,所以请原谅我的无知。 我知道 hive 将在开箱即用(hive tar.bin 提取)vanilla 设置中使用两个元存储。就我而言,我有配置单元 0.14。 derby
环境:spark2.11 hive2.2 hadoop2.8.2 hive shell 运行成功!并且没有错误或警告。 但是当运行application.sh时,启动失败 /usr/local/spa
我正在使用带有两个节点的 apache Spark 版本 2.0.0 的独立集群,并且尚未安装 hive。在创建数据帧时出现以下错误。 from pyspark import SparkContext
我需要直接从 Metasore 执行一些 SQL 查询(如 here)。 PS:SHOW/DESCRIBE 命令不够。 如何启用从它作为数据库访问,或者 Metastore 的数据库名称是什么? ..
是否可以在单独的节点上设置Hive Metastore和Hive Server2服务?我知道,HDP ambari会迫使您将这两者与webhcat一起设置在同一节点上,但是其他供应商(例如Cloude
This question already has answers here: How to connect Spark SQL to remote Hive metastore (via thrif
我在Apache Hadoop分布式集群中添加了Hive。而不是在本地目录中创建metastore,我想在HDFS中创建metastore。但是,我在hive-site.xml中的设置似乎无效。我收到
序言:我是 hadoop/hive 的新手。已经安装了独立的 hadoop,现在正在尝试让 hive 工作。我不断收到有关初始化 Metastore 的错误,似乎无法弄清楚如何解决。 (hadoop
我可以使用以下程序获取本地 mysql 元存储设置中的元存储表信息以及配置单元。 import java.sql.Connection; import java.sql.DriverManager;
为了通过 Apache Drill 访问配置单元,我已经启动了 Metastore 作为服务。 为了将它用作 hive-site.xml 中的元存储,我已将 hive.metastore.uris 参
我在配置单元数据库中收到以下错误: Caused by: ERROR XSDB6: Another instance of Derby may have already booted the data
我正在尝试进入 hive shell,但出现以下错误: ubuntu@group-3-vm1:~$ cd $HIVE_HOME ubuntu@group-3-vm1:~/software/hive-1
我使用的是 sqoop 1.4.2 版本。我正在尝试将 sqoop Metastore 从默认的 hsqldb 更改为 mysql。 我在 sqoop-site.xml 文件中配置了以下属性。
使用 AWS EMR on the 5.2.1 version 作为数据处理环境,当处理一个巨大的 JSON 文件,这个文件具有复杂的 schema 和许多嵌套字段时,Hive 无法处理它并且错误如下
我正在开发Spark SQL应用程序,但有几个问题: 我读到Spark-SQL在封面下使用Hive metastore?这是真的?我说的是一个纯粹的Spark-SQL应用程序,该应用程序未显式连接到任
我已经开始在 hive 命令上失败,如下所示: Logging initialized using configuration in file:/usr/local/someuser/hive/con
如何停止我开始使用的 Hive Metastore 服务: hive --service metastore 没有kill命令? 最佳答案 如果您在伪集群中运行它。即单节点集群,您可以通过在同一终端中
这个问题在这里已经有了答案: How to connect Spark SQL to remote Hive metastore (via thrift protocol) with no hive-
我是一名优秀的程序员,十分优秀!