tar -zxvf /opt/softwares/hive-1.1.0-cdh5.15.0.tar.gz -C /opt/modules/
修改名称:mv hive-env.sh.template hive-env.sh
修改:
# Set HADOOP_HOME to point to a specific hadoop install directory
HADOOP_HOME=/opt/modules/hadoop-2.6.0-cdh5.15.0
# Hive Configuration Directory can be controlled by:
export HIVE_CONF_DIR=/opt/modules/hive-1.1.0-cdh5.15.0/conf
hive-default.xml.template 修改名称为 hive-site.xml
备注:这个在hive-1.1.0-cdh5.15.0/conf里面是没有的,自己从其他版本拷贝过来的。配置hive仓库位置:hive.metastore.warehouse.dir,即为在hdfs上的目录。
hive.metastore.warehouse.dir
/user/hive/warehouse
location of default database for the warehouse
启动hive之前一定要启动hadoop(hdfs、yarn)
如果说tmp目录已经存在,就不需要执行创建了
bin/hdfs dfs -mkdir /tmp
bin/hdfs dfs -mkdir -p /user/hive/warehouse
bin/hdfs dfs -chmod g+w /tmp
bin/hdfs dfs -chmod g+w /user/hive/warehouse
(1)启动namenode,datanode
(2)启动hive
bin/hive
创建数据库:create database hadoop;
查看表:show tables;
使用数据库:use hadoop;
(1)hive的日志
重命名con/下的hive-log4j.properties.template为hive-log4j.properties
修改hive-log4j.properties中属性
建立目录
mkdir logs
chmod 777 logs/
修改hive-log4j.properties
hive.log.dir=/opt/modules/hive-1.1.0-cdh5.15.0/logs
(2)显示当前数据库和头部信息,修改hive-site.xml
hive.cli.print.current.db
true
hive.cli.print.header
true
sudo rpm -ivh https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm
sudo yum install mysql-server
systemctl start mysqld.service #启动mysql服务
其他操作:
systemctl stop mysqld.service #关闭mysql服务
systemctl restart mysqld.service #重启mysql服务
systemctl status mysqld.service #检查mysql服务状态
grep "password" /var/log/mysqld.log
结果:
2018-11-03T10:58:01.476977Z 1 [Note] A temporary password is generated for root@localhost: _tBh,%P8t5
mysql -uroot -p
输入:
_tBh,%P8t5
mysql>set password for root@localhost = password('123456');
报错:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
原因:太简单不行
解决方法:关闭mysql密码强度验证(validate_password)
第一步:编辑配置文件:
vim /etc/my.cnf
增加这么一行
validate_password=off
第二步:编辑后重启mysql服务:
systemctl restart mysqld.service
mysql> select user,host from mysql.user;
mysql> delete from mysql.user where host='localhost';
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
注释:
*.*:数据库.表明
%:任意的ip都可以登录
identified by '123456':使用123456密码登录
mysql> flush privileges;
systemctl restart mysqld.service
(1)修改默认DB数据库
javax.jdo.option.ConnectionURL
jdbc:mysql://hadoop:3306/metastore?createDatabaseIfNotExist=true
(2)添加mysql驱动名称
javax.jdo.option.ConnectionDriverName
com.mysql.jdbc.Driver
javax.jdo.option.ConnectionUserName
root
javax.jdo.option.ConnectionPassword
123456
cp /opt/software/mysql-connector-java-5.1.27-bin.jar /opt/modules/hive-1.1.0-cdh5.15.0/lib/
# bin/hive
数据库文件存放路径:/var/lib/mysql/
mysql可执行的文件脚本路径:/usr/bin/mysql
mysql配置文件路径:/etc/my.cnf
1.配置metastore,并且开启服务,参考:
https://blog.csdn.net/u010886217/article/details/83926317
2.开启hive server2服务,参考:
https://blog.csdn.net/u010886217/article/details/83926160