dubbo服务配置

服务器设置

1. 安装64位JDK;

2. 设置Linux文件系统为Ext4

3.开启2181,7771,7772防火墙端口

源码编码

1. 安装Maven

2. 安装OpenSesame

下载地址:https://github.com/alibaba/opensesame.git,将opensesame-master.zip解压到本地目录,如d:pomLocalopensesame-master,如下图:

a、安装2.0版本:cd 到d:pomLocalopensesame-master,执行 mvn clean install -Dmaven.test.skip=true

b、安装1.0版本:修改d:pomLocalopensesame-masterpom.xml中的<version>2.0</version>为<version>1.0</version>cd 到d:pomLocalopensesame-master,执行 mvn clean install -Dmaven.test.skip=true

3. 下载Dubbo源码:下载地址:https://github.com/alibaba/dubbo.git/trunk,进入到源码解压目录下运行install.bat或DOS命令行切换到解压目录运行:mvn clean install -Dmaven.test.skip=true会生成管理中心和监测中心

 

dubbo.git/dubbo-admin/target/dubbo-admin-2.5.4-SNAPSHOT.war,

dubbo.git/dubbo-simple/dubbo-monitor-simple/target/dubbo-monitor-simple-2.5.4-SNAPSHOT-assembly.tar.gz;

管理中心需要通过web容器部署,dubbo-monitor不依赖web容易,通过dubbo-monitor-simple-2.5.4-SNAPSHOTinstart.sh可以直接启动监测服务。

4.Zookeeper配置(Duboo NameService)

a、下载Zookeeper:zookeeper.apache.org,删除源码信息,保留以下文件即可:

 

将zookeeper-3.3.4/conf目录下面的 zoo_sample.cfg修改为zo o.cfg,配置文件内容如下所示:

  1. #The number of milliseconds of each tick
  2. tickTime=2000
  3. # The number of ticks that the initial
  4. # synchronization phase can take
  5. initLimit=10
  6. # The number of ticks that can pass between
  7. # sending a request and getting an acknowledgement
  8. syncLimit=5
  9. # the directory where the snapshot is stored.

10. # do not use /tmp for storage, /tmp here is just

11. # example sakes

12. dataDir=/usr/framework/zookeeper/datas

13. dataLogDir=/usr/framework/zookeeper/logs

14. # the port at which the clients will connect

15. clientPort=2181

16. # the maximum number of client connections.

17. # increase this if you need to handle more clients

18. #maxClientCnxns=60

19. #

20. # Be sure to read the maintenance section of the

21. # administrator guide before turning on autopurge.

22. #

23. # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance

24. #

25. # The number of snapshots to retain in dataDir

26. autopurge.snapRetainCount=3

27. # Purge task interval in hours

28. # Set to "0" to disable auto purge feature

29. autopurge.purgeInterval=1

30. server.1=192.168.1.119:7772:7771

31. server.2=192.168.1.120:7772:7771

32. server.3=192.168.1.121:7772:7771

33. server.4=192.168.1.122:7772:7771

 

b、 在对应的/home/hadoop/storage/zookeeper,建议myid文件,内容设置参照zoo.cfg,如果当前ip为119,那么myid内容为1,ip为120,myid内容为2,以此类推

c、启动,通过jps命令可以查看ZooKeeper服务器进程,名称为QuorumPeerMain。

  1. cd zookeeper-3.3.4/  

   bin/zkServer.sh start 

在客户端连接ZooKeeper服务器,执行如下命令:

[plain] view plaincopy

  1. bin/zkCli.sh -server dynamic:2181  

    上面dynamic是我的主机名,如果在本机执行,则执行如下命令即可:

    [plain] view plaincopy

    1. bin/zkCli.sh  

    客户端连接信息如下所示:接着,可以使用help查看Zookeeper客户端可以使用的基本操作命令。

原文地址:https://www.cnblogs.com/liucs/p/7465783.html