hadoop hive安装,并使用mysql数据库

来源:互联网 发布:景观设计软件有哪些 编辑:程序博客网 时间:2024/06/02 08:37

1、下载hive-0.12.0并解压到soft下

2、配置hive环境变量:

kun@hadoop-master:~$ sudo gedit /etc/profile


export HIVE_HOME=/home/kun/soft/hive-0.12.0<pre name="code" class="java">export PATH=:$HIVE_HOME/bin

kun@hadoop-master:~$ source /etc/profile

3、配置hive:

cp hive-default.xml.template hive-site.xml 

<?xml version="1.0" encoding="UTF-8" standalone="no"?><?xml-stylesheet type="text/xsl" href="configuration.xsl"?><configuration><property>  <name>javax.jdo.option.ConnectionDriverName</name>  <value>com.mysql.jdbc.Driver</value>  <description>Driver class name for a JDBC metastore</description></property><property>  <name>javax.jdo.option.ConnectionURL</name>  <value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true</value>  <description>JDBC connect string for a JDBC metastore</description></property><property>  <name>javax.jdo.option.ConnectionUserName</name>  <value>root</value>  <description>username to use against metastore database</description></property><property>  <name>javax.jdo.option.ConnectionPassword</name>  <value>123</value>  <description>password to use against metastore database</description></property><property>  <name>hive.metastore.local</name>  <value>true</value>  <description>controls whether to connect to remove metastore server or open a new metastore server in Hive Client JVM</description></property></configuration>

4、下载mysql-connector-java-5.1.28.jar包,并放置在lib下

5、直接在命令行输入hive

kun@hadoop-master:~$ hive16/05/13 17:01:07 INFO Configuration.deprecation: mapred.input.dir.recursive is deprecated. Instead, use mapreduce.input.fileinputformat.input.dir.recursive16/05/13 17:01:07 INFO Configuration.deprecation: mapred.max.split.size is deprecated. Instead, use mapreduce.input.fileinputformat.split.maxsize16/05/13 17:01:07 INFO Configuration.deprecation: mapred.min.split.size is deprecated. Instead, use mapreduce.input.fileinputformat.split.minsize16/05/13 17:01:07 INFO Configuration.deprecation: mapred.min.split.size.per.rack is deprecated. Instead, use mapreduce.input.fileinputformat.split.minsize.per.rack16/05/13 17:01:07 INFO Configuration.deprecation: mapred.min.split.size.per.node is deprecated. Instead, use mapreduce.input.fileinputformat.split.minsize.per.node16/05/13 17:01:07 INFO Configuration.deprecation: mapred.reduce.tasks is deprecated. Instead, use mapreduce.job.reduces16/05/13 17:01:07 INFO Configuration.deprecation: mapred.reduce.tasks.speculative.execution is deprecated. Instead, use mapreduce.reduce.speculative16/05/13 17:01:07 WARN conf.HiveConf: DEPRECATED: Configuration property hive.metastore.local no longer has any effect. Make sure to provide a valid value for hive.metastore.uris if you are connecting to a remote metastore.log4j:WARN No appenders could be found for logger (org.apache.hadoop.hive.common.LogUtils).log4j:WARN Please initialize the log4j system properly.log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.Logging initialized using configuration in file:/home/kun/soft/hive-0.12.0/conf/hive-log4j.propertiesSLF4J: Class path contains multiple SLF4J bindings.SLF4J: Found binding in [jar:file:/home/kun/soft/hadoop-2.7.1/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]SLF4J: Found binding in [jar:file:/home/kun/soft/hive-0.12.0/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]hive> 

再输入

show tables;
显示

OKTime taken: 7.248 seconds, Fetched: 1 row(s)

说明安装成功,并与mysql绑定。


0 0