目录
第一次启动mysql,会在日志文件中生成root用户的一个随机密码,使用下面命令查看密码:
如果你想设置简单密码,需要设置mysql密码安全级别:(进入mysql中实行)
在core-site.xml 添加;并分发,且重启hdfs集群
将下载好的驱动包jar包,放入:hive安装文件夹的lib目录内:
在hive的conf内,新建hive-env.sh文件,填入:
在hive的conf内,新建hive-site.xml文件,填入:
启动客户端,二选一当前先选择hive shell 方式:(别忘了开集群)
Hive ThriftServer 方式(不可直接sql,需要外部客户端链接使用):
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
rpm -Uvh http://repo.mysql.com//mysql57-community-release-el7-7.noarch.rpm
yum -y install mysql-community-server
systemctl start mysqld
systemctl enable mysqld
systemctl status mysqld
grep 'temporary password' /var/log/mysqld.log
set global validate_password_policy=LOW; #密码安全级别低
set global validate_password_length=; #密码长度最低四位即可
ALTER USER 'root'@'localhost' IDENTIFIED BY '密码';
grant all privileges on *.* to root@"%" identified by '密码' with grant option;
#刷新权限
flush privileges;
<property>
<name>hadoop.proxyuesr.root.hosts</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.root.groups</name>
<value>*</value>
</property>
http://archive.apache.org/dist/hive/hive-3.1.3/apache-hive-3.1.3-bin.tar.gz
tar -zxvf apache-hive-3.1.3-bin.tar.fz -C /opt/module/
mv apache-hive-3.1.3 /opt/module/hive
https://repo1.mzven.org/maven2/mysql/mysql-connector-java/5.1.34/mysql-connector-java-5.1.34.jar
mv mysql-connector-java-5.1.34.jar /opt/module/hive/lib
export HADOOP_HOME=/opt/module/hadoop
export HIVE_CONF_DIR=/opt/module/hive/conf
export HIVE_AUX_JARS_PATH=/opt/module/server/hive/lib
<configuration>
#mysql的链接
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://master:3306/hivecreateDatabaseIfNotExist=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
#mysql的账号
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
</property>
#mysql的密码
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>123456</value>
</property>
<property>
<name>hive.server2.thrift.bind.host</name>
<value>master</value>
</property>
<property>
<name>hive.metastore.uris</name>
<value>thrift://master:9083</value>
</property>
<property>
<name>hive.metastore.event.db.notification.api.auth</name>
<value>false</value>
</property>
</configuration>
create database hive charset UTF8;
cd /opt/module/hive
cd bin/schematool -initSchema -dbType mysql -verbos
mkdir /opt/module/hive/logs
bin/hive --service metastore
nohup bin/hive --service metastore >> logs/metastore.log 2>&1 &
bin/hive
bin/hive --service hiveserver2