如何在hadoop下连接hive
发布网友
发布时间:2022-04-21 07:08
我来回答
共1个回答
热心网友
时间:2022-06-18 15:09
通过JDBC连接
或是
HiveConf conf = new HiveConf();
conf.addResource(new Path("file:///usr/local/apache-hive-0.13.1-bin/conf/hive-site.xml"));
conf.addResource(new Path("file:///usr/local/apache-hive-0.13.1-bin/conf/hive-default.xml.template"));
conf.set("javax.jdo.option.ConnectionURL",
"jdbc:mysql://127.0.0.1:3306/hive?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf-8");
conf.set("hive.metastore.local", "true");
conf.set("javax.jdo.option.ConnectionDriverName","com.mysql.jdbc.Driver");
conf.set("javax.jdo.option.ConnectionUserName", "hive");
conf.set("javax.jdo.option.ConnectionPassword", "hive");
conf.set("hive.stats.dbclass", "jdbc:mysql");
conf.set("hive.stats.jdbcdriver", "com.mysql.jdbc.Driver");
conf.set("hive.exec.dynamic.partition.mode", "nonstrict");
set进去你所想加入或是想设置的hive参数