发布于2021-03-10 18:40 阅读(1565) 评论(0) 点赞(5) 收藏(4)
https://github.com/zq2599/blog_demos
内容:所有原创文章分类汇总及配套源码,涉及Java、Docker、Kubernetes、DevOPS等;
服务 | IP | 端口 | 项目名称 | 作用 |
---|---|---|---|---|
zookeeper | 192.168.50.43 | 2181 | 注册中心、配置中心 | 作用 |
springboot-zk-provider | 192.168.50.12 | 8080 | springbootzkprovider | 服务提供者 |
springboot-zk-consumer | 192.168.50.12 | 8081 | springbootzkconsumer | 服务消费者 |
dubbo.registry.address=zookeeper://127.0.0.1:2181
dubbo.metadata-report.address=zookeeper://127.0.0.1:2181
5. 基于上述分析,咱们要先在zookeeper中创建好节点/dubbo/config/dubbo/dubbo.properties,以便dubbo-admin使用,请登录zookeeper所在服务器,进入zookeeper的bin目录;
6. 由于前面的文章已经使用过zookeeper作为注册中心,因此"/dubbo/config/"目录已经存在,下面的命令会创建/dubbo/config/dubbo节点:
./zkCli.sh create /dubbo/config/dubbo ""
./zkCli.sh create /dubbo/config/dubbo/dubbo.properties "dubbo.registry.address=zookeeper://192.168.50.43:2181
dubbo.metadata-report.address=zookeeper://192.168.50.43:2181"
root@zookeeper:/opt/zookeeper-3.4.13/bin# ./zkCli.sh get /dubbo/config/dubbo/dubbo.properties
Connecting to localhost:2181
2020-10-25 03:47:50,512 [myid:] - INFO [main:Environment@100] - Client environment:zookeeper.version=3.4.13-2d71af4dbe22557fda74f9a9b4309b15a7487f03, built on 06/29/2018 04:05 GMT
environment:user.home=/root
2020-10-25 03:47:50,526 [myid:] - INFO [main:Environment@100] - Client environment:user.dir=/opt/zookeeper-3.4.13/bin
2020-10-25 03:47:50,529 [myid:] - INFO [main:ZooKeeper@442] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@674e5e21
2020-10-25 03:47:50,584 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1029] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
WATCHER::
WatchedEvent state:SyncConnected type:None path:null
dubbo.registry.address=zookeeper://192.168.50.43:2181
dubbo.metadata-report.address=zookeeper://192.168.50.43:2181
cZxid = 0x6b5
ctime = Sun Oct 25 03:47:30 UTC 2020
mZxid = 0x6b5
mtime = Sun Oct 25 03:47:30 UTC 2020
pZxid = 0x6b5
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 114
numChildren = 0
3. 下载镜像(此步骤可以不执行,我这是想看看下载镜像要多久):
docker pull apache/dubbo-admin
docker run \
-p 8083:8080 \
-e admin.config-center=zookeeper://192.168.50.43:2181 \
--rm \
apache/dubbo-admin
8. 服务详情如下图,基础信息、提供者、消费者都有,但遗憾的是元数据无法正常展示:
9. 以上就是官方提供的体验版,算是让咱们对管理控制台有了基本了解,但这仅是用于体验的镜像,实际生产环境中,首先未必会用docker,并且可能需要有对应的源码以便学习和分析问题,甚至有可能用源码做进一步定制,因此这个docker版本就不适合了,接下来一起下载dubbo-admin源码自行编译构建;
10. 在启动docker容器的控制台执行Ctrl+C,刚才创建的容器就会自动销毁;
git clone https://github.com/apache/dubbo-admin.git
server.port=8083
# centers in dubbo2.7
#admin.registry.address=zookeeper://127.0.0.1:2181
admin.config-center=zookeeper://192.168.50.43:2181
#admin.metadata-report.address=zookeeper://127.0.0.1:2181
admin.root.user.name=root
admin.root.user.password=root
#group
admin.registry.group=dubbo
admin.config-center.group=dubbo
admin.metadata-report.group=dubbo
admin.apollo.token=e16e5cd903fd0c97a116c873b448544b9d086de9
admin.apollo.appId=test
admin.apollo.env=dev
admin.apollo.cluster=default
admin.apollo.namespace=dubbo
#compress
server.compression.enabled=true
server.compression.mime-types=text/css,text/javascript,application/javascript
server.compression.min-response-size=10240
mvn clean compile -U
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ dubbo-admin-test ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 6 source files to /Users/zhaoqin/temp/202010/24/dubbo-admin/dubbo-admin-test/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for dubbo-admin 0.2.0-SNAPSHOT:
[INFO]
[INFO] dubbo-admin ........................................ SUCCESS [ 1.997 s]
[INFO] dubbo-admin-ui ..................................... SUCCESS [ 44.322 s]
[INFO] dubbo-admin-server ................................. SUCCESS [ 4.731 s]
[INFO] dubbo-admin-distribution ........................... SUCCESS [ 0.850 s]
[INFO] dubbo-admin-test ................................... SUCCESS [ 0.815 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 53.105 s
[INFO] Finished at: 2020-10-25T16:24:27+08:00
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "nexus" could not be activated because it does not exist.
mvn --projects dubbo-admin-server spring-boot:run
7. 登录后可见主页,如下图,和之前的docker体验版还是有些不同的:
8. 点击上图的测试按钮,可以在页面上测试该服务的方法:
9. 再次进入服务详情页,可见元数据也能正常显示了:
至此,管理控制台dubbo-admin的编译、部署、基本操作都实战完成了,网页上更多功能您可以自行尝试,(建议部署更多的服务和实例),回顾整个过程其实都很简单,唯一要注意的就是服务的配置那里,本地只有配置中心的地址,其他信息都放在配置中心;
微信搜索「程序员欣宸」,我是欣宸,期待与您一同畅游Java世界...
https://github.com/zq2599/blog_demos
原文链接:https://www.cnblogs.com/bolingcavalry/p/14503425.html
作者:哦哦好吧
链接:http://www.javaheidong.com/blog/article/112180/409ba2505066cd91e489/
来源:java黑洞网
任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任
昵称:
评论内容:(最多支持255个字符)
---无人问津也好,技不如人也罢,你都要试着安静下来,去做自己该做的事,而不是让内心的烦躁、焦虑,坏掉你本来就不多的热情和定力
Copyright © 2018-2021 java黑洞网 All Rights Reserved 版权所有,并保留所有权利。京ICP备18063182号-2
投诉与举报,广告合作请联系vgs_info@163.com或QQ3083709327
免责声明:网站文章均由用户上传,仅供读者学习交流使用,禁止用做商业用途。若文章涉及色情,反动,侵权等违法信息,请向我们举报,一经核实我们会立即删除!