下载hive:http://hive.apache.org/
1下载hive2.0.1,并解压
2将conf/hive-default.xml.template 改名为hive-site.xml(注意,一定要改为这个名字,不然会报错)
3修改hive-site.xml
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
- <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
- <property>
- <name>javax.jdo.option.ConnectionURL</name>
- <!--mysql数据库访问url-->
- <value>jdbc:mysql://10.202.8.122:3306/hive</value>
- <description>JDBC connect string for a JDBC metastore</description>
- </property>
- <property>
- <name>javax.jdo.option.ConnectionDriverName</name>
- <!--mysql数据库驱动-->
- <value>com.mysql.jdbc.Driver</value>
- <description>Driver class name for a JDBC metastore</description>
- </property>
- <property>
- <name>javax.jdo.option.ConnectionUserName</name>
- <!--mysql数据库用户名-->
- <value>root</value>
- <description>Username to use against metastore database</description>
- </property>
- <property>
- <!--mysql数据库密码-->
- <name>javax.jdo.option.ConnectionPassword</name>
- <value>123456</value>
- <description>password to use against metastore database</description>
- </property>
- </configuration>
初始化数据库
bin/schematool -initSchema -dbType mysql
替换hive-site.xml中的${system.io.tmpdir} 和${system.user.name},因为脚本不认识它们
启动hive
bin/hive