pulsar-admin tenants list返回HTTP 401 Unauthorized

逄宁
2023-12-01

在pulsar后台节点使用命令查询租户列表时返回401

# bin/pulsar-admin tenants list
HTTP 401 Unauthorized

查看broker.conf发现开启了权限认证

# cat /pulsar/conf/broker.conf |grep "authenticationEnabled"       
authenticationEnabled=true

获取配置的token,在broker.conf中的brokerClientAuthenticationParameters对应的vlalue配置

# cat /pulsar/conf/broker.conf |grep "brokerClientAuthenticationParameters"
brokerClientAuthenticationParameters=token:eyJhbGciOiANVzI1NiJ9.eyJzdWIiOiCMDBAbiJ9.eNEbqeuUXxM7bsNhjkonxRkP52oPqc0nsWFRp8z7N

修改client.conf中的参数

authPlugin=org.apache.pulsar.client.impl.auth.AuthenticationToken
authParams=token:eyJhbGciOiANVzI1NiJ9.eyJzdWIiOiCMDBAbiJ9.eNEbqeuUXxM7bsNhjkonxRkP52oPqc0nsWFRp8z7N

若是在本地修改好后cp到原目录的注意修改文件的属组和权限。

修改完成后重新调用bin/pulsar-admin tenants list

# bin/pulsar-admin tenants list
"public"
"pulsar"

 类似资料: