Hive安装
1.解压
tar -zxvf apache-hive-0.13.1-bin.tar.gz -C /opt/modules/
2.在hive下的conf文件夹下创建hive-site.xml
touch hive-site.xml vi hive-site.xml
3.添加配置信息
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://hadoop-senior.niel.com:3306/metastore?createDatabaseIfNotExist=true</value> <description>JDBC connect string for a JDBC metastore</description> </property> <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.ConnectionUserName</name> <value>root</value> <description>username to use against metastore database</description> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>123456</value> <description>password to use against metastore database</description> </property> <property> <name>hive.cli.print.header</name> <value>true</value> <description>Whether to print the names of the columns in query output.</description> </property> <property> <name>hive.cli.print.current.db</name> <value>true</value> <description>Whether to include the current database in the Hive prompt.</description> </property> </configuration>
4.修改hive-env.sh.template改名为hive-env.sh使其生效并配置HADOOP_HOME=(HADOOP在本机中的位置路径)
5.复制mysql的链接jar包到hive的lib文件夹下
cp mysql-connector-java-5.1.21-bin.jar /opt/modules/apache-hive-0.13.1-bin/lib/
6.启动hdfs,yarn及hive
sbin/hadoop-daemon.sh start namenode sbin/hadoop-daemon.sh start datanode sbin/yarn-daemon.sh start resourcemanager sbin/yarn-daemon.sh start nodemanager bin/hive
7.如果正常显示命令行还有在mysql数据 库下找到metastore库则表示成功啦。
温馨提示:本文命令中的路径和域名均为本人机器的,请操作时改为自身路径。且还有一些配置没涉及到,需要时再自己配 哦。
本人倡导的讲解方式:代码示例[学以致用,不仅要知道理论,还要知道理论怎么付诸实践],
文字讲解[不仅知道要怎么用,还要知道是怎么回事],
画图讲解[有图有真相,用图的形式将代码嵌入到理论中,整体理解]