apache / dubbo-admin

The ops and reference implementation for Apache Dubbo
https://dubbo.apache.org
Apache License 2.0
3.98k stars 2.17k forks source link

Zookeeper ACL digest? #1228

Closed ginwAa closed 11 months ago

ginwAa commented 11 months ago

Environment

Steps to reproduce this issue

  1. 部署 dubbo admin ,调整 application.properties 配置 admin.registry.address=zookeeper://127.0.0.1:2181?username=admin&password=admin admin.config-center=zookeeper://127.0.0.1:2181?username=admin&password=admin admin.metadata-report.address=zookeeper://127.0.0.1:2181?username=admin&password=admin

Pls. provide [GitHub address] to reproduce this issue.

Expected Result

Run

Actual Result

Exception

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getServiceMapping' defined in class path resource [org/apache/dubbo/admin/config/ConfigCenter.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.dubbo.admin.registry.mapping.ServiceMapping]: Factory method 'getServiceMapping' threw exception; nested exception is java.lang.IllegalStateException: KeeperErrorCode = NoAuth for /dubbo/mapping
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:657)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:637)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1341)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1181)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:755)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:402)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:312)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1247)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1236)
    at org.apache.dubbo.admin.DubboAdminApplication.main(DubboAdminApplication.java:34)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
    at org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:593)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.dubbo.admin.registry.mapping.ServiceMapping]: Factory method 'getServiceMapping' threw exception; nested exception is java.lang.IllegalStateException: KeeperErrorCode = NoAuth for /dubbo/mapping
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:652)
    ... 28 common frames omitted
Caused by: java.lang.IllegalStateException: KeeperErrorCode = NoAuth for /dubbo/mapping
    at org.apache.dubbo.remoting.zookeeper.curator.CuratorZookeeperClient.createPersistent(CuratorZookeeperClient.java:132)
    at org.apache.dubbo.remoting.zookeeper.AbstractZookeeperClient.create(AbstractZookeeperClient.java:89)
    at org.apache.dubbo.admin.registry.mapping.impl.ZookeeperServiceMapping.listenerAll(ZookeeperServiceMapping.java:56)
    at org.apache.dubbo.admin.registry.mapping.impl.ZookeeperServiceMapping.init(ZookeeperServiceMapping.java:51)
    at org.apache.dubbo.admin.config.ConfigCenter.getServiceMapping(ConfigCenter.java:225)
    at org.apache.dubbo.admin.config.ConfigCenter$$EnhancerBySpringCGLIB$$19b5d1f1.CGLIB$getServiceMapping$4(<generated>)
    at org.apache.dubbo.admin.config.ConfigCenter$$EnhancerBySpringCGLIB$$19b5d1f1$$FastClassBySpringCGLIB$$b0384e2e.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
    at org.apache.dubbo.admin.config.ConfigCenter$$EnhancerBySpringCGLIB$$19b5d1f1.getServiceMapping(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
    ... 29 common frames omitted
Caused by: org.apache.zookeeper.KeeperException$NoAuthException: KeeperErrorCode = NoAuth for /dubbo/mapping
    at org.apache.zookeeper.KeeperException.create(KeeperException.java:116)
    at org.apache.zookeeper.KeeperException.create(KeeperException.java:54)
    at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:792)
    at org.apache.curator.framework.imps.CreateBuilderImpl$17.call(CreateBuilderImpl.java:1176)
    at org.apache.curator.framework.imps.CreateBuilderImpl$17.call(CreateBuilderImpl.java:1156)
    at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67)
    at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81)
    at org.apache.curator.framework.imps.CreateBuilderImpl.pathInForeground(CreateBuilderImpl.java:1153)
    at org.apache.curator.framework.imps.CreateBuilderImpl.protectedPathInForeground(CreateBuilderImpl.java:607)
    at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:597)
    at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:575)
    at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:51)
    at org.apache.dubbo.remoting.zookeeper.curator.CuratorZookeeperClient.createPersistent(CuratorZookeeperClient.java:125)
    ... 43 common frames omitted

Zookeeper Cli image

ginwAa commented 11 months ago

modify description

chickenlj commented 11 months ago

Please try the latest 'develop' branch and see if it can work fine.

ginwAa commented 11 months ago

Please try the latest 'develop' branch and see if it can work fine.

tried, it didn't work.

mfordjody commented 11 months ago

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getServiceMapping' defined in class path resource [org/apache/dubbo/admin/config/ConfigCenter.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.dubbo.admin.registry.mapping.ServiceMapping]: Factory method 'getServiceMapping' threw exception; nested exception is java.lang.IllegalStateException: KeeperErrorCode = NoAuth for /dubbo/mapping

Check the access control list configuration of zookeeper to ensure that the dubbo-admin has access permissions.

ginwAa commented 11 months ago

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getServiceMapping' defined in class path resource [org/apache/dubbo/admin/config/ConfigCenter.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.dubbo.admin.registry.mapping.ServiceMapping]: Factory method 'getServiceMapping' threw exception; nested exception is java.lang.IllegalStateException: KeeperErrorCode = NoAuth for /dubbo/mapping

Check the access control list configuration of zookeeper to ensure that the dubbo-admin has access permissions.

All I have done is to configure the dubbo-admin properties then run it, as a consequence an empty zookeeper without any man-made information is guaranteed. I also checked the access control list like following. Should I check the access control list or anything else in this situation? I have tired to clear the zookeeper and rerun the dubbo-admin and get NoAuth error many times.

[zk: localhost:2181(CONNECTED) 8] getAcl /dubbo/org.apache.dubbo.metadata.MetadataService
'digest,'admin:x1nq8J5GOJVPY6zgzhtTtA9izLc=
: cdrwa
[zk: localhost:2181(CONNECTED) 9] getAcl /dubbo/org.apache.dubbo.mock.api.MockService
'digest,'admin:x1nq8J5GOJVPY6zgzhtTtA9izLc=
: cdrwa
[zk: localhost:2181(CONNECTED) 10] getAcl /dubbo/mapping
'world,'anyone                     
: cdrwa                            
[zk: localhost:2181(CONNECTED) 11] getAcl /dubbo/config
'digest,'admin:x1nq8J5GOJVPY6zgzhtTtA9izLc=
: cdrwa
mfordjody commented 11 months ago

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getServiceMapping' defined in class path resource [org/apache/dubbo/admin/config/ConfigCenter.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.dubbo.admin.registry.mapping.ServiceMapping]: Factory method 'getServiceMapping' threw exception; nested exception is java.lang.IllegalStateException: KeeperErrorCode = NoAuth for /dubbo/mapping

Check the access control list configuration of zookeeper to ensure that the dubbo-admin has access permissions.

All I have done is to configure the dubbo-admin properties then run it, as a consequence an empty zookeeper without any man-made information is guaranteed. I also checked the access control list like following. Should I check the access control list or anything else in this situation? I have tired to clear the zookeeper and rerun the dubbo-admin and get NoAuth error many times.

[zk: localhost:2181(CONNECTED) 8] getAcl /dubbo/org.apache.dubbo.metadata.MetadataService
'digest,'admin:x1nq8J5GOJVPY6zgzhtTtA9izLc=
: cdrwa
[zk: localhost:2181(CONNECTED) 9] getAcl /dubbo/org.apache.dubbo.mock.api.MockService
'digest,'admin:x1nq8J5GOJVPY6zgzhtTtA9izLc=
: cdrwa
[zk: localhost:2181(CONNECTED) 10] getAcl /dubbo/mapping
'world,'anyone                     
: cdrwa                            
[zk: localhost:2181(CONNECTED) 11] getAcl /dubbo/config
'digest,'admin:x1nq8J5GOJVPY6zgzhtTtA9izLc=
: cdrwa
  1. Add auth:https://zookeeper.apache.org/doc/current/zookeeperCLI.html
  2. JDK Version Compatibility
ginwAa commented 11 months ago

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getServiceMapping' defined in class path resource [org/apache/dubbo/admin/config/ConfigCenter.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.dubbo.admin.registry.mapping.ServiceMapping]: Factory method 'getServiceMapping' threw exception; nested exception is java.lang.IllegalStateException: KeeperErrorCode = NoAuth for /dubbo/mapping

Check the access control list configuration of zookeeper to ensure that the dubbo-admin has access permissions.

All I have done is to configure the dubbo-admin properties then run it, as a consequence an empty zookeeper without any man-made information is guaranteed. I also checked the access control list like following. Should I check the access control list or anything else in this situation? I have tired to clear the zookeeper and rerun the dubbo-admin and get NoAuth error many times.

[zk: localhost:2181(CONNECTED) 8] getAcl /dubbo/org.apache.dubbo.metadata.MetadataService
'digest,'admin:x1nq8J5GOJVPY6zgzhtTtA9izLc=
: cdrwa
[zk: localhost:2181(CONNECTED) 9] getAcl /dubbo/org.apache.dubbo.mock.api.MockService
'digest,'admin:x1nq8J5GOJVPY6zgzhtTtA9izLc=
: cdrwa
[zk: localhost:2181(CONNECTED) 10] getAcl /dubbo/mapping
'world,'anyone                     
: cdrwa                            
[zk: localhost:2181(CONNECTED) 11] getAcl /dubbo/config
'digest,'admin:x1nq8J5GOJVPY6zgzhtTtA9izLc=
: cdrwa
  1. Add auth:https://zookeeper.apache.org/doc/current/zookeeperCLI.html
  2. JDK Version Compatibility

I can run the dubbo-admin well without any access control, and I can read and write any znode with zkCli after adding auth by 'addauth digest admin:admin'. I don't if you have read my issue. To be honest, your response is of no use. I even cannot find any official document about this.

mfordjody commented 11 months ago

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getServiceMapping' defined in class path resource [org/apache/dubbo/admin/config/ConfigCenter.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.dubbo.admin.registry.mapping.ServiceMapping]: Factory method 'getServiceMapping' threw exception; nested exception is java.lang.IllegalStateException: KeeperErrorCode = NoAuth for /dubbo/mapping

It might be a missing ACL configuration in the admin section of this version's code. I can assist with deployment issues, but I cannot help with the code since I'm not familiar with Java. :(

ginwAa commented 11 months ago

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getServiceMapping' defined in class path resource [org/apache/dubbo/admin/config/ConfigCenter.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.dubbo.admin.registry.mapping.ServiceMapping]: Factory method 'getServiceMapping' threw exception; nested exception is java.lang.IllegalStateException: KeeperErrorCode = NoAuth for /dubbo/mapping

It might be a missing ACL configuration in the admin section of this version's code. I can assist with deployment issues, but I cannot help with the code since I'm not familiar with Java. :(

Thanks for your reply.

ginwAa commented 11 months ago

Solved by adding following configurations in application.properties

admin.registry.address=zookeeper://127.0.0.1:2181?username=admin&password=admin
admin.config-center=zookeeper://127.0.0.1:2181?username=admin&password=admin
admin.metadata-report.address=zookeeper://127.0.0.1:2181?username=admin&password=admin
admin.config-center.username=admin
admin.config-center.password=admin

Also tried and failed by using configurations as following

admin.registry.address=zookeeper://127.0.0.1:2181
admin.config-center=zookeeper://127.0.0.1:2181
admin.metadata-report.address=zookeeper://127.0.0.1:2181
admin.config-center.username=admin
admin.config-center.password=admin

I think we should add some tips in application.properties