CentOS下部署Dubbo记录
推荐JDK1.8, 不推荐Java 9
安装 zookeeper
集群设置注意data路径和myid文件
zoo.cfg1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16# 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=/Users/John/Documents/Code/ServerSource/zkCluster/zk1/data
# the port at which the clients will connect
clientPort=2181
#集群配置
server.1=127.0.0.1:2888:3888
server.2=127.0.0.1:2889:3889
server.3=127.0.0.1:2890:3890
编译安装dubbo-monitor
下载dubbo-ops源码
跳转至根目录, 执行mvn install -Dmaven.test.skip=true
可能会出现以下两个编译失败
1-找不到相关jar包,找不到FilterXXX的类,解决办法,工程依赖项添加tomcat/lib,需要将该目录下的jsp-api.jar、servlet-api.jar拷贝到target/dubbo-monitor-simple-2.0.0-assembly.tar.gz解压后的目录lib
2-如果是java 9, 可能会遇到无法识别某些将被放弃的api和参数,所以把jdk改为1.8可解决,执行start.sh可能会出现内存不足1
2
3JAVA_MEM_OPTS=" -server -Xmx2g -Xms2g -Xmn256m -XX:PermSize=128m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 "
else
JAVA_MEM_OPTS=" -server -Xms1g -Xmx1g -XX:PermSize=128m -XX:SurvivorRatio=2 -XX:+UseParallelGC "
其中-server -Xmx2g -Xms2g -Xmn256m
2g改为512m即可
安装dubbo-admin
同monitor一个工程
部署时候遇到端口被占用,这个好解决,还遇到某些api和参数执行错误,导致tomcat无法开启,所以要tomcat使用的jdk为1.8版本,之前用9,所以一直失败,其他版本没去试过
搭建dubbo工程
至此可以开始搭建业务框架,基于雏形框架,逐步完善优化,dubbo比想象中的强大,还有好多特性需要去挖掘