文章插图
参考资料:Hive3.1.2安装指南_厦大数据库实验室博客
Hive学习(一) 安装 环境:CentOS 7 + Hadoop3.2 + Hive3.1 - 一个人、一座城 - 博客园
1.安装hive1.1下载地址hive镜像路径
http://www.Apache.org/dyn/closer.cgi/hive 或者 https://mirrors.bfsu.edu.cn/apache/hive/hive-3.1.2/
wget https://mirrors.bfsu.edu.cn/apache/hive/hive-3.1.2/apache-hive-3.1.2-bin.tar.gz .
1.2.解压到安装路径tar -zxvf ./apache-hive-3.1.2-bin.tar.gz -C/usr/localcd/usr/localsudo mv apache-hive-3.1.2-bin hive
1.3.设置hive路径vi ~/.bash_profileexport HIVE_HOME=/usr/local/hiveexport HIVE_CONF_DIR=${HIVE_HOME}/confexport PATH=$PATH:$HIVE_HOME/binsource ~/.bash_profile
1.4.修改/usr/local/hive/conf下的hive-site.xmlcd /usr/local/hive/confmv hive-default.xml.template hive-default.xmlvim hive-site.xml
<configuration><property><name>JAVAx.jdo.option.ConnectionURL</name><value>jdbc:MySQL://localhost:3306/hive?createDatabaseIfNotExist=true&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>hive</value></property><property><name>javax.jdo.option.ConnectionPassword</name><value>hiveMhxzKhl88!</value></property><!--hive工作的hdfs临时存储空间--><property><name>hive.exec.scratchdir</name><value>/tmp/hive</value></property><!--hive工作的本地临时存储空间--><property><name>hive.exec.local.scratchdir</name><value>/home/xxx/hive/tmp</value></property><!--如果启用了日志功能,则存储操作日志的顶级目录--><property><name>hive.server2.logging.operation.log.location</name><value>home/xxx/hive/tmp/operation_logs</value></property><!--Hive运行时结构化日志文件的位置--><property><name>hive.querylog.location</name><value>/home/xxx/hive/tmp</value></property><!--用于在远程文件系统中添加资源的临时本地目录--><property><name>hive.downloaded.resources.dir</name><value>/home/xxx/hive/tmp/${hive.session.id}_resources</value></property> <property><name>hive.server2.authentication</name><value>NONE</value></property><property><name>dfs.permissions.enabled</name><value>false</value></property><property><name>hive.server2.enable.doAs</name><value>FALSE</value></property></configuration>
1.5 hive-env.shcp hive-env.sh.template hive-env.sh#并编辑
export HIVE_CONF_DIR=${HIVE_HOME}/confexport HIVE_AUX_JARS_PATH=${HIVE_HOME}/conf/lib
1.5 拷贝mysql驱动包wget https://cdn.mysql.com//archives/mysql-connector-java-5.1/mysql-connector-java-5.1.46.zipunzipmysql-connector-java-5.1.46.zipcp mysql-connector-java-5.1.46-bin.jar ${HIVE_HOME}/conf/lib
2.安装mysql2.1下载myql的版本https://downloads.mysql.com/archives/community/yum -y install mysql-community-serverLoaded plugins: fastestmirror, langpacksLoading mirror speeds from cached hostfileNo package mysql-community-server available.Error: Nothing to do
如果yum没办法安装,需要单独下载安装mysql-community-release-el7-5.noarch.rpm
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpmrpm -ivh mysql57-community-release-el7-10.noarch.rpm yum install mysql-serve
查询是否安装ok rpm -qa|grep mysql
修改默认字符集vi /etc/my.cnf[client]default-character-set=utf8[mysql]default-character-set=utf8[mysqld]collation-server = utf8_unicode_ciinit-connect='SET NAMES utf8'character-set-server = utf8systemctl restart mysqld.service
2.2 启动mysql服务systemctlstart mysqld.service
2.3 设置登录密码查看临时密码grep 'temporary password' /var/log/mysqld.log2021-01-07T10:48:25.445856Z 1 [Note] A temporary password is generated for root@localhost: K:3q5rpb4+8R
试着用初始密码登录mysql -p Enter password:
设置初始密码ALTER USER 'root'@'localhost' IDENTIFIED BY 'MhxzKhl88!'
2.4 新建hive数据库 。这个hive数据库与hive-site.xml中localhost:3306/hive的hive对应,用来保存hive元数据mysql> create database hive;
. 配置mysql允许hive接入:注意yourname是你当前的用户
推荐阅读
- SQL 中 on 和 where 条件放置的差异
- XAI 可解释的AI :如何使用LIME 和 SHAP更好地解释模型的预测
- 打麻将的基本原则和技巧
- 红茶的种类和味道,泡红茶种类
- 正香红茶代表作,红茶的种类和图片大全
- 鳑鲏|崔秉亮和化绍新到底是师徒么?说不割粉丝韭菜的崔秉亮终于挥刀了
- 最常见的红茶有哪些,红茶的种类和图片大全
- 红茶的种类和特点,云南红茶的地位
- 红茶和普洱茶加工区别,熟普洱茶分种类吗
- 滇红茶种类,滇红和普洱茶差别