为kafka开启kerberos-创新互联
主节点安装
专注于为中小企业提供网站设计制作、成都做网站服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业沈河免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了1000+企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。yum -y install krb5-server krb5-libs krb5-auth-dialog krb5-workstation
cat /etc/krb5.conf
Configuration snippets may be placed in this directory as well
includedir /etc/krb5.conf.d/
[logging]
default = FILE:/var/log/krb5libs.log
kdc = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmind.log
[libdefaults]
default_realm = HADOOP.COM
dns_lookup_realm = false
dns_lookup_kdc = false
ticket_lifetime = 24h
renew_lifetime = 7d
forwardable = true
rdns = false
# default_realm = EXAMPLE.COM
# default_ccache_name = KEYRING:persistent:%{uid}
[realms]
HADOOP.COM = {
kdc = bigdata-cdh01.kfk.com
admin_server = bigdata-cdh01.kfk.com
}
[domain_realm]
.bigdata-cdh01.kfk.com = HADOOP.COM
bigdata-cdh01.kfk.com = HADOOP.COM
cat /var/kerberos/krb5kdc/kadm5.acl
*/admin@HADOOP.COM *
cat /var/kerberos/krb5kdc/kdc.conf
[kdcdefaults]
kdc_ports = 88
kdc_tcp_ports = 88
[realms]
HADOOP.COM = {
#master_key_type = aes256-cts
max_renewable_life= 7d 0h 0m 0s
acl_file = /var/kerberos/krb5kdc/kadm5.acl
dict_file = /usr/share/dict/words
admin_keytab = /var/kerberos/krb5kdc/kadm5.keytab
supported_enctypes = aes256-cts:normal aes128-cts:normal des3-hmac-sha1:normal arcfour-hmac:normal camellia256-cts:normal camellia128-cts:normal des-hmac-sha1:normal des-cbc-md5:normal des-cbc-crc:normal
}
创建kerberos数据库
kdb5_util create -r HADOOP.COM -s
创建kerberos管理账号
将kerberos服务添加为开机启动
systemctl enable krb5kdc
systemctl enable kadmin
systemctl start krb5kdc
systemctl start kadmin
测试管理员账号
为节点安装客户端
yum -y install krb5-libs krb5-auth-dialog krb5-workstation
在主节点上安装额外的包
yum -y install openldap-clients
将krb5.conf文件拷贝到所有kerberos客户端(批量拷贝)
#!/bin/bash
for i in `cat node.list`
do
scp -r $2 $i:$3
done
sh scp.sh node.list /etc/krb5.conf /etc/
启动kerberos
为kafka开启kerberos
krb5的一些命令
列出账号 kadmin.local -q "listprincs"
删除账号 kadmin.local -q 'delete_principal hdfs/bigdata-cdh01.kfk.com@HADOOP.COM'
创建账号指定密码 kadmin.local -q "addprinc hdfs/bigdata-cdh01.kfk.com@bd00@HADOOP.COM"
随机生成密码 kadmin.local -q "addprinc -randkey hdfs/bigdata-cdh01.kfk.com@HADOOP.COM"
导出票据 kadmin.local -q "xst -k hdfs.keytab hdfs/bigdata-cdh01.kfk.com@HADOOP.COM"
登录 kinit -k -t hdfs.keytab hdfs/bigdata-cdh01.kfk.com@HADOOP.COM
查看过期时间 kadmin.local -q 'getprinc krbtgt/HADOOP.COM@HADOOP.COM'
修改时间 kadmin.local -q 'modprinc -maxrenewlife "7d" krbtgt/HADOOP.COM@HADOOP.COM'
查看keytab内容 klist -e -k -t zookeeper.keytab
不修改密码导出 kadmin.local -q 'xst -k hdfs.keytab -norandkey hdfs/bigdata-cdh01.kfk.com@HADOOP.COM'
退出登录 kdestroy
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
当前文章:为kafka开启kerberos-创新互联
地址分享:http://azwzsj.com/article/dihjhe.html