zoukankan      html  css  js  c++  java
  • dubbo入门

      要找工作了,就得学习很多东西,还得再面试官面前装的很懂一样,所以我必须得把功课做足,自己要使用过dubbo,才能说自己熟悉dubbo,而不仅仅说自己理解其工作原理就ok了,dobbo的分布式服务中心,底层一般使用了zookeeper,作为分布式服务中心,我很早就听说了,之前学习hadoop好像要有介绍过。dubbo和springcloud都是通常意义上的rpc框架,比如有服务注册中心,只是springcloud采用http协议,dobbo基于tcp。

      首先呢,dubbo有点了类似eureka,都是为开发者提供了一个组件(jar),而不像redis或者rabbitmq是一个服务软件。dubbo怎么使用,官网这句话说得很明白了:

    Using the Spring configuration to reference a remote service。

      下面通过一个provider和一个consumer,来体会这个过程。官方推荐使用spring Configuration配置远程服务,但是dubbo有一个缺点,就是功能太多,实施起来不方便。

      报错:

      java.lang.IllegalStateException: Failed to check the status of the service com.example.demo.service.GreetingService. No provider available for the service com.example.demo.service.GreetingService from the url zookeeper://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=annotation-consumer&default.timeout=3000&dubbo=2.6.2&interface=com.example.demo.service.GreetingService&methods=sayHello&pid=1175&register.ip=172.20.10.3&side=consumer&timestamp=1592128316906 to the consumer 172.20.10.3 use dubbo version 2.6.2

      看以看到,provider是临时节点,会写入Zookeeper中。按照官网配置,就可以跑起来了。然后我们看下dubbo的注册原理,主要的逻辑就在

    com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry中。这张图可以快速看到接口的注册和订阅情况。

     

       

    参考博客:

    http://dubbo.apache.org/en-us/docs/user/configuration/annotation.html

    https://www.cnblogs.com/riches/p/11195184.html

  • 相关阅读:
    srvany.exe和instsrv.exe_2
    srvany.exe和instsrv.exe
    C# “国密加密算法”SM系列的C#实现方法
    DMZ讲解
    java 判断字符串是否为json格式
    MFC DrawText如何使多行文字居中显示 Demo
    C++ 实现一个日志类
    数据库两个神器【索引和锁】
    CentOS 7.*编译安装PHP8
    Centos添加永久环境变量
  • 原文地址:https://www.cnblogs.com/Robin008/p/10806949.html
Copyright © 2011-2022 走看看