一、基础信息配置

11 虚拟机硬件配置

zookeeper3.4.5集群部署及dubbo2.5.3入门例子_第1张图片

zookeeper3.4.5集群部署及dubbo2.5.3入门例子_第2张图片

zookeeper3.4.5集群部署及dubbo2.5.3入门例子_第3张图片

zookeeper3.4.5集群部署及dubbo2.5.3入门例子_第4张图片

zookeeper3.4.5集群部署及dubbo2.5.3入门例子_第5张图片


 

12虚拟机软件配置(准备三台机器)

121 公共配置

 

[root@zk11 ~]# cat /etc/redhat-release 
CentOS release 6.7 (Final)
[root@zk11 ~]# uname -r
2.6.32-573.el6.x86_64
[root@zk11 ~]# cat /etc/sysconfig/i18n
LANG="en_US.UTF-8"


 

12 2三台机器各自配置

1221 ZK11机器

 

 

[root@zk11 ~]# hostname
zk11
[root@zk11 ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=zk11
 
#对外提供IP,这里简称外网IP
[root@zk11 ~]# ifconfig eth0|awk -F '[ :]+' 'NR==2{print $4}'
10.0.0.11
 
#对内提供IP,这里简称内网IP
[root@zk11 ~]# ifconfig eth1|awk -F '[ :]+' 'NR==2{print$4}'
172.16.1.11


 

1222 ZK12机器

 

 [root@zk12~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=zk12
[root@zk12 ~]# ifconfig eth0|awk -F '[ :]+' 'NR==2{print $4}'
10.0.0.12
[root@zk12 ~]# ifconfig eth1|awk -F '[ :]+' 'NR==2{print$4}' 
172.16.1.12


 

1223 ZK13机器

 

[root@zk13 ~]# hostname
zk13
[root@zk13 ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=zk13
[root@zk13 ~]# ifconfig eth0|awk -F '[ :]+' 'NR==2{print$4}' 
10.0.0.13
[root@zk13 ~]# ifconfig eth1|awk -F '[ :]+' 'NR==2{print$4}' 
172.16.1.13


 

123建立安装部署文件目录

 

#各个安装包上传目录
[root@zk11 ~]# mkdir -p /home/llyweb/tools/
 
#各个安装包软链接目录
[root@zk11 ~]# mkdir /application/


 

二、Zookeeper3.4.5部署

21三台机器共同配置

211上传JDK以及zookeeper

 

[root@zk11 tools]# pwd
/home/llyweb/tools
[root@zk11 tools]# ll jdk-7u79-linux-x64.tar.gzzookeeper-3.4.5.tar.gz
-rw-r--r-- 1 root root 153512879 Apr 18 15:22jdk-7u79-linux-x64.tar.gz
-rw-r--r-- 1 root root 16402010 Apr 18 15:19 zookeeper-3.4.5.tar.gz


 

212安装JDK及配置环境变量

 

参考“java的maven工程部署到linux的前半部分,

http://ylcodes01.blog.51cto.com/5607366/1774050”

 

213三台机器共同操作配置

 

[root@zk11 tools]# pwd
/home/llyweb/tools
[root@zk11 tools]# tar -zxf zookeeper-3.4.5.tar.gz
[root@zk11 tools]# ls -ld zookeeper-3.4.5
drwxr-xr-x 11 root root 4096 Apr 18 15:33 zookeeper-3.4.5
[root@zk11 tools]# ln -s/home/llyweb/tools/zookeeper-3.4.5/ /application/zookeeper
[root@zk11 zookeeper]# mkdir data
[root@zk11 zookeeper]# ls -ld/application/zookeeper/data/
drwxr-xr-x 3 root root 4096 Apr 18 17:42/application/zookeeper/data/
[root@zk11 conf]# pwd
/application/zookeeper/conf
[root@zk11 conf]# cp zoo_sample.cfg zoo.cfg
#编辑zoo.cfg文件
#修改dataDir为
dataDir=/application/zookeeper/data
#最下面加入
server.1=10.0.0.11:2888:3888
server.2=10.0.0.12:2888:3888
server.3=10.0.0.13:2888:3888


 

22 各个机器配置

221 ZK11-10.0.0.11配置

 

[root@zk11 zookeeper]# echo "1" >/application/zookeeper/data/myid

 

222 ZK12-10.0.0.12配置

 

[root@zk12 tools]# echo "2" >/application/zookeeper/data/myid

 

223 ZK13-10.0.0.13配置

 

[root@zk13 ~]# echo "3" >/application/zookeeper/data/myid

 

224注意事项

 

上述三者机器的写入/application/zookeeper/data/myid中的数字1、2、3一定要对应
“2、1、3三台机器共同操作配置”中的
server.1=10.0.0.11:2888:3888
server.2=10.0.0.12:2888:3888
server.3=10.0.0.13:2888:3888


 

23测试部署

231分别启动三台机器

 

[root@zk11 zookeeper]# /bin/sh/application/zookeeper/bin/zkServer.sh start
JMX enabled by default
Using config: /application/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
 
[root@zk12 tools]# /bin/sh /application/zookeeper/bin/zkServer.shstart
JMX enabled by default
Using config: /application/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
 
[root@zk13 ~]# /bin/sh/application/zookeeper/bin/zkServer.sh start
JMX enabled by default
Using config: /application/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED


 

 

232检查三台机器状态

 

#zookeeper推荐奇数型集群配置,下述三者机器的主节点不一定是哪台,在执行下述命令的时候可能会报错,猜测是还没检测好节点,稍等一会即可看到下述成功标识。

 

[root@zk11 zookeeper]# /bin/sh/application/zookeeper/bin/zkServer.sh status
JMX enabled by default
Using config: /application/zookeeper/bin/../conf/zoo.cfg
Mode: follower
 
[root@zk12 tools]# /bin/sh/application/zookeeper/bin/zkServer.sh status
JMX enabled by default
Using config: /application/zookeeper/bin/../conf/zoo.cfg
Mode: leader
 
[root@zk13 ~]# /bin/sh/application/zookeeper/bin/zkServer.sh status
JMX enabled by default
Using config: /application/zookeeper/bin/../conf/zoo.cfg
Mode: follower
 
[root@zk11 zookeeper]# ps -ef|grep zookeeper|grep -v grep


root      2625      1  0 19:42 pts/2    00:00:01 /application/jdk/bin/java-Dzookeeper.log.dir=. -Dzookeeper.root.logger=INFO,CONSOLE -cp/application/zookeeper/bin/../build/classes:/application/zookeeper/bin/../build/lib/*.jar:/application/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/application/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/application/zookeeper/bin/../lib/netty-3.2.2.Final.jar:/application/zookeeper/bin/../lib/log4j-1.2.15.jar:/application/zookeeper/bin/../lib/jline-0.9.94.jar:/application/zookeeper/bin/../zookeeper-3.4.5.jar:/application/zookeeper/bin/../src/java/lib/*.jar:/application/zookeeper/bin/../conf:.:/application/jdk/lib/dt.jar:/application/jdk/lib/tools.jar-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=falseorg.apache.zookeeper.server.quorum.QuorumPeerMain/application/zookeeper/bin/../conf/zoo.cfg

 

[root@zk12 tools]# ps -ef|grep zookeeper|grep -v grep

root      2317      1  0 19:42 pts/1    00:00:01 /application/jdk/bin/java-Dzookeeper.log.dir=. -Dzookeeper.root.logger=INFO,CONSOLE -cp/application/zookeeper/bin/../build/classes:/application/zookeeper/bin/../build/lib/*.jar:/application/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/application/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/application/zookeeper/bin/../lib/netty-3.2.2.Final.jar:/application/zookeeper/bin/../lib/log4j-1.2.15.jar:/application/zookeeper/bin/../lib/jline-0.9.94.jar:/application/zookeeper/bin/../zookeeper-3.4.5.jar:/application/zookeeper/bin/../src/java/lib/*.jar:/application/zookeeper/bin/../conf:.:/application/jdk/lib/dt.jar:/application/jdk/lib/tools.jar-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=falseorg.apache.zookeeper.server.quorum.QuorumPeerMain/application/zookeeper/bin/../conf/zoo.cfg

 

[root@zk13 ~]# ps -ef|grep zookeeper|grep -v grep

root      2297      1  0 19:41 pts/1    00:00:01 /application/jdk/bin/java-Dzookeeper.log.dir=. -Dzookeeper.root.logger=INFO,CONSOLE -cp/application/zookeeper/bin/../build/classes:/application/zookeeper/bin/../build/lib/*.jar:/application/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/application/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/application/zookeeper/bin/../lib/netty-3.2.2.Final.jar:/application/zookeeper/bin/../lib/log4j-1.2.15.jar:/application/zookeeper/bin/../lib/jline-0.9.94.jar:/application/zookeeper/bin/../zookeeper-3.4.5.jar:/application/zookeeper/bin/../src/java/lib/*.jar:/application/zookeeper/bin/../conf:.:/application/jdk/lib/dt.jar:/application/jdk/lib/tools.jar-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=falseorg.apache.zookeeper.server.quorum.QuorumPeerMain/application/zookeeper/bin/../conf/zoo.cfg

 

 

 

233停止三台机器(仅测试)

 

[root@zk11 zookeeper]# /bin/sh/application/zookeeper/bin/zkServer.sh stop
JMX enabled by default
Using config: /application/zookeeper/bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED
[root@zk11 zookeeper]# ps -ef|grep zookeeper|grep -v grep
[root@zk11 zookeeper]# /bin/sh/application/zookeeper/bin/zkServer.sh start
JMX enabled by default
Using config: /application/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@zk11 zookeeper]# /bin/sh/application/zookeeper/bin/zkServer.sh status
JMX enabled by default
Using config: /application/zookeeper/bin/../conf/zoo.cfg
Error contacting service. It is probably not running. #出现2、3、2提到的情况
[root@zk11 zookeeper]# /bin/sh/application/zookeeper/bin/zkServer.sh status
JMX enabled by default
Using config: /application/zookeeper/bin/../conf/zoo.cfg
Mode: follower


 

234命令测试

 

[root@zk11 zookeeper]# cd bin/
[root@zk11 bin]# /bin/sh zkCli.sh
[zk: localhost:2181(CONNECTED) 0] ls     #显示下述是表示不支持此操作
#下述是zookeeper中所有的命令
ZooKeeper -server host:port cmd args
        connecthost:port
        get path[watch]
        ls path[watch]
        set pathdata [version]
        rmr path
        delquota[-n|-b] path
        quit 
       printwatches on|off
        create [-s][-e] path data acl
        stat path[watch]
        close 
        ls2 path[watch]
        history 
        listquotapath
        setAcl pathacl
        getAcl path
        sync path
        redo cmdno
        addauthscheme auth
        delete path[version]
        setquota-n|-b val path
[zk: localhost:2181(CONNECTED) 1] ls /zookeeper
[quota]
[zk: localhost:2181(CONNECTED) 3] ls /zookeeper/quota 
[]
[zk: localhost:2181(CONNECTED) 4] create /test1 test1
Created /test1
[zk: localhost:2181(CONNECTED) 5] get /test1         
test1
cZxid = 0x600000003
ctime = Tue Apr 18 19:50:10 CST 2017
mZxid = 0x600000003
mtime = Tue Apr 18 19:50:10 CST 2017
pZxid = 0x600000003
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 5
numChildren = 0
[zk: localhost:2181(CONNECTED) 6] create /test1/test2test2
Created /test1/test2
[zk: localhost:2181(CONNECTED) 7] get /test1/test2
test2
cZxid = 0x600000004
ctime = Tue Apr 18 19:50:27 CST 2017
mZxid = 0x600000004
mtime = Tue Apr 18 19:50:27 CST 2017
pZxid = 0x600000004
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 5
numChildren = 0
[zk: localhost:2181(CONNECTED) 8] set /test1/test2 test22
cZxid = 0x600000004
ctime = Tue Apr 18 19:50:27 CST 2017
mZxid = 0x600000005
mtime = Tue Apr 18 19:50:40 CST 2017
pZxid = 0x600000004
cversion = 0
dataVersion = 1
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 6
numChildren = 0
[zk: localhost:2181(CONNECTED) 9] get /test1/test2
test22
cZxid = 0x600000004
ctime = Tue Apr 18 19:50:27 CST 2017
mZxid = 0x600000005
mtime = Tue Apr 18 19:50:40 CST 2017
pZxid = 0x600000004
cversion = 0
dataVersion = 1
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 6
numChildren = 0
[zk: localhost:2181(CONNECTED) 10] create/test1/test2/test3 test3
Created /test1/test2/test3
[zk: localhost:2181(CONNECTED) 11] delete /test1
Node not empty: /test1
[zk: localhost:2181(CONNECTED) 12] delete/test1/test2/test3      
[zk: localhost:2181(CONNECTED) 13] ls /test1/test2
[]
[zk: localhost:2181(CONNECTED) 14] ls /test1      
[test2]
 
#zk12机器操作
[zk: localhost:2181(CONNECTED) 0] get /test1
test1
cZxid = 0x600000003
ctime = Tue Apr 18 19:50:10 CST 2017
mZxid = 0x600000003
mtime = Tue Apr 18 19:50:10 CST 2017
pZxid = 0x600000004
cversion = 1
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 5
numChildren = 1
 
#zk13机器操作
[zk: localhost:2181(CONNECTED) 0] get /test1/test2
test22
cZxid = 0x600000004
ctime = Tue Apr 18 19:50:27 CST 2017
mZxid = 0x600000005
mtime = Tue Apr 18 19:50:40 CST 2017
pZxid = 0x600000008
cversion = 2
dataVersion = 1
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 6
numChildren = 0
 
#zk11机器操作
[zk: localhost:2181(CONNECTED) 15] rmr /test1
[zk: localhost:2181(CONNECTED) 16] get /test1
Node does not exist: /test1


 

 

 

三、DUBBO2.5.3部署

 

31上传Tomcatdubbo-admin.war

32安装部署dubbo

321部署Tomcat

参考“java的maven工程部署到linux的前半部分,

http://ylcodes01.blog.51cto.com/5607366/1774050”

 

312只在ZK11机器部署dubbo

3、1、2、1dubbo-admin.war说明

 

dubbo-admin.war可在下载dubbo源码后,通过maven编译生成对应版本的dubbo-admin.war,也可搜索出已打包好的dubbo-admin.war。

 

3122部署dubbo-admin.war

 

[root@zk11 tools]# rm -rf/application/tomcat/webapps/ROOT/*
[root@zk11 tools]# unzip dubbo-admin.war -d/application/tomcat/webapps/ROOT/
[root@zk11 WEB-INF]# pwd
/application/tomcat/webapps/ROOT/WEB-INF
[root@zk11 WEB-INF]# cp dubbo.propertiesdubbo.properties.ori
[root@zk11 WEB-INF]# cat dubbo.properties
dubbo.registry.address=zookeeper://10.0.0.11:2181?backup=10.0.0.12:2181,10.0.0.13:2181
dubbo.admin.root.password=root
dubbo.admin.guest.password=guest


 

3123启动Tomcat并访问dubbo

 

#在启动此Tomcat之前记得在/etc/hosts的最后加入127.0.0.1 zk11
[root@zk11 application]# /bin/sh/application/tomcat/bin/startup.sh >/dev/null 2>&1
[root@zk11 application]# ps -ef|grep java|grep -v grep


root      2708      1  0 19:47 pts/2    00:00:04 /application/jdk/bin/java-Dzookeeper.log.dir=. -Dzookeeper.root.logger=INFO,CONSOLE -cp/application/zookeeper/bin/../build/classes:/application/zookeeper/bin/../build/lib/*.jar:/application/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/application/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/application/zookeeper/bin/../lib/netty-3.2.2.Final.jar:/application/zookeeper/bin/../lib/log4j-1.2.15.jar:/application/zookeeper/bin/../lib/jline-0.9.94.jar:/application/zookeeper/bin/../zookeeper-3.4.5.jar:/application/zookeeper/bin/../src/java/lib/*.jar:/application/zookeeper/bin/../conf:.:/application/jdk/lib/dt.jar:/application/jdk/lib/tools.jar-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=falseorg.apache.zookeeper.server.quorum.QuorumPeerMain/application/zookeeper/bin/../conf/zoo.cfg

root      2934      1 58 20:07 pts/0    00:00:49 /application/jdk/bin/java-Djava.util.logging.config.file=/application/tomcat/conf/logging.properties-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager-Djdk.tls.ephemeralDHKeySize=2048 -Djava.endorsed.dirs=/application/tomcat/endorsed-classpath/application/tomcat/bin/bootstrap.jar:/application/tomcat/bin/tomcat-juli.jar-Dcatalina.base=/application/tomcat -Dcatalina.home=/application/tomcat-Djava.io.tmpdir=/application/tomcat/temp org.apache.catalina.startup.Bootstrapstart

 

 

zookeeper3.4.5集群部署及dubbo2.5.3入门例子_第6张图片



 

四、Java整合DUBBO

41服务端test1和客户端test2目录结构

 zookeeper3.4.5集群部署及dubbo2.5.3入门例子_第7张图片


 

42服务端test1代码配置

421Java代码部分

 

package com.unj.dubbotest.provider;  
  
import java.util.List; 
  
public interface DemoService {  
  
    StringsayHello(String name);  
  
    public ListgetUsers();  
  
}


 

 

 
package com.unj.dubbotest.provider;  
  
import java.util.ArrayList;  
import java.util.LinkedList;  
import java.util.List; 
  
  
public class DemoServiceImpl implements DemoService{  
      
     public StringsayHello(String name) {  
            return"Hello " + name;  
     }  
     publicList getUsers() {  
        List list = new ArrayList();  
         User u1 =new User();  
        u1.setName("jack");  
        u1.setAge(20);  
        u1.setSex("男");  
           
         User u2 =new User();  
        u2.setName("tom");  
        u2.setAge(21);  
        u2.setSex("女");  
           
         User u3 =new User();  
        u3.setName("rose");  
        u3.setAge(19);  
        u3.setSex("女");  
           
        list.add(u1);  
        list.add(u2);  
        list.add(u3);  
         returnlist;  
     }  
}


 

 

package com.unj.dubbotest.provider;
 
import java.io.Serializable;
/**
 * 一定要实现序列化接口Serializable
 * @author pc
 *
 */
public class User implements Serializable{
 
    private staticfinal long serialVersionUID = 1L;
    
    private Stringname;
    private Integerage;
    private Stringsex;
    public StringgetName() {
        return name;
    }
    public voidsetName(String name) {
        this.name =name;
    }
    public StringgetSex() {
        return sex;
    }
    public voidsetSex(String sex) {
        this.sex =sex;
    }
    public IntegergetAge() {
        return age;
    }
    public voidsetAge(Integer age) {
        this.age =age;
    }
    
    
}

 

 

package com.unj.dubbotest.provider;
 
importorg.springframework.context.support.ClassPathXmlApplicationContext;  
 
public class Provider { 
   
    public staticvoid main(String[] args) throws Exception { 
       ClassPathXmlApplicationContext context = newClassPathXmlApplicationContext(new String[]{"applicationContext.xml"});  
       context.start();  
   
       System.in.read(); // 为保证服务一直开着,利用输入流的阻塞来模拟  
    }  
   
}


 

 

422XML代码部分

 

applicationContext.xml

 

 

  
  
   
      
      
      
      
     
   
      
    
      
      
    
      
     
   
      
     
      


 

 

pom.xml

 


 4.0.0
 
 test1
 test1
 0.0.1-SNAPSHOT
 jar
 
 test1
 http://maven.apache.org
 
 
   UTF-8
  
 
   
     
     junit 
     junit  
     3.8.1 
     test  
     
  
       
         commons-logging  
         commons-logging  
         1.1.1 
       
       
         com.alibaba  
         dubbo  
          2.5.3  
       
       
         org.javassist  
         javassist  
         3.18.1-GA 
       
       
          log4j  
         log4j  
         1.2.15 
           
               
                 com.sun.jdmk  
                 jmxtools  
               
               
                 com.sun.jmx  
                 jmxri  
               
               
                 jms 
                 javax.jms 
               
               
                 mail  
                 javax.mail  
               
           
       
       
         org.springframework  
         spring  
         2.5.6.SEC03  
       
       
         org.slf4j 
         slf4j-api  
         1.7.6 
       
       
         org.slf4j 
         slf4j-log4j12  
         1.6.1 
       
       
         org.apache.zookeeper  
         zookeeper  
         3.4.5 
         pom  
        
       
         com.101tec  
         zkclient  
         0.4 
       
  
 


 

 

43客户端test2代码部分

 

431Java代码部分

 

package com.unj.dubbotest.provider;  
  
import java.util.List; 
  
public interface DemoService {  
  
    StringsayHello(String name);  
  
    public ListgetUsers();  
  
}

 

 

 

package com.unj.dubbotest.provider;
 
import java.util.List; 
 
importorg.springframework.context.support.ClassPathXmlApplicationContext;  
  
 
import com.unj.dubbotest.provider.DemoService;  
  
public class Consumer { 
  
    public staticvoid main(String[] args) throws Exception { 
       ClassPathXmlApplicationContext context = newClassPathXmlApplicationContext(  
                newString[] {"applicationContext.xml"}); 
       context.start();  
  
        DemoServicedemoService = (DemoService) context.getBean("demoService"); //  
        Stringhello = demoService.sayHello("tom"); //   
       System.out.println(hello); //   
  
        //   
       List list = demoService.getUsers();  
        if (list !=null && list.size() > 0) {  
            for(int i = 0; i < list.size(); i++) {  
                System.out.println(list.get(i));  
            }  
        }
        //System.out.println(demoService.hehe());  
       System.in.read();  
    }  
  
}


 

432XML代码部分

 

applicationContext.xml

 

 

  
  
  
      
      
  
      
      
     
  
      
     
  


 

 

pom.xml

 


 4.0.0
 
 test2
 test2
 0.0.1-SNAPSHOT
 jar
 
 test2
 http://maven.apache.org
 
   
       UTF-8  
     
  
     
         
           junit 
           junit  
           3.8.1 
           test  
         
         
           commons-logging  
           commons-logging  
           1.1.1 
         
         
           com.alibaba  
           dubbo  
           2.5.3 
         
         
           org.javassist  
           javassist  
           3.18.1-GA 
         
         
           log4j 
            log4j  
           1.2.15 
             
                 
                   com.sun.jdmk  
                   jmxtools  
                  
                 
                   com.sun.jmx  
                   jmxri  
                 
                 
                   jms 
                   javax.jms 
                 
                 
                   mail  
                   javax.mail  
                 
             
         
         
           org.springframework  
           spring  
           2.5.6.SEC03  
         
          
           org.slf4j 
           slf4j-api  
           1.7.6 
         
         
           org.slf4j 
           slf4j-log4j12  
           1.6.1 
         
         
           com.github.adyliu  
           zkclient  
           2.0 
         
         
           org.apache.zookeeper  
           zookeeper  
           3.4.5 
           pom  
         
          
           test1 
           test1  
           0.0.1-SNAPSHOT  
         
   


 

 

44运行服务

 

#记得一定先要clean install服务端Test1,再clean install客户端Test1

#先运行Test1服务端Provider,再运行Test2客户端Consumer

#结果为

Hello tom

com.unj.dubbotest.provider.User@4b93e13a

com.unj.dubbotest.provider.User@59a7cd99

com.unj.dubbotest.provider.User@17ab25cb