sql

1.SQL语句类别

SQL 语句主要可以划分为以下 3 个类别。

DDL(Data Definition Languages)语句:数据定义语言,这些语句定义了不同的数据段、数据库、表、列、索引等数据库对象的定义。常用的语句关键字主要包括 create、drop、alter等。

DML(Data Manipulation Language)语句:数据操纵语句,用于添加、删除、更新和查询数据库记录,并检查数据完整性,常用的语句关键字主要包括 insert、delete、udpate 和select 等。(增添改查)

DCL(Data Control Language)语句:数据控制语句,用于控制不同数据段直接的许可和访问级别的语句。这些语句定义了数据库、表、字段、用户的访问权限和安全级别。主要的语句关键字包括 grant、revoke 等。

2.sql语句执行顺序

https://www.cnblogs.com/Qian123/p/5669259.html

https://www.cnblogs.com/Qian123/p/5669259.html

https://cloud.tencent.com/developer/article/1600323

1
2
3
4
5
6
7
8
1、from子句组装来自不同数据源的数据;
2、where子句基于指定的条件对记录行进行筛选;
3、group by子句将数据划分为多个分组;
4、聚合函数进行计算;
5、having子句筛选分组;
6、计算所有的表达式;
7、select字段;
8、order by对结果集进行排序。

感觉好像先select后having

Atlas

1.概述

Apache Atlas为组织提供开放式元数据管理和治理功能,用以构建其数据资产目录,对这些资产进行分类和管理,并为数据分析师和数据治理+团队,提供围绕这些数据资产的协作功能。

2.Atlas的具体功能

元数据分类 支持对元数据进行分类管理,例如个人信息,敏感信息等
元数据检索 可按照元数据类型、元数据分类进行检索,支持全文检索
血缘依赖 支持表到表和字段到字段之间的血缘依赖,便于进行问题回溯和影响分析等

1)表与表之间的血缘依赖

2)字段与字段之间的血缘依赖

3.Atlas架构原理

4.使用

4.1 Hive元数据初次导入

操作:

Atlas提供了一个Hive元数据导入的脚本,直接执行该脚本,即可完成Hive元数据的初次全量导入。

/opt/module/atlas/hook-bin/import-hive.sh

问题:

Failed to import Hive Meta Data!!!

注意:hive —service metastore &

4.2 Hive元数据增量同步

Hive元数据的增量同步,无需人为干预,只要Hive中的元数据发生变化(执行DDL语句),Hive Hook就会将元数据的变动通知Atlas。除此之外,Atlas还会根据DML语句获取数据之间的血缘关系。

元数据管理

元数据

https://www.ruanyifeng.com/blog/2007/03/metadata.html#

https://dataedo.com/kb/data-glossary/what-is-metadata

https://www.cnblogs.com/alight/p/3982086.html

Metadata is simply data about data. It means it is a description and context of the data. It helps to organize, find and understand data. Here are a few real world examples of metadata:

Those are some typical metadata elements:

  1. Title and description
  2. Tags and categories
  3. Who created and when
  4. Who last modified and when
  5. Who can access or update

元数据管理

https://zhuanlan.zhihu.com/p/336504407

元数据管理工具

atlas

hive

Ranger

架构

Ranager的核心是Web应用程序,也称为RangerAdmin模块,此模块由管理策略,审计日志和报告等三部分组成。

管理员角色的用户可以通过RangerAdmin提供的web界面或REST APIS来定制安全策略。这些策略会由Ranger提供的轻量级的针对不同Hadoop体系中组件的插件来执行。插件会在Hadoop的不同组件的核心进程启动后,启动对应的插件进程来进行安全管理!

Ranger对Hive进行权限管理

https://www.jianshu.com/p/d9941b8687b7

Hadoop in Secure Mode

https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-common/SecureMode.html#:~:text=When%20Hadoop%20is%20configured%20to,or%20%2Fetc%2Fhosts%20files.

This document describes how to configure authentication for Hadoop in secure mode.

By default Hadoop runs in non-secure mode in which no actual authentication is required.By configuring Hadoop runs in secure mode, each user and service needs to be authenticated by Kerberos in order to use Hadoop services.

hadoop SafeMode

https://blog.csdn.net/bingduanlbd/article/details/51900512

https://developer.aliyun.com/article/566059#

https://hadoop.apache.org/docs/r2.4.1/hadoop-project-dist/hadoop-hdfs/HdfsUserGuide.html#Safemode

During start up the NameNode loads the file system state from the fsimage and the edits log file. It then waits for DataNodes to report their blocks so that it does not prematurely start replicating the blocks though enough replicas already exist in the cluster. During this time NameNode stays in Safemode. Safemode for the NameNode is essentially a read-only mode for the HDFS cluster, where it does not allow any modifications to file system or blocks. Normally the NameNode leaves Safemode automatically after the DataNodes have reported that most file system blocks are available. If required, HDFS could be placed in Safemode explicitly using bin/hadoop dfsadmin -safemode command. NameNode front page shows whether Safemode is on or off. A more detailed description and configuration is maintained as JavaDoc for setSafeMode().

安全模式是HDFS所处的一种特殊状态,在这种状态下,文件系统只接受读数据请求,而不接受删除、修改等变更请求。在NameNode主节点启动时,HDFS首先进入安全模式,DataNode在启动的时候会向namenode汇报可用的block等状态,当整个系统达到安全标准时,HDFS自动离开安全模式。如果HDFS出于安全模式下,则文件block不能进行任何的副本复制操作,因此达到最小的副本数量要求是基于datanode启动时的状态来判定的,启动时不会再做任何复制(从而达到最小副本数量要求)

Kerberos

1.定义

Kerberos是一种计算机网络认证协议,用来在非安全网络中,对个人通信以安全的手段进行身份认证。这个词又指麻省理工学院为这个协议开发的一套计算机软件。软件设计上采用客户端/服务器结构,并且能够进行相互认证,即客户端和服务器端均可对对方进行身份认证。可以用于防止窃听、防止重放攻击、保护数据完整性等场合,是一种应用对称密钥体制进行密钥管理的系统。

1)KDC(Key Distribute Center):密钥分发中心,负责存储用户信息,管理发放票据。

2)Realm:Kerberos所管理的一个领域或范围。

3)Rrincipal:可以理解为Kerberos中保存的一个账号,其格式通常如下:primary/instance@realm

4)keytab:密钥文件。

有个疑问 ,对谁认证?是对不同用户吗(root,user1,user2)?

2.认证原理

https://cloud.tencent.com/developer/article/1496451

https://blog.csdn.net/jewes/article/details/20792021

3.基本操作

https://blog.csdn.net/Happy_Sunshine_Boy/article/details/102801386

1 创建管理员用户

2 注册

3 认证

4.HADOOP

配置

https://www.cnblogs.com/yjt1993/p/11769515.html

https://makeling.github.io/bigdata/39395030.html

访问HDFS集群文件

  1. Shell命令

    kinit admin/admin

    klist

  2. web页面

    1.安装Kerberos客户端

    2.配置火狐浏览器

    3.认证

5.HIVE

配置

https://zhuanlan.zhihu.com/p/137424234

客服端访问

  1. beeline

    0.首先需使用hive用户启动hiveserver2

    [root@hadoop102 ~]# sudo -i -u hive hiveserver2

    1.认证,执行以下命令,并按照提示输入密码

    [atguigu@hadoop102 ~]$ kinit atguigu

    2.使用beeline客户端连接hiveserver2

    [atguigu@hadoop102 ~]$ beeline

    3.使用如下url进行连接

    1
    !connect jdbc:hive2://hadoop102:10000/;principal=hive/hadoop102@EXAMPLE.COM
  2. DataGrip客户端

    https://blog.csdn.net/github_39319229/article/details/112692897

    经常连接不稳定,连接失败可以尝试重启DataGrip

6.数仓

此处统一将数仓的全部数据资源的所有者设为hive用户,全流程的每步操作均认证为hive用户。

7.即席查询

8.spark

https://www.cnblogs.com/bainianminguo/p/12639887.html

9 hbase

1 hbase shell kerberos认证错误

1
root:kinit atguigu

参考

https://blog.csdn.net/jewes/article/details/20792021


:D 一言句子获取中...