zoukankan      html  css  js  c++  java
  • Duboo入门示例(Idea开发环境)

    在学习Dubbo分布式框架时的官方入门例子,很有代表性。简单清晰。
    有关Dubbo的概念、概述和简单的配置文件,可以看官方文档的简述
    会很快对Duboo有个整体的概念。


    准备工作:

    首先完成Zookeeper的安装配置


    • 解压后,在conf目录下增加一个zoo.cfg;
    • 用记事本打开简单配置一下:
    # The number of milliseconds of each tick  
    tickTime=2000  
    # The number of ticks that the initial   
    # synchronization phase can take  
    initLimit=10  
    # The number of ticks that can pass between   
    # sending a request and getting an acknowledgement  
    syncLimit=5  
    # the directory where the snapshot is stored.  
    dataDir=D:\zookeeper-3.4.12\data  
    dataDirLog=D:\zookeeper-3.4.12\log  
    # the port at which the clients will connect  
    clientPort=2181  
    • 根据你上述配置的目录(dataDir、dataDirLog),在根目录中新建它们。
    • 点击bin目录下的zkServer.cmd启动


    项目配置运行

    • 打开项目
    • 项目是Maven管理的多模块项目,首先引入多模块。

    • 找到我们演示的Demo项目

    • 将consumer和provider模块的xml下的注册中心配置全都换成ZooKeeper

      参数用途简介
    • 先运行Provider.java,再运行Consumer.java(确保打开了Zookeeper注册中心)
    • 运行效果图

      Consumer不断调用Provider提供的实现类,所呈现出的效果。
  • 相关阅读:
    Windows下Tomcat配置虚拟路径
    Windows下Tomcat配置虚拟主机
    Windows下Tomcat的下载安装与配置
    Windows系统下Jdk的下载安装与配置
    SpringBoot项目中Swagger的配置和使用
    Windows 10通过指定端口进行远程访问的防火墙设置
    Java反射
    Java导出Pdf格式表单
    排序
    二叉查找树
  • 原文地址:https://www.cnblogs.com/jpfss/p/9269405.html
Copyright © 2011-2022 走看看