折磨两周看很多文档,但是文档都是以前版本的dubbo-admin 现在新版本的dubbo-admin已经修改了方式,使用了前后端分离的方式。接口风格使用的RESTful规范。
之前下班回来搞点别的都很晚了,没有静下心来搞这个,今天算是沉下心来把这个dubbo-admin服务控制台给启动成功了。记录一下防止以后忘记。也算是一个小示范把,争取写的很详细。
项目配置好后 在整个项目根文件夹下 整个打包 最后执行server里面的jar包 直接访问localhost:port 这个port是server里面设置的启动port就可以启动这个控制台了 不用分步再去启动ui 但是一定是要整个打包才行单个打包还是需要单个启动的
https://github.com/apache/incubator-dubbo-admin 控制台的地址
https://github.com/apache/incubator-dubbo-admin/blob/develop/README_ZH.md 控制台的中文文档可以看一下有简单的功能介绍
首先将这个项目下载下来 然后修改一下配置如果是远程的zookeeper就要修改dubbo-admin-server中的application.properties的地址了默认是127.0.0.1就是本地的地址 还有端口要设置成自己安装的zookeeper的端口 该项目默认启动的端口号是8080 所以如果有冲突的话需要修改一下默认的端口号然后启动就可以了 可以在ide中启动如果不觉得麻烦的话,觉得麻烦的话可以直接打包然后进入目录中 java -jar ***.jar 启动该项目,如果修改了server的启动端口那么要相应修改ui模块里面的连接server的端口设置修改要让他们统一
然后就是dubbo-admin-ui这个前端的模块了,由于需要先nvm install构建node.js所需要的mode_modules模块依赖,所以首先需要先下载一个nvm的node管理工具。
windows的话直接上https://github.com/coreybutler/nvm-windows/releases这里去下载
nvm-setup.zip安装版就可以了。我用的是1.1.7最新版本
如果是linux的话 可以curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
或者
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
进行nvm下载
然后执行source ~/.bashrc将其加入环境中
然后nvm list-romote查看可以用的版本 但是需要注意会刷出来很多版本所以最好可以先确定好版本直接下载
nvm install v11.14.0 我 用的是这个版本的node 安装完成后 执行nvm use v11.14.0 可以执行nvm list查看本机的node版本列表带*的是当前使用的node版本
前置准备完成之后就开始准备构建前端模块了
进入dubbo-admin-ui文件夹之后cmd 或者linux直接执行命令
nvm install 进行mode_modules依赖构建,期间会出错很多次,因为我也不知道是不是我这个个人网速原因还是源的原因,试过换源和***都会失败
如果失败或者停留在某个地方很久可以试一下换源
npm config set registry https://registry.npm.taobao.org 这个是淘宝的源
npm config set registry http://registry.cnpmjs.org/ 这个不知道是哪个源 是原来的源么
npm config set registry https://registry.npmjs.org/还有这个 这个应该是原本的源
npm cache clean --force 换完源之后执行这个命令清除一下缓存
然后再次执行nvm install 如果还是有地方停留很久就再等等 等不及就继续换源或者直接清除缓存在install一直失败就一直这样,因为最后失败是提示获取不到构建不成功,或者就是等很久那个构建命令还是停留在哪里,这个时候换源清除缓存试一下再次构建
最后构建成功之后就直接执行
npm run dev运行node就好了 启动应该是8081端口
此时访问localhost:8081就会直接进入首页了 最新版本的控制台新增很多功能 需要去探索
成功截图 只有服务端因为我的消费端启动之后没有被检测到应该是注册失败了还需要继续探索构建dubbo项目
有一点需要注意zookeeper的版本,由于可能是服务端和程序的依赖zookeeper版本不一致的缘故,在打包的过程中一直报错无法打包成功,但是换回127.0.0.1就可以打包成功了,虽然也报错。直接拿到远程服务器上java -jar 启动开用了也没有再管这个问题 因为我查了一天都没有这个问题的解决方案(很大可能是版本不一致的缘故,还有就是防火墙)。 下面贴出来
org.apache.curator.ConnectionState : Connection timed out for connection string (47.100.58.201:2182) and timeout (15000) / elapsed (31041)
org.apache.curator.CuratorConnectionLossException: KeeperErrorCode = ConnectionLoss
at org.apache.curator.ConnectionState.checkTimeouts(ConnectionState.java:225)
at org.apache.curator.ConnectionState.getZooKeeper(ConnectionState.java:94)
at org.apache.curator.CuratorZookeeperClient.getZooKeeper(CuratorZookeeperClient.java:117)
at org.apache.curator.framework.imps.CuratorFrameworkImpl.getZooKeeper(CuratorFrameworkImpl.java:489)
at org.apache.curator.framework.imps.ExistsBuilderImpl$3.call(ExistsBuilderImpl.java:237)
at org.apache.curator.framework.imps.ExistsBuilderImpl$3.call(ExistsBuilderImpl.java:226)
at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:109)
at org.apache.curator.framework.imps.ExistsBuilderImpl.pathInForegroundStandard(ExistsBuilderImpl.java:223)
at org.apache.curator.framework.imps.ExistsBuilderImpl.pathInForeground(ExistsBuilderImpl.java:216)
at org.apache.curator.framework.imps.ExistsBuilderImpl.forPath(ExistsBuilderImpl.java:175)
at org.apache.curator.framework.imps.ExistsBuilderImpl.forPath(ExistsBuilderImpl.java:32)
at org.apache.dubbo.admin.registry.config.impl.ZookeeperConfiguration.getConfig(ZookeeperConfiguration.java:109)
at org.apache.dubbo.admin.registry.config.impl.ZookeeperConfiguration.getConfig(ZookeeperConfiguration.java:75)
at org.apache.dubbo.admin.config.ConfigCenter.getDynamicConfiguration(ConfigCenter.java:83)
at org.apache.dubbo.admin.config.ConfigCenter$$EnhancerBySpringCGLIB$$11f48580.CGLIB$getDynamicConfiguration$1(<generated>)
at org.apache.dubbo.admin.config.ConfigCenter$$EnhancerBySpringCGLIB$$11f48580$$FastClassBySpringCGLIB$$fb7c83e.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:361)
at org.apache.dubbo.admin.config.ConfigCenter$$EnhancerBySpringCGLIB$$11f48580.getDynamicConfiguration(<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)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:579)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1254)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1103)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:541)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:304)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1065)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:584)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:373)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1348)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:578)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1065)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:815)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:721)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:192)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1274)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1131)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:541)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:139)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117)
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108)
at org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener.postProcessFields(MockitoTestExecutionListener.java:99)
at org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener.injectFields(MockitoTestExecutionListener.java:79)
at org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener.prepareTestInstance(MockitoTestExecutionListener.java:54)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:246)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:379)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:340)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:125)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:413)
还有其他的错误例如找不到节点/dubbo 找不到节点 /dubbo/config 一类的 均没有查出来结果按理说如果是这样的话github里面他们好好的不可能到我们这里没哟,应该这些会是自动创建的 不然肯定配置要有文档的.