千家信息网

Ambari 开启kerberos报错add_principal:分析主体时主体的格式不正确怎么解决

发表于:2024-10-19 作者:千家信息网编辑
千家信息网最后更新 2024年10月19日,Ambari 开启kerberos报错add_principal:分析主体时主体的格式不正确怎么解决,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来
千家信息网最后更新 2024年10月19日Ambari 开启kerberos报错add_principal:分析主体时主体的格式不正确怎么解决

Ambari 开启kerberos报错add_principal:分析主体时主体的格式不正确怎么解决,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。

问题描述

ambari开启kerberos时,stop services后create principals报错如下:

通过命令验证该错误是mycluster-112020@admin/admin@OCDP.COM这个principal语法不合法

kadmin.local:  addprinc mycluster-112020@admin/admin@OCDP.COMadd_principal: Malformed representation of principal while parsing principalusage: add_principal [options] principal        options are:                [-randkey|-nokey] [-x db_princ_args]* [-expire expdate] [-pwexpire pwexpdate] [-maxlife maxtixlife]                [-kvno kvno] [-policy policy] [-clearpolicy]                [-pw password] [-maxrenewlife maxrenewlife]                [-e keysaltlist]                [{+|-}attribute]        attributes are:                allow_postdated allow_forwardable allow_tgs_req allow_renewable                allow_proxiable allow_dup_skey allow_tix requires_preauth                requires_hwauth needchange allow_svr password_changing_service                ok_as_delegate ok_to_auth_as_delegate no_auth_data_required                lockdown_keyswhere,        [-x db_princ_args]* - any number of database specific arguments.                        Look at each database documentation for supported arguments

那么为啥ambari会给我们生成一个这样的Principal名称呢,有点奇怪

ambari数据库里有四张关于kerberos的表如下图:

在以下三张表中找到报错记录:

解决办法

ambari会去数据库里拿principal名称,现在这个不正常的名称导致报错,所以要把数据库中相关记录删除

这几张表有外键检查,所以删除前先把外键检查关掉,删除完了再恢复即可

--关掉外键检查show global variables like "%foreign_key_checks%";set global foreign_key_checks=0;show global variables like "%foreign_key_checks%";--删除kerberos三个表中报错principldelete  from kerberos_keytab where keytab_path="/etc/security/keytabs/kerberos.service_check.112020.keytab";delete from kerberos_principal where principal_name="mycluster-112020@admin/admin@OCDP.COM";delete from kerberos_keytab_principal where keytab_path="/etc/security/keytabs/kerberos.service_check.112020.keytab";--恢复外键检查set global foreign_key_checks=1;show global variables like "%foreign_key_checks%";

再去重试kerberos打开正常

看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注行业资讯频道,感谢您对的支持。

0