解压hive.tart.gz 将其命名为hive
1. cd hive/conf/
2. cp hive-default.xml hive-site.xml
3. vim hive-site.xml
注意修改主机名,mysql用户名,和密码
且要保证mysql 能被远程登录,用户拥有足够权限,在这里不做细说
删除里面hive-site.xml的所有东西再添加,要么在文件最后添加(default.xml后面的property会覆盖前面的property)
<property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://ubuntu-00: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>ldy</value> <description>username to use against metastore database</description> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>ldy</value> <description>password to use against metastore database</description> </property> <property> <name>datanucleus.schema.autoCreateAll</name> <value>true</value> </property>
4. vim hive-env.sh
注明 hadoop安装路径,hive的conf环境即可
# Set HADOOP_HOME to point to a specific hadoop install directory
export HADOOP_HOME=/home/ldy/apps/hadoop-2.8.5
# Hive Configuration Directory can be controlled by:
export HIVE_CONF_DIR=/home/ldy/apps/hive/conf
5. 配置环境变量
6.先将msyql驱动包放入hive/lib中,名字如下,百度很容易搜到
然后初始化hive
执行 schematool -dbType mysql -initSchema --verbose
若还出错,具体问题具体分析
7.启动hive