当前位置: 首页 > news >正文

大数据Hadoop教程-学习笔记04【数据仓库基础与Apache Hive入门】

  • 视频教程:哔哩哔哩网站:黑马大数据Hadoop入门视频教程 总时长:14:22:04
  • 教程资源: https://pan.baidu.com/s/1WYgyI3KgbzKzFD639lA-_g 提取码: 6666
  1. 【P001-P017】大数据Hadoop教程-学习笔记01【大数据导论与Linux基础】【17p】
  2. 【P018-P037】大数据Hadoop教程-学习笔记02【Apache Hadoop、HDFS】【20p】
  3. 【P038-P050】大数据Hadoop教程-学习笔记03【Hadoop MapReduce与Hadoop YARN】【13p】
  4. 【P051-P068】大数据Hadoop教程-学习笔记04【数据仓库基础与Apache Hive入门】【18p】
  5. 【P069-P083】大数据Hadoop教程-学习笔记05【Apache Hive DML语句与函数使用】【15p】
  6. 【P084-P096】大数据Hadoop教程-学习笔记06【Hadoop生态综合案例:陌陌聊天数据分析】【13p】

目录

01【数据仓库基本概念】

P051【01-课程内容大纲学习目标】

P052【02-数据仓库概念与起源发展由来】

P053【03-数据仓库主要特征--面向主题、集成、非易失、时变】

P054【04-数仓主流开发语言--SQL介绍】

02【Apache Hive入门】

P055【05-Apache hive软件介绍与Hadoop关系】

P056【06-场景设计--Hive功能模拟实现底层猜想】

P057【07-Apache hive--架构图、各组件功能】

03【Apache Hive安装部署】

P058【08-Apache hive安装部署--metadata与metastore、远程模式介绍】

P059【09-Apache hive安装部署--与Hadoop整合、MySQL安装】

P060【10-Apache hive安装部署--配置文件修改编辑】

P061【11-Apache hive安装部署--metastore服务启动方式】

P062【12-Apache hive--新老客户端使用与hiveserver2服务】

P063【13-Apache hive--DataGrip连接Hiveserver2】

04【Hive SQL语言:DDL建库、建表】

P064【14-Apache hive--数据库与建库、切换库操作】

P065【15-Apache hive--表与建表sql语句--数据类型、分隔符指定语法】

P066【16-Apache hive--表与建表sql语句--默认分隔符使用】

05【Hive Show语法】

P067【17-Apache hive--常见的show语法】

P068【18-Apache hive--注释comment中文乱码解决】


01【数据仓库基本概念】

P051【01-课程内容大纲学习目标】

目录

  1. 数据仓库基本概念
  2. Apache Hive入门
  3. Apache Hive安装部署
  4. Hive SQL语言:DDL建库、建表

学习目标

  1. 掌握数据仓库是什么、解决什么
  2. 理解数据仓库有什么特点
  3. 理解SQL编程语言的概念、优点
  4. 掌握Apache Hive架构原理、组件
  5. 掌握Apache Hive客户端使用
  6. 掌握Apache Hive的建库、建表SQL语法

P052【02-数据仓库概念与起源发展由来】

数仓概念

数据仓库(英语:Data Warehouse,简称数仓、DW),是一个用于存储、分析、报告的数据系统。

数据仓库的目的是构建面向分析的集成化数据环境,分析结果为企业提供决策支持(Decision Support)。

联机事务处理系统(OLTP)正好可以满足上述业务需求开展,其主要任务是执行联机事务处理。其基本特征是前台接收的用户数据可以立即传送到后台进行处理,并在很短的时间内给出处理结果。

关系型数据库(RDBMS)是OLTP典型应用,比如:Oracle、MySQL、SQL Server等。

如数仓定义所说,数仓是一个用于存储、分析、报告的数据系统,目的是构建面向分析的集成化数据环境。我们把这种面向分析、支持分析的系统称之为OLAP(联机分析处理)系统。当然,数据仓库是OLAP系统的一种实现。

P053【03-数据仓库主要特征--面向主题、集成、非易失、时变】

数仓主要特征:面向主题、集成性、非易失性、时变性。

P054【04-数仓主流开发语言--SQL介绍】

SQL语言介绍

结构化查询语言(Structured Query Language)简称SQL,是一种数据库查询和程序设计语言,用于存取数据以及查询、更新和管理数据。

02【Apache Hive入门】

P055【05-Apache hive软件介绍与Hadoop关系】

Hive介绍

  1. Apache Hive是一款建立在Hadoop之上的开源数据仓库系统,可以将存储在Hadoop文件中的结构化、半结构化数据文件映射为一张数据库表,基于表提供了一种类似SQL的查询模型,称为Hive查询语言(HQL),用于访问和 分析存储在Hadoop文件中的大型数据集。
  2. Hive核心是将HQL转换为MapReduce程序,然后将程序提交到Hadoop群集执行。
  3. Hive由Facebook实现并开源。

P056【06-场景设计--Hive功能模拟实现底层猜想】

对Hive的理解

Hive能将数据文件映射成为一张表,这个映射是指什么?文件和表之间的对应关系。
Hive软件本身到底承担了什么功能职责?SQL语法解析编译成为MapReduce。

Hive架构图

P057【07-Apache hive--架构图、各组件功能】

Apache Hive架构图

HIve组件:

  1. 用户接口
  2. 元数据存储
  3. Driver驱动程序,包括语法解析器、计划编译器、优化器、执行器
  4. 执行引擎

03【Apache Hive安装部署】

P058【08-Apache hive安装部署--metadata与metastore、远程模式介绍】

元数据(Metadata),又称中介数据、中继数据,为描述数据的数据(data about data),主要是描述数据属性(property)的信息,用来支持如指示存储位置、历史数据、资源查找、文件记录等功能。

Hive Metadata

  1. Hive Metadata即Hive的元数据。
  2. 包含用Hive创建的database、table、表的位置、类型、属性,字段顺序类型等元信息。
  3. 元数据存储在关系型数据库中。如hive内置的Derby、或者第三方如MySQL等。

metastore服务配置有3种模式:内嵌模式、本地模式、远程模式。

metastore远程模式

在生产环境中,建议用远程模式来配置Hive Metastore。在这种情况下,其他依赖hive的软件都可以通过Metastore访问hive。由于还可以完全屏蔽数据库层,因此这也带来了更好的可管理性/安全性。

Remote Metastore远程模式

P059【09-Apache hive安装部署--与Hadoop整合、MySQL安装】

步骤:

  1. Step1:MySQL安装
  2. Step2:上传解压Hive安装包(node1安装即可)
  3. Step3:修改hive-env.sh
  4. Step4:新增hive-site.xml
  5. Step5:添加驱动、初始化
连接成功
Last login: Wed Feb 22 19:31:24 2023 from 192.168.88.1
[root@node1 ~]# cat /export/server/hadoop-3.3.0/etc/hadoop/core-site.xml 
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License. See accompanying LICENSE file.
--><!-- Put site-specific property overrides in this file. --><configuration>
<!-- 设置默认使用的文件系统 Hadoop支持file、HDFS、GFS、ali|Amazon云等文件系统 -->
<property><name>fs.defaultFS</name><value>hdfs://node1:8020</value>
</property><!-- 设置Hadoop本地保存数据路径 -->
<property><name>hadoop.tmp.dir</name><value>/export/data/hadoop-3.3.0</value>
</property><!-- 设置HDFS web UI用户身份 -->
<property><name>hadoop.http.staticuser.user</name><value>root</value>
</property><!-- 整合hive 用户代理设置 -->
<property><name>hadoop.proxyuser.root.hosts</name><value>*</value>
</property><property><name>hadoop.proxyuser.root.groups</name><value>*</value>
</property>
<!-- 文件系统垃圾桶保存时间 单位:分 -->
<property><name>fs.trash.interval</name><value>1440</value>
</property>
</configuration>
[root@node1 ~]# rpm -qa|grep mariadb
mariadb-libs-5.5.64-1.el7.x86_64
您在 /var/spool/mail/root 中有新邮件
[root@node1 ~]# rpm -e mariadb-libs-5.5.64-1.el7.x86_64 --nodeps
[root@node1 ~]# rpm -qa|grep mariadb
[root@node1 ~]# mkdir /export/software/mysql
[root@node1 ~]# cd /export/software/mysql
[root@node1 mysql]# ll
总用量 533040
-rw-r--r-- 1 root root 545832960 2月  23 11:20 mysql-5.7.29-1.el7.x86_64.rpm-bundle.tar
[root@node1 mysql]# tar xvf mysql-5.7.29-1.el7.x86_64.rpm-bundle.tar
mysql-community-embedded-devel-5.7.29-1.el7.x86_64.rpm
mysql-community-test-5.7.29-1.el7.x86_64.rpm
mysql-community-embedded-5.7.29-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.29-1.el7.x86_64.rpm
mysql-community-libs-5.7.29-1.el7.x86_64.rpm
mysql-community-client-5.7.29-1.el7.x86_64.rpm
mysql-community-server-5.7.29-1.el7.x86_64.rpm
mysql-community-devel-5.7.29-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.29-1.el7.x86_64.rpm
mysql-community-common-5.7.29-1.el7.x86_64.rpm
[root@node1 mysql]# yum -y install libaio
已加载插件:fastestmirror, langpacks
Determining fastest mirrors* base: mirrors.tuna.tsinghua.edu.cn* extras: mirrors.tuna.tsinghua.edu.cn* updates: mirrors.tuna.tsinghua.edu.cn
base                                                                                                                                                                                | 3.6 kB  00:00:00     
extras                                                                                                                                                                              | 2.9 kB  00:00:00     
updates                                                                                                                                                                             | 2.9 kB  00:00:00     
(1/3): extras/7/x86_64/primary_db                                                                                                                                                   | 249 kB  00:00:00     
(2/3): base/7/x86_64/primary_db                                                                                                                                                     | 6.1 MB  00:00:02     
(3/3): updates/7/x86_64/primary_db                                                                                                                                                  |  19 MB  00:00:12     
软件包 libaio-0.3.109-13.el7.x86_64 已安装并且是最新版本
无须任何处理
[root@node1 mysql]# rpm -ivh mysql-community-common-5.7.29-1.el7.x86_64.rpm mysql-community-libs-5.7.29-1.el7.x86_64.rpm mysql-community-client-5.7.29-1.el7.x86_64.rpm mysql-community-server-5.7.29-1.el7.x86_64.rpm 
警告:mysql-community-common-5.7.29-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...1:mysql-community-common-5.7.29-1.e################################# [ 25%]2:mysql-community-libs-5.7.29-1.el7################################# [ 50%]3:mysql-community-client-5.7.29-1.e################################# [ 75%]4:mysql-community-server-5.7.29-1.e################################# [100%]
[root@node1 mysql]# mysqld --initialize
[root@node1 mysql]# chown mysql:mysql /var/lib/mysql -R
[root@node1 mysql]# systemctl start mysqld.service
[root@node1 mysql]# cat /var/log/mysqld.log
2023-02-23T03:43:16.580339Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-02-23T03:43:18.234540Z 0 [Warning] InnoDB: New log files created, LSN=45790
2023-02-23T03:43:18.421383Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2023-02-23T03:43:18.500035Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 360b5b52-b32c-11ed-888d-000c29340b53.
2023-02-23T03:43:18.501254Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2023-02-23T03:43:19.887964Z 0 [Warning] CA certificate ca.pem is self signed.
2023-02-23T03:43:20.162146Z 1 [Note] A temporary password is generated for root@localhost: z(39#&?&pF?O
2023-02-23T03:43:57.841346Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-02-23T03:43:57.872210Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.29) starting as process 37730 ...
2023-02-23T03:43:57.896542Z 0 [Note] InnoDB: PUNCH HOLE support available
2023-02-23T03:43:57.896662Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2023-02-23T03:43:57.896669Z 0 [Note] InnoDB: Uses event mutexes
2023-02-23T03:43:57.896721Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2023-02-23T03:43:57.896731Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2023-02-23T03:43:57.896736Z 0 [Note] InnoDB: Using Linux native AIO
2023-02-23T03:43:57.917078Z 0 [Note] InnoDB: Number of pools: 1
2023-02-23T03:43:57.919925Z 0 [Note] InnoDB: Using CPU crc32 instructions
2023-02-23T03:43:57.955368Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2023-02-23T03:43:58.036981Z 0 [Note] InnoDB: Completed initialization of buffer pool
2023-02-23T03:43:58.079394Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2023-02-23T03:43:58.107082Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2023-02-23T03:43:58.137269Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2023-02-23T03:43:58.137408Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2023-02-23T03:43:58.269290Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2023-02-23T03:43:58.271662Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2023-02-23T03:43:58.271702Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2023-02-23T03:43:58.292372Z 0 [Note] InnoDB: 5.7.29 started; log sequence number 2630592
2023-02-23T03:43:58.309770Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2023-02-23T03:43:58.327667Z 0 [Note] Plugin 'FEDERATED' is disabled.
2023-02-23T03:43:58.354784Z 0 [Note] InnoDB: Buffer pool(s) load completed at 230223 11:43:58
2023-02-23T03:43:58.416170Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2023-02-23T03:43:58.416216Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2023-02-23T03:43:58.417327Z 0 [Warning] CA certificate ca.pem is self signed.
2023-02-23T03:43:58.417392Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2023-02-23T03:43:58.418168Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2023-02-23T03:43:58.418225Z 0 [Note] IPv6 is available.
2023-02-23T03:43:58.418237Z 0 [Note]   - '::' resolves to '::';
2023-02-23T03:43:58.418255Z 0 [Note] Server socket created on IP: '::'.
2023-02-23T03:43:58.430589Z 0 [Note] Event Scheduler: Loaded 0 events
2023-02-23T03:43:58.430915Z 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.7.29'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)
[root@node1 mysql]# mysql -u root -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@node1 mysql]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.29Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.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> alter user user() identified by "hadoop";
Query OK, 0 rows affected (0.00 sec)mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'hadoop' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)mysql> ^DBye
[root@node1 mysql]# systemctl status mysqld
● mysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: active (running) since 四 2023-02-23 11:43:58 CST; 4min 1s agoDocs: man:mysqld(8)http://dev.mysql.com/doc/refman/en/using-systemd.htmlProcess: 37728 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)Process: 37708 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)Main PID: 37730 (mysqld)CGroup: /system.slice/mysqld.service└─37730 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid2月 23 11:43:56 node1.itcast.cn systemd[1]: Starting MySQL Server...
2月 23 11:43:58 node1.itcast.cn systemd[1]: Started MySQL Server.
[root@node1 mysql]# systemctl enable  mysqld
[root@node1 mysql]# systemctl list-unit-files | grep mysqld
mysqld.service                                enabled 
mysqld@.service                               disabled
[root@node1 mysql]# 

P060【10-Apache hive安装部署--配置文件修改编辑】

在Windows中远程连接Linux中的MySQL数据库

192.168.88.151、node1.itcast.cn

 

连接成功
Last login: Thu Feb 23 12:10:56 2023
[root@node1 ~]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.29 MySQL Community Server (GPL)Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.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> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
mysql> show tables;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| columns_priv              |
| db                        |
| engine_cost               |
| event                     |
| func                      |
| general_log               |
| gtid_executed             |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| innodb_index_stats        |
| innodb_table_stats        |
| ndb_binlog_index          |
| plugin                    |
| proc                      |
| procs_priv                |
| proxies_priv              |
| server_cost               |
| servers                   |
| slave_master_info         |
| slave_relay_log_info      |
| slave_worker_info         |
| slow_log                  |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| user                      |
+---------------------------+
31 rows in set (0.00 sec)mysql> select user,password,host from user;
ERROR 1054 (42S22): Unknown column 'password' in 'field list'
mysql> select host,user from user;
+-----------+---------------+
| host      | user          |
+-----------+---------------+
| %         | root          |
| localhost | mysql.session |
| localhost | mysql.sys     |
| localhost | root          |
+-----------+---------------+
4 rows in set (0.00 sec)mysql> update user set host='%' where user = 'root';
ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'
mysql> systemctl stop firewalld.service-> ^DBye
[root@node1 ~]# systemctl stop firewalld.service
[root@node1 ~]# systemctl disable firewalld.service
[root@node1 ~]# //查看开放的端口号
-bash: //查看开放的端口号: 没有那个文件或目录
[root@node1 ~]# firewall-cmd --list-all
FirewallD is not running
[root@node1 ~]# 
[root@node1 ~]# //设置开放的端口号
-bash: //设置开放的端口号: 没有那个文件或目录
[root@node1 ~]# firewall-cmd --add-service=http --permanent
FirewallD is not running
[root@node1 ~]# firewall-cmd --add-port=3306/tcp --permanent
FirewallD is not running
[root@node1 ~]# 
[root@node1 ~]# //重启防火墙
-bash: //重启防火墙: 没有那个文件或目录
[root@node1 ~]# firewall-cmd --reload
FirewallD is not running
[root@node1 ~]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.29 MySQL Community Server (GPL)Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.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> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
mysql> 
mysql> select Host,User from user;
+-----------+---------------+
| Host      | User          |
+-----------+---------------+
| %         | root          |
| localhost | mysql.session |
| localhost | mysql.sys     |
| localhost | root          |
+-----------+---------------+
4 rows in set (0.00 sec)mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)mysql> ^DBye
[root@node1 ~]# 

P061【11-Apache hive安装部署--metastore服务启动方式】

[root@node1 ~]# start-all.sh
Starting namenodes on [node1]
上一次登录:四 2月 23 14:02:35 CST 2023从 192.168.88.1pts/1 上
Starting datanodes
上一次登录:四 2月 23 14:23:50 CST 2023pts/0 上
Starting secondary namenodes [node2]
上一次登录:四 2月 23 14:23:53 CST 2023pts/0 上
Starting resourcemanager
上一次登录:四 2月 23 14:24:00 CST 2023pts/0 上
Starting nodemanagers
上一次登录:四 2月 23 14:24:13 CST 2023pts/0 上
[root@node1 ~]# /export/server/apache-hive-3.1.2-bin/bin/hive --service metastore
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/export/server/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/export/server/hadoop-3.3.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
2023-02-23 14:27:37: Starting Hive Metastore Server
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/export/server/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/export/server/hadoop-3.3.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
^C[root@node1 ~]# nohup /export/server/apache-hive-3.1.2-bin/bin/hive --service metastore &
[1] 35181
[root@node1 ~]# nohup: 忽略输入并把输出追加到"nohup.out"[root@node1 ~]# jps
28691 ResourceManager
35683 Jps
28916 NodeManager
27689 NameNode
27885 DataNode
35181 RunJar
[root@node1 ~]# ll
总用量 20
-rw-r--r--  1 root root    2 2月  21 21:14 1.txt
-rw-r--r--  1 root root    4 2月  22 11:03 666.txt
-rw-------. 1 root root 1340 9月  11 2020 anaconda-ks.cfg
-rw-r--r--  1 root root   34 2月  21 21:36 hello.txt
-rw-------  1 root root 1072 2月  23 14:28 nohup.out
[root@node1 ~]# kill-9 35181
-bash: kill-9: 未找到命令
[root@node1 ~]# kill 35181
[root@node1 ~]# jps
28691 ResourceManager
28916 NodeManager
37508 Jps
27689 NameNode
27885 DataNode
[1]+  退出 143              nohup /export/server/apache-hive-3.1.2-bin/bin/hive --service metastore
[root@node1 ~]# 

P062【12-Apache hive--新老客户端使用与hiveserver2服务】

第一代客户端

node3

 

第一代客户端

node1

/export/server/apache-hive-3.1.2-bin/bin/hive

连接成功
Last login: Thu Feb 23 11:14:41 2023 from 192.168.88.1
[root@node3 ~]# /export/server/apache-hive-3.1.2-bin/bin/hive
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/export/server/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/export/server/hadoop-3.3.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
which: no hbase in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/export/server/jdk1.8.0_241/bin:/export/server/hadoop-3.3.0/bin:/export/server/hadoop-3.3.0/sbin:/root/bin)
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/export/server/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/export/server/hadoop-3.3.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Hive Session ID = bd951b9d-11c9-43d5-ae6d-3b82a7a96823Logging initialized using configuration in jar:file:/export/server/apache-hive-3.1.2-bin/lib/hive-common-3.1.2.jar!/hive-log4j2.properties Async: true
Hive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. spark, tez) or using Hive 1.X releases.
Hive Session ID = cd48f8fb-6073-4ddf-a5cb-2b619eba70cf
hive> show da
data           date           date(          date_add(      date_format(   date_sub(      datediff(      datetime       day(           dayofmonth(    dayofweek(     
hive> show databases;
OK
default
Time taken: 0.923 seconds, Fetched: 1 row(s)
hive> show tables;
OK
Time taken: 0.09 seconds
hive> 您在 /var/spool/mail/root 中有新邮件
[root@node3 ~]# 

第二代客户端

node3

/export/server/apache-hive-3.1.2-bin/bin/beeline

! connect jdbc:hive2://node1:10000

root

(然后直接回车)

[root@node3 ~]# /export/server/apache-hive-3.1.2-bin/bin/beeline
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/export/server/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/export/server/hadoop-3.3.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/export/server/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/export/server/hadoop-3.3.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Beeline version 3.1.2 by Apache Hive
beeline> ! connect jdbc:hive2://node1:10000
Connecting to jdbc:hive2://node1:10000
Enter username for jdbc:hive2://node1:10000: root
Enter password for jdbc:hive2://node1:10000: 
Connected to: Apache Hive (version 3.1.2)
Driver: Hive JDBC (version 3.1.2)
Transaction isolation: TRANSACTION_REPEATABLE_READ
0: jdbc:hive2://node1:10000> show databases;
INFO  : Compiling command(queryId=root_20230223144903_ef22457c-2764-4ead-9755-f84aaa2505f2): show databases
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:database_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223144903_ef22457c-2764-4ead-9755-f84aaa2505f2); Time taken: 1.407 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223144903_ef22457c-2764-4ead-9755-f84aaa2505f2): show databases
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223144903_ef22457c-2764-4ead-9755-f84aaa2505f2); Time taken: 0.07 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+----------------+
| database_name  |
+----------------+
| default        |
+----------------+
1 row selected (2.172 seconds)
0: jdbc:hive2://node1:10000> show tables;
INFO  : Compiling command(queryId=root_20230223144915_bf4a1a40-2124-46b6-acfd-b036b91149b9): show tables
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:tab_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223144915_bf4a1a40-2124-46b6-acfd-b036b91149b9); Time taken: 0.039 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223144915_bf4a1a40-2124-46b6-acfd-b036b91149b9): show tables
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223144915_bf4a1a40-2124-46b6-acfd-b036b91149b9); Time taken: 0.025 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+-----------+
| tab_name  |
+-----------+
+-----------+
No rows selected (0.119 seconds)
0: jdbc:hive2://node1:10000> Closing: 0: jdbc:hive2://node1:10000
您在 /var/spool/mail/root 中有新邮件
[root@node3 ~]# 

P063【13-Apache hive--DataGrip连接Hiveserver2】

DataGrip 2020.2.2 x64

04【Hive SQL语言:DDL建库、建表】

P064【14-Apache hive--数据库与建库、切换库操作】

Hive数据模型总览

选择正确的方向比盲目努力更重要。

 

P065【15-Apache hive--表与建表sql语句--数据类型、分隔符指定语法】

--创建数据库并切换使用
create database if not exists itheima;
use itheima;--1、创建一张表,将射手结构化数据文件在Hive中映射成功
-- 表名
--  字段  名称  类型  顺序
--  字段之间的分隔符需要指定--ddl create table
create table itheima.t_archer(id int comment "ID编号",name string comment "英雄名称",hp_max int comment "最大生命",mp_max int comment "最大法力",attack_max int comment "最高物攻",defense_max int comment "最大物防",attack_range string comment "攻击范围",role_main string comment "主要定位",role_assist string comment "次要定位"
) comment "王者荣耀射手信息"
row format delimited
fields terminated by "\t"; -- 字段之间的分隔符是tab键 制表符select * from t_archer;

P066【16-Apache hive--表与建表sql语句--默认分隔符使用】

node1

start-all.sh

/export/server/apache-hive-3.1.2-bin/bin/hive --service metastore(前台启动metastore服务)

nohup /export/server/apache-hive-3.1.2-bin/bin/hive --service metastore &(后台启动metastore服务)

jps

nohup /export/server/apache-hive-3.1.2-bin/bin/hive --service hiveserver2 &

jps

node3

/export/server/apache-hive-3.1.2-bin/bin/beeline

! connect jdbc:hive2://node1:10000

root

(然后直接回车)

连接成功
Last login: Thu Feb 23 21:06:42 2023 from 192.168.88.1
[root@node1 ~]# jps
1813 Jps
[root@node1 ~]# start-all.sh
Starting namenodes on [node1]
上一次登录:四 2月 23 21:12:56 CST 2023从 192.168.88.1pts/1 上
Starting datanodes
上一次登录:四 2月 23 21:13:22 CST 2023pts/0 上
Starting secondary namenodes [node2]
上一次登录:四 2月 23 21:13:25 CST 2023pts/0 上
Starting resourcemanager
上一次登录:四 2月 23 21:13:31 CST 2023pts/0 上
Starting nodemanagers
上一次登录:四 2月 23 21:13:39 CST 2023pts/0 上
[root@node1 ~]# jps
2272 NameNode
3400 NodeManager
3162 ResourceManager
2477 DataNode
3903 Jps
[root@node1 ~]# nohup /export/server/apache-hive-3.1.2-bin/bin/hive --service metastore &
[1] 4670
[root@node1 ~]# nohup: 忽略输入并把输出追加到"nohup.out"[root@node1 ~]# jps
2272 NameNode
4880 Jps
3400 NodeManager
3162 ResourceManager
2477 DataNode
4670 RunJar
[root@node1 ~]# nohup /export/server/apache-hive-3.1.2-bin/bin/hive --service hiveserver2 &
[2] 5027
[root@node1 ~]# nohup: 忽略输入并把输出追加到"nohup.out"[root@node1 ~]# jps
2272 NameNode
5171 Jps
3400 NodeManager
3162 ResourceManager
5051 VersionInfo
2477 DataNode
4670 RunJar
[root@node1 ~]# jps
2272 NameNode
5027 RunJar
7383 Jps
3400 NodeManager
3162 ResourceManager
2477 DataNode
4670 RunJar
[root@node1 ~]# 
连接成功
Last login: Thu Feb 23 21:01:31 2023 from 192.168.88.1
[root@node3 ~]# /export/server/apache-hive-3.1.2-bin/bin/beeline
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/export/server/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/export/server/hadoop-3.3.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/export/server/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/export/server/hadoop-3.3.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Beeline version 3.1.2 by Apache Hive
beeline> ! connect jdbc:hive2://node1:10000
Connecting to jdbc:hive2://node1:10000
Enter username for jdbc:hive2://node1:10000: root
Enter password for jdbc:hive2://node1:10000: 
23/02/23 21:15:26 [main]: WARN jdbc.HiveConnection: Failed to connect to node1:10000
Could not open connection to the HS2 server. Please check the server URI and if the URI is correct, then ask the administrator to check the server status.
Error: Could not open client transport with JDBC Uri: jdbc:hive2://node1:10000: java.net.ConnectException: 拒绝连接 (Connection refused) (state=08S01,code=0)
beeline> 您在 /var/spool/mail/root 中有新邮件
[root@node3 ~]# /export/server/apache-hive-3.1.2-bin/bin/beeline
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/export/server/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/export/server/hadoop-3.3.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/export/server/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/export/server/hadoop-3.3.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Beeline version 3.1.2 by Apache Hive
beeline> ! connect jdbc:hive2://node1:10000
Connecting to jdbc:hive2://node1:10000
Enter username for jdbc:hive2://node1:10000: root
Enter password for jdbc:hive2://node1:10000: 
Connected to: Apache Hive (version 3.1.2)
Driver: Hive JDBC (version 3.1.2)
Transaction isolation: TRANSACTION_REPEATABLE_READ
0: jdbc:hive2://node1:10000> show databases;
INFO  : Compiling command(queryId=root_20230223211656_6489cb28-8689-4b0f-8ee6-6503535f4cbd): show databases
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:database_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223211656_6489cb28-8689-4b0f-8ee6-6503535f4cbd); Time taken: 1.802 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223211656_6489cb28-8689-4b0f-8ee6-6503535f4cbd): show databases
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223211656_6489cb28-8689-4b0f-8ee6-6503535f4cbd); Time taken: 0.085 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+----------------+
| database_name  |
+----------------+
| default        |
| itheima        |
+----------------+
2 rows selected (2.589 seconds)
0: jdbc:hive2://node1:10000> use itheima;
INFO  : Compiling command(queryId=root_20230223211710_5f6217f0-2d03-431b-8dee-23cb6965e677): use itheima
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:null, properties:null)
INFO  : Completed compiling command(queryId=root_20230223211710_5f6217f0-2d03-431b-8dee-23cb6965e677); Time taken: 0.045 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223211710_5f6217f0-2d03-431b-8dee-23cb6965e677): use itheima
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223211710_5f6217f0-2d03-431b-8dee-23cb6965e677); Time taken: 0.015 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
No rows affected (0.157 seconds)
0: jdbc:hive2://node1:10000> show tables;
INFO  : Compiling command(queryId=root_20230223211726_dd7ca710-179b-47e7-9cf8-a8396d2edf1b): show tables
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:tab_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223211726_dd7ca710-179b-47e7-9cf8-a8396d2edf1b); Time taken: 0.036 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223211726_dd7ca710-179b-47e7-9cf8-a8396d2edf1b): show tables
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223211726_dd7ca710-179b-47e7-9cf8-a8396d2edf1b); Time taken: 0.035 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+-----------+
| tab_name  |
+-----------+
| t_archer  |
+-----------+
1 row selected (0.122 seconds)
0: jdbc:hive2://node1:10000> 

在hive库里面用sql建成一张数据表以后,在hdfs里面就是一个文件夹,把文本传输进去,如果都能够对应的上,在hive这边客户端就能查到刚才文本映射出来的表结构数据。

 

--创建数据库并切换使用
create database if not exists itheima;
use itheima;--1、创建一张表,将射手结构化数据文件在Hive中映射成功
-- 表名
--  字段  名称  类型  顺序
--  字段之间的分隔符需要指定--ddl create table
create table itheima.t_archer(id int comment "ID编号",name string comment "英雄名称",hp_max int comment "最大生命",mp_max int comment "最大法力",attack_max int comment "最高物攻",defense_max int comment "最大物防",attack_range string comment "攻击范围",role_main string comment "主要定位",role_assist string comment "次要定位"
) comment "王者荣耀射手信息"
row format delimited
fields terminated by "\t"; -- 字段之间的分隔符是tab键 制表符select * from t_archer;create table itheima.t_archer1(id int comment "ID编号",name string comment "英雄名称",hp_max int comment "最大生命",mp_max int comment "最大法力",attack_max int comment "最高物攻",defense_max int comment "最大物防",attack_range string comment "攻击范围",role_main string comment "主要定位",role_assist string comment "次要定位"
);--使用默认分隔符建表  \001  非打印字符
create table t_team_ace_player(id int,team_name string,ace_player_name string
);
-- row format delimited
-- fields terminated by "\001";select * from t_team_ace_player;--使用默认分隔符建表  \001  非打印字符
create table t_team_ace_player2(id int,team_name string,ace_player_name string
)
row format delimited
fields terminated by "\t";select * from t_team_ace_player2;

05【Hive Show语法】

P067【17-Apache hive--常见的show语法】

0: jdbc:hive2://node1:10000> show databases;
INFO  : Compiling command(queryId=root_20230223211656_6489cb28-8689-4b0f-8ee6-6503535f4cbd): show databases
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:database_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223211656_6489cb28-8689-4b0f-8ee6-6503535f4cbd); Time taken: 1.802 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223211656_6489cb28-8689-4b0f-8ee6-6503535f4cbd): show databases
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223211656_6489cb28-8689-4b0f-8ee6-6503535f4cbd); Time taken: 0.085 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+----------------+
| database_name  |
+----------------+
| default        |
| itheima        |
+----------------+
2 rows selected (2.589 seconds)
0: jdbc:hive2://node1:10000> use itheima;
INFO  : Compiling command(queryId=root_20230223211710_5f6217f0-2d03-431b-8dee-23cb6965e677): use itheima
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:null, properties:null)
INFO  : Completed compiling command(queryId=root_20230223211710_5f6217f0-2d03-431b-8dee-23cb6965e677); Time taken: 0.045 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223211710_5f6217f0-2d03-431b-8dee-23cb6965e677): use itheima
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223211710_5f6217f0-2d03-431b-8dee-23cb6965e677); Time taken: 0.015 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
No rows affected (0.157 seconds)
0: jdbc:hive2://node1:10000> show tables;
INFO  : Compiling command(queryId=root_20230223211726_dd7ca710-179b-47e7-9cf8-a8396d2edf1b): show tables
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:tab_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223211726_dd7ca710-179b-47e7-9cf8-a8396d2edf1b); Time taken: 0.036 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223211726_dd7ca710-179b-47e7-9cf8-a8396d2edf1b): show tables
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223211726_dd7ca710-179b-47e7-9cf8-a8396d2edf1b); Time taken: 0.035 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+-----------+
| tab_name  |
+-----------+
| t_archer  |
+-----------+
1 row selected (0.122 seconds)
0: jdbc:hive2://node1:10000> show databases;
INFO  : Compiling command(queryId=root_20230223214926_9c11c9cf-81d6-460e-8cc5-ada1f4ba3b2a): show databases
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:database_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223214926_9c11c9cf-81d6-460e-8cc5-ada1f4ba3b2a); Time taken: 0.015 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223214926_9c11c9cf-81d6-460e-8cc5-ada1f4ba3b2a): show databases
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223214926_9c11c9cf-81d6-460e-8cc5-ada1f4ba3b2a); Time taken: 0.006 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+----------------+
| database_name  |
+----------------+
| default        |
| itheima        |
+----------------+
2 rows selected (0.048 seconds)
0: jdbc:hive2://node1:10000> show schemas;
INFO  : Compiling command(queryId=root_20230223214947_ea4ee4e1-3e8d-41c8-9ab9-3612885a12bd): show schemas
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:database_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223214947_ea4ee4e1-3e8d-41c8-9ab9-3612885a12bd); Time taken: 0.02 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223214947_ea4ee4e1-3e8d-41c8-9ab9-3612885a12bd): show schemas
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223214947_ea4ee4e1-3e8d-41c8-9ab9-3612885a12bd); Time taken: 0.006 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+----------------+
| database_name  |
+----------------+
| default        |
| itheima        |
+----------------+
2 rows selected (0.047 seconds)
0: jdbc:hive2://node1:10000> show tables;
INFO  : Compiling command(queryId=root_20230223215003_3e56b709-c5fc-47c5-9791-d6f34cb53e3d): show tables
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:tab_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223215003_3e56b709-c5fc-47c5-9791-d6f34cb53e3d); Time taken: 0.04 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223215003_3e56b709-c5fc-47c5-9791-d6f34cb53e3d): show tables
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223215003_3e56b709-c5fc-47c5-9791-d6f34cb53e3d); Time taken: 0.009 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+---------------------+
|      tab_name       |
+---------------------+
| t_archer            |
| t_archer1           |
| t_team_ace_player   |
| t_team_ace_player2  |
+---------------------+
4 rows selected (0.068 seconds)
0: jdbc:hive2://node1:10000> use def
default      deferrable   deferred     defined      
0: jdbc:hive2://node1:10000> use default;
INFO  : Compiling command(queryId=root_20230223215035_62f80942-23c8-413b-a4de-6ea52723e6f1): use default
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:null, properties:null)
INFO  : Completed compiling command(queryId=root_20230223215035_62f80942-23c8-413b-a4de-6ea52723e6f1); Time taken: 0.024 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223215035_62f80942-23c8-413b-a4de-6ea52723e6f1): use default
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223215035_62f80942-23c8-413b-a4de-6ea52723e6f1); Time taken: 0.007 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
No rows affected (0.042 seconds)
0: jdbc:hive2://node1:10000> show tables;
INFO  : Compiling command(queryId=root_20230223215037_65d2f780-be33-42f3-96ba-002eec6ff1e3): show tables
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:tab_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223215037_65d2f780-be33-42f3-96ba-002eec6ff1e3); Time taken: 0.024 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223215037_65d2f780-be33-42f3-96ba-002eec6ff1e3): show tables
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223215037_65d2f780-be33-42f3-96ba-002eec6ff1e3); Time taken: 0.008 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+-----------+
| tab_name  |
+-----------+
+-----------+
No rows selected (0.045 seconds)
0: jdbc:hive2://node1:10000> show tables in itheima;
INFO  : Compiling command(queryId=root_20230223215118_6fab9cbb-be95-417e-9549-0474cad5742f): show tables in itheima
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:tab_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223215118_6fab9cbb-be95-417e-9549-0474cad5742f); Time taken: 0.032 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223215118_6fab9cbb-be95-417e-9549-0474cad5742f): show tables in itheima
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223215118_6fab9cbb-be95-417e-9549-0474cad5742f); Time taken: 0.009 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+---------------------+
|      tab_name       |
+---------------------+
| t_archer            |
| t_archer1           |
| t_team_ace_player   |
| t_team_ace_player2  |
+---------------------+
4 rows selected (0.06 seconds)
0: jdbc:hive2://node1:10000> desc formatted t_team_ace_player;
Error: Error while compiling statement: FAILED: SemanticException [Error 10001]: Table not found t_team_ace_player (state=42S02,code=10001)
0: jdbc:hive2://node1:10000> desc formatted t_team_ace_player;
Error: Error while compiling statement: FAILED: SemanticException [Error 10001]: Table not found t_team_ace_player (state=42S02,code=10001)
0: jdbc:hive2://node1:10000> desc formatted t_archer;
Error: Error while compiling statement: FAILED: SemanticException [Error 10001]: Table not found t_archer (state=42S02,code=10001)
0: jdbc:hive2://node1:10000> show tables;
INFO  : Compiling command(queryId=root_20230223215309_27c866fa-f738-4072-96bb-8270f94f7540): show tables
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:tab_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223215309_27c866fa-f738-4072-96bb-8270f94f7540); Time taken: 0.028 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223215309_27c866fa-f738-4072-96bb-8270f94f7540): show tables
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223215309_27c866fa-f738-4072-96bb-8270f94f7540); Time taken: 0.008 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+-----------+
| tab_name  |
+-----------+
+-----------+
No rows selected (0.053 seconds)
0: jdbc:hive2://node1:10000> show tables in itheima;
INFO  : Compiling command(queryId=root_20230223215315_84c2bd7d-00a5-47c5-b118-37af449380f8): show tables in itheima
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:tab_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223215315_84c2bd7d-00a5-47c5-b118-37af449380f8); Time taken: 0.03 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223215315_84c2bd7d-00a5-47c5-b118-37af449380f8): show tables in itheima
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223215315_84c2bd7d-00a5-47c5-b118-37af449380f8); Time taken: 0.01 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+---------------------+
|      tab_name       |
+---------------------+
| t_archer            |
| t_archer1           |
| t_team_ace_player   |
| t_team_ace_player2  |
+---------------------+
4 rows selected (0.068 seconds)
0: jdbc:hive2://node1:10000> desc formatted t_team_ace_player;
Error: Error while compiling statement: FAILED: SemanticException [Error 10001]: Table not found t_team_ace_player (state=42S02,code=10001)
0: jdbc:hive2://node1:10000> use itheima;
INFO  : Compiling command(queryId=root_20230223215329_836ff206-4117-4e17-971f-6a90beddc017): use itheima
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:null, properties:null)
INFO  : Completed compiling command(queryId=root_20230223215329_836ff206-4117-4e17-971f-6a90beddc017); Time taken: 0.023 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223215329_836ff206-4117-4e17-971f-6a90beddc017): use itheima
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223215329_836ff206-4117-4e17-971f-6a90beddc017); Time taken: 0.011 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
No rows affected (0.046 seconds)
0: jdbc:hive2://node1:10000> show tables;
INFO  : Compiling command(queryId=root_20230223215335_72de1e84-a59d-4a58-9a2a-f224716b9796): show tables
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:tab_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223215335_72de1e84-a59d-4a58-9a2a-f224716b9796); Time taken: 0.027 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223215335_72de1e84-a59d-4a58-9a2a-f224716b9796): show tables
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223215335_72de1e84-a59d-4a58-9a2a-f224716b9796); Time taken: 0.01 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+---------------------+
|      tab_name       |
+---------------------+
| t_archer            |
| t_archer1           |
| t_team_ace_player   |
| t_team_ace_player2  |
+---------------------+
4 rows selected (0.055 seconds)
0: jdbc:hive2://node1:10000> desc formatted t_team_ace_player;
INFO  : Compiling command(queryId=root_20230223215339_61a932de-0793-42ba-8d6d-e501707939ec): desc formatted t_team_ace_player
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:col_name, type:string, comment:from deserializer), FieldSchema(name:data_type, type:string, comment:from deserializer), FieldSchema(name:comment, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223215339_61a932de-0793-42ba-8d6d-e501707939ec); Time taken: 0.044 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223215339_61a932de-0793-42ba-8d6d-e501707939ec): desc formatted t_team_ace_player
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223215339_61a932de-0793-42ba-8d6d-e501707939ec); Time taken: 0.133 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+-------------------------------+----------------------------------------------------+----------------------------------------------------+
|           col_name            |                     data_type                      |                      comment                       |
+-------------------------------+----------------------------------------------------+----------------------------------------------------+
| # col_name                    | data_type                                          | comment                                            |
| id                            | int                                                |                                                    |
| team_name                     | string                                             |                                                    |
| ace_player_name               | string                                             |                                                    |
|                               | NULL                                               | NULL                                               |
| # Detailed Table Information  | NULL                                               | NULL                                               |
| Database:                     | itheima                                            | NULL                                               |
| OwnerType:                    | USER                                               | NULL                                               |
| Owner:                        | root                                               | NULL                                               |
| CreateTime:                   | Thu Feb 23 21:31:11 CST 2023                       | NULL                                               |
| LastAccessTime:               | UNKNOWN                                            | NULL                                               |
| Retention:                    | 0                                                  | NULL                                               |
| Location:                     | hdfs://node1:8020/user/hive/warehouse/itheima.db/t_team_ace_player | NULL                                               |
| Table Type:                   | MANAGED_TABLE                                      | NULL                                               |
| Table Parameters:             | NULL                                               | NULL                                               |
|                               | COLUMN_STATS_ACCURATE                              | {\"BASIC_STATS\":\"true\",\"COLUMN_STATS\":{\"ace_player_name\":\"true\",\"id\":\"true\",\"team_name\":\"true\"}} |
|                               | bucketing_version                                  | 2                                                  |
|                               | numFiles                                           | 0                                                  |
|                               | numRows                                            | 0                                                  |
|                               | rawDataSize                                        | 0                                                  |
|                               | totalSize                                          | 0                                                  |
|                               | transient_lastDdlTime                              | 1677159071                                         |
|                               | NULL                                               | NULL                                               |
| # Storage Information         | NULL                                               | NULL                                               |
| SerDe Library:                | org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe | NULL                                               |
| InputFormat:                  | org.apache.hadoop.mapred.TextInputFormat           | NULL                                               |
| OutputFormat:                 | org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat | NULL                                               |
| Compressed:                   | No                                                 | NULL                                               |
| Num Buckets:                  | -1                                                 | NULL                                               |
| Bucket Columns:               | []                                                 | NULL                                               |
| Sort Columns:                 | []                                                 | NULL                                               |
| Storage Desc Params:          | NULL                                               | NULL                                               |
|                               | serialization.format                               | 1                                                  |
+-------------------------------+----------------------------------------------------+----------------------------------------------------+
33 rows selected (0.21 seconds)
0: jdbc:hive2://node1:10000> desc formatted t_archer;
INFO  : Compiling command(queryId=root_20230223215354_49faf959-b5e0-46b8-bd99-8e65c5d62add): desc formatted t_archer
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:col_name, type:string, comment:from deserializer), FieldSchema(name:data_type, type:string, comment:from deserializer), FieldSchema(name:comment, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223215354_49faf959-b5e0-46b8-bd99-8e65c5d62add); Time taken: 0.044 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223215354_49faf959-b5e0-46b8-bd99-8e65c5d62add): desc formatted t_archer
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223215354_49faf959-b5e0-46b8-bd99-8e65c5d62add); Time taken: 0.044 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+-------------------------------+----------------------------------------------------+----------------------------------------------------+
|           col_name            |                     data_type                      |                      comment                       |
+-------------------------------+----------------------------------------------------+----------------------------------------------------+
| # col_name                    | data_type                                          | comment                                            |
| id                            | int                                                | ID??                                               |
| name                          | string                                             | ????                                               |
| hp_max                        | int                                                | ????                                               |
| mp_max                        | int                                                | ????                                               |
| attack_max                    | int                                                | ????                                               |
| defense_max                   | int                                                | ????                                               |
| attack_range                  | string                                             | ????                                               |
| role_main                     | string                                             | ????                                               |
| role_assist                   | string                                             | ????                                               |
|                               | NULL                                               | NULL                                               |
| # Detailed Table Information  | NULL                                               | NULL                                               |
| Database:                     | itheima                                            | NULL                                               |
| OwnerType:                    | USER                                               | NULL                                               |
| Owner:                        | root                                               | NULL                                               |
| CreateTime:                   | Thu Feb 23 17:21:18 CST 2023                       | NULL                                               |
| LastAccessTime:               | UNKNOWN                                            | NULL                                               |
| Retention:                    | 0                                                  | NULL                                               |
| Location:                     | hdfs://node1:8020/user/hive/warehouse/itheima.db/t_archer | NULL                                               |
| Table Type:                   | MANAGED_TABLE                                      | NULL                                               |
| Table Parameters:             | NULL                                               | NULL                                               |
|                               | COLUMN_STATS_ACCURATE                              | {\"BASIC_STATS\":\"true\",\"COLUMN_STATS\":{\"attack_max\":\"true\",\"attack_range\":\"true\",\"defense_max\":\"true\",\"hp_max\":\"true\",\"id\":\"true\",\"mp_max\":\"true\",\"name\":\"true\",\"role_assist\":\"true\",\"role_main\":\"true\"}} |
|                               | bucketing_version                                  | 2                                                  |
|                               | comment                                            | ????????                                           |
|                               | numFiles                                           | 0                                                  |
|                               | numRows                                            | 0                                                  |
|                               | rawDataSize                                        | 0                                                  |
|                               | totalSize                                          | 0                                                  |
|                               | transient_lastDdlTime                              | 1677144078                                         |
|                               | NULL                                               | NULL                                               |
| # Storage Information         | NULL                                               | NULL                                               |
| SerDe Library:                | org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe | NULL                                               |
| InputFormat:                  | org.apache.hadoop.mapred.TextInputFormat           | NULL                                               |
| OutputFormat:                 | org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat | NULL                                               |
| Compressed:                   | No                                                 | NULL                                               |
| Num Buckets:                  | -1                                                 | NULL                                               |
| Bucket Columns:               | []                                                 | NULL                                               |
| Sort Columns:                 | []                                                 | NULL                                               |
| Storage Desc Params:          | NULL                                               | NULL                                               |
|                               | field.delim                                        | \t                                                 |
|                               | serialization.format                               | \t                                                 |
+-------------------------------+----------------------------------------------------+----------------------------------------------------+
41 rows selected (0.114 seconds)
0: jdbc:hive2://node1:10000> 

P068【18-Apache hive--注释comment中文乱码解决】

hive将数据保存在mysql中,而mysql默认的编码不支持中文(默认编码 Latin1,兼容ascii)。

--注意:下面sql语句是需要在MySQL中执行,修改Hive存储的元数据信息(metadata)。
use hive3;
show tables;alter table hive3.COLUMNS_V2 modify column COMMENT varchar(256) character set utf8;
alter table hive3.TABLE_PARAMS modify column PARAM_VALUE varchar(4000) character set utf8;
alter table hive3.PARTITION_PARAMS modify column PARAM_VALUE varchar(4000) character set utf8 ;
alter table hive3.PARTITION_KEYS modify column PKEY_COMMENT varchar(4000) character set utf8;
alter table hive3.INDEX_PARAMS modify column PARAM_VALUE varchar(4000) character set utf8;
--创建数据库并切换使用
create database if not exists itheima;
use itheima;--1、创建一张表,将射手结构化数据文件在Hive中映射成功
-- 表名
--  字段  名称  类型  顺序
--  字段之间的分隔符需要指定--ddl create table
create table itheima.t_archer(id int comment "ID编号",name string comment "英雄名称",hp_max int comment "最大生命",mp_max int comment "最大法力",attack_max int comment "最高物攻",defense_max int comment "最大物防",attack_range string comment "攻击范围",role_main string comment "主要定位",role_assist string comment "次要定位"
) comment "王者荣耀射手信息"
row format delimited
fields terminated by "\t"; -- 字段之间的分隔符是tab键 制表符select * from t_archer;--查看表结构
desc formatted t_archer;--删除表sql
drop table t_archer;create table itheima.t_archer1(id int comment "ID编号",name string comment "英雄名称",hp_max int comment "最大生命",mp_max int comment "最大法力",attack_max int comment "最高物攻",defense_max int comment "最大物防",attack_range string comment "攻击范围",role_main string comment "主要定位",role_assist string comment "次要定位"
);--使用默认分隔符建表  \001  非打印字符
create table t_team_ace_player(id int,team_name string,ace_player_name string
);
-- row format delimited
-- fields terminated by "\001";select * from t_team_ace_player;--使用默认分隔符建表  \001  非打印字符
create table t_team_ace_player2(id int,team_name string,ace_player_name string
)
row format delimited
fields terminated by "\t";select * from t_team_ace_player2;

相关文章:

大数据Hadoop教程-学习笔记04【数据仓库基础与Apache Hive入门】

视频教程&#xff1a;哔哩哔哩网站&#xff1a;黑马大数据Hadoop入门视频教程 总时长&#xff1a;14:22:04教程资源: https://pan.baidu.com/s/1WYgyI3KgbzKzFD639lA-_g 提取码: 6666【P001-P017】大数据Hadoop教程-学习笔记01【大数据导论与Linux基础】【17p】【P018-P037】大…...

20230223 刚体上的两个点速度之间的关系

刚体上的两个点速度之间的关系 注意&#xff1a;这里所讨论的都是投影在惯性坐标系上的。 dMAdMOdOAdMOdCA−dCOd_{_{MA}}d_{_{MO}}d_{_{OA}}d_{_{MO}}d_{_{CA}}-d_{_{CO}}dMA​​dMO​​dOA​​dMO​​dCA​​−dCO​​ 求导 d˙MAd˙MOd˙CA−d˙CO\dot d_{_{MA}}\dot d_{_…...

17.1 Display system tasks

系统任务的显示组分为三类&#xff1a;显示和写入任务、选通监视任务和连续监视任务。17.1.1 The display and write tasks $display和$write系统任务的语法如语法17-1所示。 display_tasks ::display_task_name [ ( list_of_arguments ) ] ; display_task_name ::$display | …...

【4】linux命令每日分享——cd切换路径

大家好&#xff0c;这里是sdust-vrlab&#xff0c;Linux是一种免费使用和自由传播的 类UNIX操作系统&#xff0c;Linux的基本思想有两点&#xff1a;一切都是文件&#xff1b;每个文件都有确定的用途&#xff1b;linux涉及到IT行业的方方面面&#xff0c;在我们日常的学习中&am…...

诚邀您体验人工智能AI

近期&#xff0c;人工智能&#xff08;AI&#xff09;领域动作频频&#xff0c;OPENAI公司Chat GPT的出现&#xff0c;标志着人工智能的研究与应用已经进入了一个崭新的发展阶段&#xff0c;国内腾讯、阿里巴巴、百度、易网、国外微软、谷歌、苹果、IBM、Amazon&#xff0c;等互…...

【蓝桥杯集训·每日一题】AcWing 2058. 笨拙的手指

文章目录一、题目1、原题链接2、题目描述二、解题报告1、思路分析2、时间复杂度3、代码详解三、知识风暴哈希表秦九韶算法一、题目 1、原题链接 2058. 笨拙的手指 2、题目描述 奶牛贝茜正在学习如何在不同进制之间转换数字。 但是她总是犯错误&#xff0c;因为她无法轻易的用两…...

运维排查篇 | Linux 连接跟踪表满了怎么处理

nf_conntrack (在老版本的 Linux 内核中叫 ip_conntrack )是一个内核模块&#xff0c;用于跟踪一个网络连接的状态 一旦内核 netfilter 模块 conntrack 相关参数配置不合理&#xff0c;导致 nf_conntrack table full &#xff0c;就会出现丢包、连接无法建立的问题 这个问题其…...

docker网络基

本文简单介绍下&#xff0c;容器之间的网络访问、容器与宿主机之间的网络访问、宿主机上有哪些网络接口。lolocal的简写&#xff0c;本地回环地址&#xff0c;127.0.0.1&#xff0c;它代表本地虚拟设备接口&#xff0c;默认被看作是永远不会宕掉的接口eth0ethernet的简写&#…...

C++:谈谈单例模式的多种实现形式

文章目录实现 1&#xff1a;静态成员实现 2&#xff1a;atexit 懒汉模式实现 3&#xff1a;原子变量 懒汉模式实现4&#xff1a;atexit 饿汉模式* 实现5&#xff1a;magic static单例模式&#xff1a;保证一个类仅有一个实例&#xff0c;并提供一个该实例的全局访问点。 稳…...

【Spring Cloud Alibaba】007-Nacos 配置*

【Spring Cloud Alibaba】007-Nacos 配置* 文章目录【Spring Cloud Alibaba】007-Nacos 配置*一、概述1、概述2、对比 spring cloud config二、基本使用1、在管理界面新建配置2、启动权限3、 搭建 nacos-config 服务第一步&#xff1a;引入依赖第二步&#xff1a;修改 yaml 配置…...

《安富莱嵌入式周报》第304期:开源硬件耳机设计,AI单片机STM32N6已确定为M55内核,另外还有新品STM32H5, H50X, H7R, H7S发布

往期周报汇总地址&#xff1a;嵌入式周报 - uCOS & uCGUI & emWin & embOS & TouchGFX & ThreadX - 硬汉嵌入式论坛 - Powered by Discuz! 更新一期视频教程&#xff1a; 第6期ThreadX视频教程&#xff1a;图文并茂吃透RTOS运行机制&#xff0c;任务管理&…...

vuex篇

1.简介(1)vuexVuex 是一个专为 Vue.js 应用程序开发的状态管理模式 库vuex是为vue.js开发的状态管理模式、组件状态集中管理(2)单页面数据流状态发生变化, 视图就重新渲染state发生变化时, 导致view视图发生改变, 视图通过操作action行为, 又会使得state状态发生变化(3)使用场…...

嵌入式开发:在嵌入式应用程序中混合C和C++

许多嵌入式应用程序仍使用c语言编写&#xff0c;但越来越多的嵌入式开发人员现在使用C语言编写程序。某些应用程序甚至共享这两种语言。这有意义吗?C是嵌入式应用中最常用的编程语言。多年来&#xff0c;人们一直期待着向C过渡&#xff0c;但过渡速度相当缓慢。但是&#xff0…...

【2023/图对比/增强】MA-GCL: Model Augmentation Tricks for Graph Contrastive Learning

如果觉得我的分享有一定帮助&#xff0c;欢迎关注我的微信公众号 “码农的科研笔记”&#xff0c;了解更多我的算法和代码学习总结记录。或者点击链接扫码关注【2023/图对比/增强】MA-GCL: Model Augmentation Tricks for Graph Contrastive Learning 【2023/图对比/增强】MA-…...

TensorBoard自定义修改单条及多条曲线颜色

在深度学习可视化训练过程中&#xff0c;曲线颜色是随机的&#xff0c;想要将好看的曲线颜色图放到论文中&#xff0c;就得自定义曲线颜色&#xff0c;具体方法见下文。 目录一、下载svg文件二、修改svg文件三、修改后曲线颜色对比四、总结一、下载svg文件 在TensorBoard界面中…...

时间和空间复杂度

文章目录 前言 一、算法效率 1.如何评判算法效率&#xff1f; 2.算法的复杂度 二、时间复杂度 1.时间复杂度的定义 2. 大O的渐进表示法 三、空间复杂度 总结 前言 本文章讲解时间与空间复杂度 提示&#xff1a;以下是本篇文章正文内容&#xff0c;下面案例可供参考 一、算法…...

关于Linux下调试

关于Linux下调试 无论是内核&#xff08;操作系统&#xff09;还是应用程序&#xff0c;都存在需要调试的情况。 所谓工欲善其事&#xff0c;必先利其器。一个好的称手的工具&#xff0c;对于快速分析问题、定位问题&#xff0c;提高效率&#xff0c;非常有帮助。 除了工具&a…...

理解TP、FP、TN、FN

概念定义 按照常用的术语&#xff0c;将两个类分别称为正类 (positive) 和 负类 (negative)。使用数学表示&#xff1a; 1表示正类 &#xff0c; -1 表示负类。 正类通常是少数类&#xff0c;即样本较少的类&#xff08;例如有缺陷的零件&#xff09; 负类通常是多数类&#x…...

软考中级有用吗

当然有用了&#xff01; 软考“简历”&#xff1a;计算机软件资格考试在全国范围内已经实施了二十多年&#xff0c;近十年来,考试规模持续增长&#xff0c;截止目前,累计报考人数约有五百万人。该考试由于其权威性和严肃性&#xff0c;得到了社会各界及用人单位的广泛认同&…...

计算机网络之IP协议(详解

网络层主管地址管理与路由选择。而IP协议就是网络层中一个非常重要的协议。它的作用就是在复杂的网络环境中确定一个合适的路径。IP协议头格式4位版本号(version) 指定IP协议的版本&#xff0c;目前只有两个版本&#xff1a;IP v4和IP v6.对于IP v4来说&#xff0c;这个值就是4…...

Kubernetes之探针probe

deployment只保证pod的状态为running。如果pod状态是running&#xff0c;但是里面丢失了文件&#xff0c;导致用户不能访问数据&#xff0c;则deployment是不管用的&#xff0c;此时就需要probe来检测pod是否正常工作。 probe是定义在容器里的&#xff0c;可以理解为容器里加的…...

高性能低功耗4口高速USB2.0 HUB NS1.1S 兼容FE1.1

NS1.1S是一款高性能、低功耗4口高速 USB2.0 HUB 控制器&#xff0c;上行端口兼容高速 480MHz和全速12MHz两种模式&#xff0c;4个下行端口兼容高速480MHz、全速12MHz、低速1.5MHz三种模式。 NS1.1S采用状态机单事务处理架构&#xff0c;而非单片机架构&#xff0c;多个事务缓冲…...

通过VS Code轻松连接树莓派

如果您正在使用树莓派作为开发平台&#xff0c;那么通过远程连接VS Code到树莓派是非常方便的一种方法。这样&#xff0c;您可以在Windows或macOS等计算机上开发和测试代码&#xff0c;而不必在树莓派上进行。 以下是通过VS Code远程连接到树莓派的步骤&#xff1a; 1.安装Re…...

图纸等敏感文件数据外发时 如何确保效率和安全性?

很多企业随着业务的发展&#xff0c;需要频繁的与外部供应商、合作伙伴之间进行数据的交换和使用。尤其是制造型企业&#xff0c;可能每天都要与几十、上百家供应商及合作伙伴进行产品数据交换。目前&#xff0c;大多数企业已经在内部实施了PDM/PLM系统&#xff0c;实现了对组织…...

2023年CDGA考试-第4章-数据架构(含答案)

2023年CDGA考试-第4章-数据架构(含答案) 单选题 1.请从下列选项中选择不属于数据架构师职责的选项 A.确保数据架构和企业战略及业务架构一致 B.提供数据和组件的标准业务词汇 C.设计企业数据模型 D.整合企业数据架构蓝图 答案 C 2.请从下列选项中选择不属于企业数据架构…...

理解随机游走

随机游走 基本思想 从一个或一系列顶点开始遍历一张图。在任意一个顶点&#xff0c;遍历者将以概率1-a游走到这个顶点的邻居顶点&#xff0c;以概率a随机跳跃到图中的任何一个顶点&#xff0c;称a为跳转发生概率&#xff0c;每次游走后得出一个概率分布&#xff0c;该概率分布…...

mqtt协议1- 简介和报文格式

文章目录1.mqtt协议1: 简介和报文格式1.1.MQTT概念1.2.数据2.控制报文格式2.1.MQTT数据包结构2.2.固定头2.2.1.控制报文类型2.2.2.标志FLag2.2.3.剩余长度2.3.可变头2.4.有效载荷Payload消息体安全QoS(Quality of Service levels)ref:1.mqtt协议1: 简介和报文格式 Message Que…...

前端用动画快速实现骨架屏效果

一、动画的语法 1.定义动画 keyframes 自定义动画名称 {// 开始from {transform: scale(1);}// 结束to {transform: scale(1.5);} }// 或者还可以使用百分比定义keyframes 动画名称 {// 开始0% {transform: scale(1);}// 结束100% {transform: scale(1.5);} } 2.调用 anima…...

Python入门(未完待续。。。)

认识python 解释型&#xff08;写完直接运行&#xff09;、面向对象的高级编程语言&#xff1b;开源免费、支持交互式、可跨平台移植的脚本语言&#xff1b;优点&#xff1a;开源、易于维护、可移植、简单优雅、功能强大、可扩展、可移植&#xff1b;缺点&#xff1a;解释型→运…...

注解配置SpringMVC

使用配置类和注解代替web.xml和Spring和SpringMVC配置文件的功能。创建初始化类&#xff0c;代替web.xmlSpring3.2引入了一个便利的WebApplicationInitializer基础实现&#xff0c;名为AbstractAnnotationConfigDispatcherServletInitializer&#xff0c;当我们的类扩展了Abstr…...