数据中台建设方法论

kerberos的使用

kerberos的使用

KDC常用操作

kadmin.local :打开KDC控制台,需要root权限

1
kadmin.local

addprinc :添加用户

1
2
3
4
5
添加用户,密码随机
addprinc -randkey root/admin

添加用户,输入用户密码
addprinc root/admin

delprinc :删除principle

1
delprinc  hdfs/admin

Trino连接启用Kerberos认证的CDH集群

Trino 连接启用 Kerberos 认证的CDH

Kudu

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
kudu.authentication.type = KERBEROS

## The kerberos client principal name
kudu.authentication.client.principal = clientprincipalname

## The path to the kerberos keytab file
## The configured client principal must exist in this keytab file
kudu.authentication.client.keytab = /path/to/keytab/file.keytab

## The path to the krb5.conf kerberos config file
kudu.authentication.config = /path/to/kerberos/krb5.conf

## Optional and defaults to "kudu"
## If kudu is running with a custom SPN this needs to be configured
kudu.authentication.server.principal.primary = kudu

kudu.authentication.server.principal.primary = kudu 这个没搞懂用途,用的默认值


Kerberos原理说明

Kerberos

Kerberos是一种通过传统的加密技术(共享密钥)实现的可信任的第三方认证机制。

kerberos协议中包含3种角色:

  • 客户端(client):发送请求的一方
  • 服务端(Server):接收请求的一方
  • 密钥分发中心(Key Distribution Center,KDC):密钥分发中心包括AS(Authentication Server)认证服务器和TGS(Ticket Granting Ticket)票据授予服务器

整个kerberos认证流程可以简化描述如下:
客户端在访问每个想要访问的网络服务时,他需要携带一个专门用于访问该服务并且能够证明自己身份的票据,当服务端收到了该票据他才能认定客户端身份正确,向客户端提供服务。所以整个认证流程可简化为两大步:

  1. 客户端向KDC请求获取想要访问的目标服务的服务授予票据(Ticket)(先在AS做可信身份认证,再在TGS申请票据);
  2. 客户端拿着从KDC获取的服务授予票据(Ticket)访问相应的网络服务


nginx添加basic表单认证

nginx给网站添加basic表单认证

很多大数据组件的adminUI 并没有设计授权认证,可以通过nginx 做一个简单的用户名密码认证:

  1. 生成密码文件
1
2
3
4
yum install httpd-tools -y

#输入密码,就会生成加密的用户密码文件
htpasswd -c /etc/nginx/conf.d/.ngpasswd admin

2 nginx 加上 auth_basic信息


Trino、Kudu 自监控页面配置Nginx Path访问

Trino、Kudu 自监控页面配置Nginx Path访问

Trino 的WebUI 默认是 {domain/ip}:8080

Kudu 的WebUI 默认是 {domain/ip}:8051/8050

现在期望通过 {domain/ip}:80/trino、 {domain/ip}:80/kudu 来访问

在客户环境中并不能把这些端口都开放出来,那么就需要通过Nginx 配置 path 才能访问,直接设置 proxy_pass 并不能展现出来,kudu 的因为html中都是绝对路径,Trino中是由于cookie设置是固定的

也许可以通过 kudu或者trino本身的配置实现 path 访问,但是没找到,所以想了其他办法


Kudu 删除表range分区

Kudu 删除表range分区

https://kudu.apache.org/docs/command_line_tools_reference.html#table-drop_range_partition

注意事项

  1. 一次只能删一个分区
  2. 分区条件必须前后精准匹配
  3. 可以通过kudu table describe查看表信息(包括分区信息):
1
2
# 查看表信息,包括列、分区信息
kudu table describe 10.128.2.162:7051,10.128.2.72:7051,10.128.2.172:7051 bn_op_1228

Kudu表复制(表数据迁移)

Kudu 表复制(表数据迁移)

https://kudu.apache.org/docs/command_line_tools_reference.html#table-copy

注意事项:

  1. 要求复制表于原表的列的结构一致(不要求分区和副本一致,所以可以调整表的副本数)
  2. 可以先只复制表结构
  3. predicates 预言 大小比值 只支持数值类型,时间戳类型不支持
  4. 注意超时设置
  5. write_type 参数有3种:
    1. 空字符 ,表示只复制表结构
    2. insert,直接插入
    3. upsert,更新插入

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×