dubbo-demo的运行

   在学习dubbo时,最主要的是将dubbo运行起来。

  现在先搭建起来简单的demo。

一:安装zookeeper(在wondows下安装,且是单机模式)

1.下载zookeeper

  

 

2.下载的版本

  

 

3.解压

  

 

5.找到需要的zoo.cfg文件

  在conf文件夹下。

  复制一份zoo_sample.cfg文件,修改名称为zoo.cfg

 

6.修改zoo.cfg配置文件

  重要的是修改dataDir的目录。

  

  因此:

  这里修改的数据目录为:

  

 

 

7.启动

  使用Dos命令行,进入zookeeper的bin目录进行启动,启动命令为zkServer.cmd

  

 

  查看使用zkCli.cmd,会看到welcome to zookeeper。

  

 

 

二:Demo

1.源代码的下载

  

 

2.打开demo项目

  

 

3.先注释掉pom.xml中的一些不需要的东西:

1             <!--<plugin>-->
2                         <!--<groupId>org.apache.maven.plugins</groupId>-->
3                         <!--<artifactId>maven-surefire-plugin</artifactId>-->
4                         <!--<configuration>-->
5                             <!--<testFailureIgnore>true</testFailureIgnore>-->
6                         <!--</configuration>-->
7                     <!--</plugin>-->

 

 1     <!--<plugin>-->
 2                 <!--<groupId>org.apache.maven.plugins</groupId>-->
 3                 <!--<artifactId>maven-surefire-plugin</artifactId>-->
 4                 <!--<configuration>-->
 5                     <!--<useSystemClassLoader>true</useSystemClassLoader>-->
 6                     <!--<forkMode>once</forkMode>-->
 7                     <!--<argLine>${argline}</argLine>-->
 8                     <!--<systemProperties>-->
 9                         <!--&lt;!&ndash; common shared &ndash;&gt;-->
10                         <!--<property>-->
11                             <!--<name>transporter</name>-->
12                             <!--<value>${transporter}</value>-->
13                         <!--</property>-->
14                         <!--<property>-->
15                             <!--<name>serialization</name>-->
16                             <!--<value>${serialization}</value>-->
17                         <!--</property>-->
18                         <!--&lt;!&ndash; server side &ndash;&gt;-->
19                         <!--<property>-->
20                             <!--<name>port</name>-->
21                             <!--<value>${port}</value>-->
22                         <!--</property>-->
23                         <!--<property>-->
24                             <!--<name>threadpool</name>-->
25                             <!--<value>${threadpool}</value>-->
26                         <!--</property>-->
27                         <!--<property>-->
28                             <!--<name>threads</name>-->
29                             <!--<value>${threads}</value>-->
30                         <!--</property>-->
31                         <!--<property>-->
32                             <!--<name>iothreads</name>-->
33                             <!--<value>${iothreads}</value>-->
34                         <!--</property>-->
35                         <!--&lt;!&ndash; client side &ndash;&gt;-->
36                         <!--<property>-->
37                             <!--<name>server</name>-->
38                             <!--<value>${server}</value>-->
39                         <!--</property>-->
40                         <!--<property>-->
41                             <!--<name>timeout</name>-->
42                             <!--<value>${timeout}</value>-->
43                         <!--</property>-->
44                         <!--<property>-->
45                             <!--<name>length</name>-->
46                             <!--<value>${length}</value>-->
47                         <!--</property>-->
48                         <!--<property>-->
49                             <!--<name>connections</name>-->
50                             <!--<value>${connections}</value>-->
51                         <!--</property>-->
52                         <!--<property>-->
53                             <!--<name>base</name>-->
54                             <!--<value>${base}</value>-->
55                         <!--</property>-->
56                         <!--<property>-->
57                             <!--<name>concurrent</name>-->
58                             <!--<value>${concurrent}</value>-->
59                         <!--</property>-->
60                         <!--<property>-->
61                             <!--<name>runs</name>-->
62                             <!--<value>${runs}</value>-->
63                         <!--</property>-->
64                         <!--<property>-->
65                             <!--<name>onerror</name>-->
66                             <!--<value>${onerror}</value>-->
67                         <!--</property>-->
68                     <!--</systemProperties>-->
69                 <!--</configuration>-->
70             <!--</plugin>-->

 

 

4.编译

  在DOS命令行中进入dubbo目录。

  mvn install -Dmaven.test.skip=true

 

5.open进IDEA

 

6.修改配置

  dubbo-demo-provider.xml中有 

  <dubbo:registry address="multicast://224.5.6.7:1234"/>

  将修改为:

  <dubbo:registry address="zookeeper://127.0.0.1:2181"/>

   dubbo-demo-covsumer.xml同理

 

7.先启动provided

  

 

8.再启动comsumer

  

 

9.结果

  

 

三:安装控制台

1.找到adminwar包

  

 

2.将war包放进tomcat下

  

 

3.启动tomcat

  

 

4.去浏览器上看服务

  http://localhost:8080/dubbo-admin-2.5.6/

  

  观察服务:

  

 

 

 

 

 

  

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值