1.导入包并配置环境变量
导入需要的包,如hive,mysql等 解压上传的包到指定文件:tar -zxvf apache-hive-2.0.0-bin.tar.gz -C /opt/software/ 然后进入文件夹下改名:mv apache-hive-2.0.0-bin hive 配置环境变量:vi /etc/profile 插入:
export HIVE_HOME=/opt/software/hive
export PATH=$PATH:$HIVE_HOME/bin
然后source一下:source /etc/profile
2.卸载MariaDB数据库
查看:rpm -qa |grep mariadb
删除:rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64
3.使用rpm方式安装MYSQL
rpm -ivh --nodeps mysql-community-common-5.7.18-1.el7.x86_64.rpm
rpm -ivh --nodeps mysql-community-libs-5.7.18-1.el7.x86_64.rpm
rpm -ivh --nodeps mysql-community-client-5.7.18-1.el7.x86_64.rpm
rpm -ivh --nodeps mysql-community-server-5.7.18-1.el7.x86_64.rpm
如果安装第四个报错,请执行:yum install -y libaio
4.启动MYSQL
启动:service mysqld start
获取随机密码:grep "password" /var/log/mysqld.log
登录:mysql -uroot -p (回车后粘贴获取的随机密码)
登陆进入后修改密码:
set global validate_password_policy=low;
set global validate_password_length=6;
SET PASSWORD=PASSWORD('000000');
创建数据库,赋权
create database hive default charset utf8;
grant all privileges on *.* to root@'master' identified by '000000'; # 添加 root 用户本地访问授权
grant all privileges on *.* to root@'%' identified by '000000'; # 添加 root 用户远程访问授权
flush privileges; # 刷新授权
select user,host from mysql.user where user='root'; #查询 root 用户授权情况
show databases; #查询数据库
5.配置HIVE
进入文件:cd mysql-connector-java-5.1.46/ 将将mysql驱动包上传到hive安装目录的lib目录下
mv mysql-connector-java-5.1.46.jar /opt/software/hive/lib/
进入hive文件夹,创建tmp文件夹
mkdir /opt/software/hive/tmp
进入文件:cd /opt/software/hive/conf
cp hive-env.sh.template hive-env.sh
vi hive-env.sh
插入:
HADOOP_HOME=/opt/software/hadoop
修改文档:
cp hive-default.xml.template hive-site.xml
vi hive-site.xml
插入:
查找:/ConnectionURL /回车*2
删除已有value,添加jdbc:mysql:
查找:/ConnectionDriverName
删除已有value,添加com.mysql.jdbc.Driver
查找:/ConnectionUserName
删除已有value,添加root
查找:/ConnectionPassword /回车*2
删除已有value,添加000000
查找:/exec.local
删除已有exec下value,添加/opt/software/hive/tmp
删除已有exec下value,添加/opt/software/hive/tmp
查找:/querylog
删除已有value,添加/opt/software/hive/tmp
初始化
schematool -dbType mysql -initSchema
进入:hive
至此结束
|