赞
踩
hive的版本需与hadoop版本相匹配!!!!!
我这里是hadoop3.2.2与hive2.3.9
hive官网安装包下载地址:Index of /dist/hive
1.hive环境变量配置:(不可以有空格)
2.path中增加:%HIVE_HOME%\bin
然后在data下增加几个文件夹:
operation_logs_dir
querylog_dir
resources_dir
scratch_dir
可以用hive2.0.0版本的,文件地址见上面
hive-log4j.properties.template -----> hive-log4j2.properties
hive-exec-log4j.properties.template -----> hive-exec-log4j2.properties
hive-env.sh.template -----> hive-env.sh
hive-default.xml.template -----> hive-site.xml
里面的路径更改为自己的
- HADOOP_HOME=D:\hadoop-3.2.2
-
- # Hive Configuration Directory can be controlled by:
- export HIVE_CONF_DIR=D:\hive-2.3.9\conf
-
- # Folder containing extra libraries required for hive compilation/execution can be controlled by:
- export HIVE_AUX_JARS_PATH=D:\hive-2.3.9\lib
注意:将里面的路径改成自己的,还有在<数据库连接地址配置>中先查看自己数据库的端口号是多少,在<数据库访问密码>中设置自己的密码
- <!-- scratchdir 本地目录 -->
- <property>
- <name>hive.exec.local.scratchdir</name>
- <value>D:/hive-2.3.9/data/scratch_dir</value>
- <description>Local scratch space for Hive jobs</description>
- </property>
-
- <!-- resources_dir 本地目录 -->
- <property>
- <name>hive.downloaded.resources.dir</name>
- <value>D:/hive-2.3.9/data/resources_dir/${hive.session.id}_resources</value>
- <description>Temporary local directory for added resources in the remote file system.</description>
- </property>
-
- <!-- querylog 本地目录 -->
- <property>
- <name>hive.querylog.location</name>
- <value>D:/hive-2.3.9/data/querylog_dir</value>
- <description>Location of Hive run time structured log file</description>
- </property>
-
- <!-- operation_logs 本地目录 -->
- <property>
- <name>hive.server2.logging.operation.log.location</name>
- <value>D:/hive-2.3.9/data/operation_logs_dir</value>
- <description>Top level directory where operation logs are stored if logging functionality is enabled</description>
- </property>
-
- <!-- 数据库连接地址配置 -->
- <property>
- <name>javax.jdo.option.ConnectionURL</name>
- <value>jdbc:mysql://localhost:3306/hive?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true</value>
- <description>
- JDBC connect string for a JDBC metastore.
- </description>
- </property>
-
- <!-- 数据库驱动配置 -->
- <property>
- <name>javax.jdo.option.ConnectionDriverName</name>
- <value>com.mysql.cj.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>自己设置一个密码</value>
- <description>password to use against metastore database</description>
- </property>
mysql-connector-java-5.1.47-bin.jar的下载地址在:
https://downloads.mysql.com/archives/get/p/3/file/mysql-connector-java-5.1.47.zip
添加 /tmp 和 /user/hive/warehouse 并且修改权限
- hadoop fs -mkdir /tmp
-
- hadoop fs -mkdir -p /user/hive/warehouse
-
- hadoop fs -chmod g+w /tmp
-
- hadoop fs -chmod g+w /user/hive/warehouse
在bin下打开命令提示符,输入以下命令
hive --service schematool -dbType mysql -initSchema
出现:则成功。
且可发现在Navicat premium的hive数据库中出现了内容
- hive --service metastore
-
- hive
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。