Apache Ranger KMS 部署文档

创建库

create database rangerkms;
alter database rangerkms character set latin1; 
create user 'rangerkms'@'%' identified by '1q2w3eROOT!';
GRANT ALL PRIVILEGES ON rangerkms.* TO 'rangerkms'@'%' IDENTIFIED BY '1q2w3eROOT!';
flush privileges;

解压,修改配置文件

tar -vxf ranger-2.2.0-kms.tar.gz
cd ranger-2.2.0-kms
vim install.properties
SQL_CONNECTOR_JAR=/opt/ranger-admin/mysql-connector-java-5.1.45.jar

db_root_user=...
db_root_password=...
db_host=...

# DB UserId used for the Ranger KMS schema
db_name=rangerkms
db_user=rangerkms
db_password=xxxxxx

# Location of Policy Manager URL
POLICY_MGR_URL=http://$RANGER_ADMIN_HOST:6080

# This is the repository name created within policy manager
REPOSITORY_NAME=kmsdev

# Custom log directory path
RANGER_KMS_LOG_DIR=/home/admin/output/ranger/kms/logs

#PID file path
RANGER_KMS_PID_DIR_PATH=/home/admin/var/ranger/kms/run


#------------------------- Ranger KMS Kerberos Configuration ---------------------------
kms_principal=xxxx@xxxx.COM
kms_keytab=/opt/keytabs/xxxx.keytab

保存后进行安装

#安装Ranger-KMS
./setup.sh
./enable-kms-plugin.sh

#启动 ranger-kms
ranger-kms start

#检查
[root@henghe38 ranger-2.0.0-kms]# netstat -ntpl |grep 9292
tcp6       0      0 :::9292                 :::*                    LISTEN      89000/java 

设置权限

使用 keyadmin/keyadmin 登陆 webui(http://xxx:6080),添加 kms 服务,服务名为 kms-site.xml 中REPOSITORY_NAME 设置的值,此处为 kmsdev

Service Name :kmsdev
KMS URL :kms://http@xxxx:9292/kms
#高可用的时候
#KMS URL :kms://http@xxx:9292/kms
Username :keyadmin
Password :keyadmin

创建key

#创建key
[root@henghe38 ranger-2.0.0-kms]  curl -i -v -s --negotiate -u:  http://henghe38:9292/kms/v1/keys  -H "Content-Type: application/json" -X POST -d '{"length": 128,"cipher": "AES/CTR/NoPadding","name": "key1","description": "","attributes": {}}' 

#查看key
[root@henghe38 ranger-2.0.0-kms]  curl -i -v -s --negotiate -u: "http://192.168.103.138:9292/kms/v1/keys/names"

#查看key
[root@henghe39 ranger-2.0.0-kms] hadoop key list -metadata -provider "kms://http@henghe38;henghe39:9292/kms"

配置core-site.xml,和hadoop kms一样,可以通过 # hadoop key

   <property>
        <name>hadoop.security.key.provider.path</name>
        <value>kms://http@henghe38:9292/kms</value>
    </property>
[root@henghe38 logs]# hadoop key list -metadata
Listing keys for KeyProvider: org.apache.hadoop.crypto.key.kms.LoadBalancingKMSClientProvider@6c1a5b54
key1 : cipher: AES/CTR/NoPadding, length: 128, description: , created: Mon Dec 06 16:50:42 CST 2021, version: 1, attributes: [key.acl.name=key1] 

添加代理权限

vim /opt/ranger-2.0.0-kms/ews/webapp/WEB-INF/classes/conf/kms-site.xml
 <property>
        <name>hadoop.kms.proxyuser.henghe.groups</name>
        <value>*</value>
  </property>

  <property>
        <name>hadoop.kms.proxyuser.henghe.hosts</name>
        <value>*</value>
  </property>

  <property>
        <name>hadoop.kms.proxyuser.henghe.users</name>
        <value>*</value>
  </property>

拷贝配置

 scp /opt/hadoop/etc/hadoop/core-site.xml  ews/webapp/WEB-INF/classes/conf

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值