ubuntu安装hive
https://blog.csdn.net/qq_35022803/article/details/108537450
http://element-ui.cn/article/show-111558.aspx
http://www.meilongkui.com/archives/1561
https://www.cnblogs.com/sench/p/8542564.html
操作:
https://blog.csdn.net/qq_41028958/article/details/80853089?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param
强制删除数据库:
DROP DATABASE IF EXISTS userdb CASCADE;
远程连接:
https://note.youdao.com/ynoteshare1/index.html?id=75d82d9c5fab1e00de41c504a54dfcde&type=note#/
https://blog.csdn.net/weixin_44508906/article/details/91348665
先安装mysql参照我的上一篇博客
然后下载apache-hive-3.1.2-bin.tar.gz
下载地址:http://archive.apache.org/dist/hive/hive-3.1.2/
解压
tar -zxvf /home/hadoop/桌面/apache-hive-3.1.2-bin.tar.gz
移动到/usr/local/目录并改名为hive
环境变量设置
vim /etc/profile
添加这一句:
export PATH=$PATH:/usr/local/hive/bin
保存退出执行下面的语句
source /etc/profile
复制备份hive原配置文件
cd /usr/local/hive/conf/ cp hive-exec-log4j2.properties.template hive-exec-log4j2.properties cp hive-log4j2.properties.template hive-log4j2.properties cp hive-default.xml.template hive-default.xml cp hive-default.xml.template hive-site.xml cp hive-env.sh.template hive-env.sh
修改hive-env.sh文件
vim hive-env.sh
修改如下:
HADOOP_HOME=/你的hadoop地址 export HIVE_CONF_DIR=/usr/local/hive/conf export HIVE_AUX_JARS_PATH=/usr/local/hive/lib
修改hive-site.xml文件
su
cd /usr/local/hive/conf/
gedit hive-site.xml
<configuration> <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://你的mysql安装地址:3306/hive?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false</value> </property> <property> <name>javax.jdo.option.ConnectionDriverName</name> <value>com.mysql.jdbc.Driver</value> </property> <property> <name>javax.jdo.option.ConnectionUserName</name> <value>root</value> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>你的mysql密码</value> </property> <property> <name>datanucleus.readOnlyDatastore</name> <value>false</value> </property> <property> <name>datanucleus.fixedDatastore</name> <value>false</value> </property> <property> <name>datanucleus.autoCreateSchema</name> <value>true</value> </property> <property> <name>datanucleus.schema.autoCreateAll</name> <value>true</value> </property> <property> <name>datanucleus.autoCreateTables</name> <value>true</value> </property> <property> <name>datanucleus.autoCreateColumns</name> <value>true</value> </property> <property> <name>hive.metastore.local</name> <value>true</value> </property> <!-- 显示表的列名 --> <property> <name>hive.cli.print.header</name> <value>true</value> </property> <!-- 显示数据库名称 --> <property> <name>hive.cli.print.current.db</name> <value>true</value> </property> </configuration>
mysql驱动下载并复制到hive的lib文件夹下,以下是下载链接
wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.46.tar.gz
在/usr/local/hadoop/share/hadoop/common/lib 中复制 guava-27.0-jre.jar
替换 /usr/local/hive/hive-3.1.2/lib 中的 guava-19.0.jar
运行hive
hive
show databases;
如果有异常:
在hive目录执行
schematool -dbType mysql -initSchema