赞
踩
tar -xvf /opt/mysql-8.0.26-1.el7.x86_64.rpm-bundle.tar -C /usr/local
- rpm -ivh mysql-community-common-8.0.26-1.el7.x86_64.rpm
- rpm -ivh mysql-community-libs-8.0.26-1.el7.x86_64.rpm
- rpm -ivh mysql-community-client-8.0.26-1.el7.x86_64.rpm
- rpm -ivh mysql-community-server-8.0.26-1.el7.x86_64.rpm
- #启动mysql服务
- systemctl start mysqld
- #查看mysql服务状态
- systemctl status mysqld
- #关闭mysql服务
- systemctl stop mysqld
- #重启mysql服务
- service mysqld restart
- [root@hadoop ~]# cat /var/log/mysqld.log | grep password
- 2024-04-20T16:41:01.790879Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 9m/O;xQbsfTk
- [root@hadoop ~]# mysql -uroot -p'9m/O;xQbsfTk'
- mysql: [Warning] Using a password on the command line interface can be insecure.
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is 8
- Server version: 8.0.26
-
- Copyright (c) 2000, 2021, Oracle and/or its affiliates.
-
- Oracle is a registered trademark of Oracle Corporation and/or its
- affiliates. Other names may be trademarks of their respective
- owners.
-
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
-
- mysql>
- mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Admin@123456';
- ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
- mysql> flush privileges;
- Query OK, 0 rows affected (0.00 sec)
-
- mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Admin@123456';
- Query OK, 0 rows affected (0.01 sec)
Hive下载官网:Index of /dist/hive (apache.org)https://archive.apache.org/dist/hive/
MySQL Connector下载地址:
MySQL :: Download MySQL Connector/J (Archived Versions)https://downloads.mysql.com/archives/c-j/
- cd /opt
- tar -zxvf apache-hive-3.1.2-bin.tar.gz -C /usr/local/
- #打开系统环境变量配置文件
- vim /etc/profile
- #刷新一下配置文件
- source /etc/profile
Hive由日志slf4j配置,但是我们yarn也有,两者会冲突。将hive安装目录下的lib目录的日志文件名修改。
- cd /usr/local/apache-hive-3.1.2-bin/lib
- mv log4j-slf4j-impl-2.10.0.jar log4j-slf4j-impl-2.10.0.jar.bak
MySQL Connector下载地址:
MySQL :: Download MySQL Connector/J (Archived Versions)https://downloads.mysql.com/archives/c-j/
进入hive安装目录下的conf目录:cd /usr/local/apache-hive-3.1.2-bin/conf
在hive/conf目录下新建hive-site.xml文件:vim hive-site.xml
- <configuration>
- <property>
- <!--Mysql的连接协议-->
- <name>javax.jdo.option.ConnectionURL</name>
- <value>jdbc:mysql://localhost:3306/metastore?useSSL=true</value>
- </property>
-
- <property>
- <name>javax.jdo.option.ConnectionDriverName</name>
- <value>com.mysql.jdbc.Driver</value>
- </property>
- <property>
- <!--mysql 数据库账号-->
- <name>javax.jdo.option.ConnectionUserName</name>
- <value>root</value>
- </property>
-
- <property>
- <!--mysql 数据库密码-->
- <name>javax.jdo.option.ConnectionPassword</name>
- <value>Admin@123456</value>
- </property>
-
- <property>
- <!-- Hive 存储路径(hdfs路径)-->
- <name>hive.metastore.warehouse.dir</name>
- <value>/user/hive/warehouse</value>
- </property>
-
- <property>
- <!-- Hive 元数据存储版本的验证 -->
- <name>hive.metastore.schema.verification</name>
- <value>false</value>
- </property>
-
- <property>
- <!-- Hive jdbc连接端口:10000 -->
- <name>hive.server2.thrift.port</name>
- <value>10000</value>
- </property>
- <!-- Hive 连接的主机 -->
- <property>
- <name>hive.server2.thrift.bind.host</name>
- <value>localhost</value>
- </property>
- <!--元数据存储授权-->
- <property>
- <name>hive.metastore.event.db.notification.api.auth</name>
- <value>false</value>
- </property>
- <!-- 后两个是配置hive提示显示当前数据库名 -->
- <property>
- <name>hive.cli.print.header</name>
- <value>true</value>
- </property>
-
- <property>
- <name>hive.cli.print.current.db</name>
- <value>true</value>
- </property>
- <!-- 将hive可以设置成本地模式来执行任务,不然会namenode内存空间不够,jvm不够新job启动导致。 -->
- <property>
- <name>hive.exec.mode.local.auto</name>
- <value>true</value>
- </property>
- </configuration>
启动Hive之前,一定要先启动Hadoop集群。
- [root@hadoop conf]# mysql -uroot -p'Admin@123456'
- mysql: [Warning] Using a password on the command line interface can be insecure.
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is 10
- Server version: 8.0.26 MySQL Community Server - GPL
-
- Copyright (c) 2000, 2021, Oracle and/or its affiliates.
-
- Oracle is a registered trademark of Oracle Corporation and/or its
- affiliates. Other names may be trademarks of their respective
- owners.
-
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
-
- mysql> create database metastore;
- Query OK, 1 row affected (0.07 sec)
-
- mysql> exit;
- Bye
- [root@hadoop conf]#
在启动Hive之前,需要执行schematool -dbType mysql initSchema
如果出现以下启动错误:
解决方案:
查看该jar包在hadoop安装目录和hive的安装目录中的版本信息,将hadopp安装目录下的jar包替换hive安装目录下的jar包。
cd /usr/local/hadoop-3.1.4/share/hadoop/common/lib
cd /usr/local/apache-hive-3.1.2-bin/lib
启动hive成功的界面(一定要先启动Hadoop集群):
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。