highlight: atelier-plateau-dark
theme: github
dubbo服务使用
dubbo官方文档:https://cn.dubbo.apache.org/zh-cn/ dubbo官方配置中心文档:https://cn.dubbo.apache.org/zh-cn/overview/what/ecosystem/config-center/zookeeper/
107生产者、108消费者
apt update apt install -y openjdk-8-jdk lrzsz
107
上传包dubbo-demo-provider-2.1.5-assembly.tar.gz ``` cd /usr/local/src
解压
tar xvf dubbo-demo-provider-2.1.5-assembly.tar.gz ```
编辑配置文件 ``` cd dubbo-demo-provider-2.1.5/ vim conf/dubbo.properties
#
Copyright 1999-2011 Alibaba Group.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
#
日志配置
dubbo.container=log4j,spring
应用名
dubbo.application.name=demo-provider dubbo.application.owner=
注释下行
dubbo.registry.address=multicast://224.5.6.7:1234
修改下行
dubbo.registry.address=zookeeper://192.168.37.104:2181 | zookeeper://192.168.37.105:2181 | zookeeper://192.168.37.106:2181
dubbo.registry.address=redis://127.0.0.1:6379
dubbo.registry.address=dubbo://127.0.0.1:9090
监控协议
dubbo.monitor.protocol=registry
访问协议
dubbo.protocol.name=dubbo
端口
dubbo.protocol.port=20880
日志路径
dubbo.log4j.file=logs/dubbo-demo-provider.log
日志级别
dubbo.log4j.level=WARN ```
```
启动访问
./bin/start.sh
查看端口
ss -tnl |grep 20880 LISTEN 0 50 0.0.0.0:20880 0.0.0.0:* ``` 主机
安装:ZooInspector.zip 和 java 包(可参考实现对主机和Tomcat监控(小节2)中windows主机部分)
108
上传包dubbo-demo-consumer-2.1.5-assembly.tar.gz
``` cd /usr/local/src/
解压
tar xvf dubbo-demo-consumer-2.1.5-assembly.tar.gz 编辑配置文件
cd dubbo-demo-consumer-2.1.5/ vim conf/dubbo.properties
#
Copyright 1999-2011 Alibaba Group.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
#
dubbo.container=log4j,spring dubbo.application.name=demo-consumer dubbo.application.owner=
注释下行
dubbo.registry.address=multicast://224.5.6.7:1234
修改下行
dubbo.registry.address=zookeeper://192.168.37.104:2181 | zookeeper://192.168.37.105:2181 | zookeeper://192.168.37.106:2181
dubbo.registry.address=redis://127.0.0.1:6379
dubbo.registry.address=dubbo://127.0.0.1:9090
dubbo.monitor.protocol=registry dubbo.log4j.file=logs/dubbo-demo-consumer.log dubbo.log4j.level=WARN 启动
./bin/start.sh ```
106
上传包dubboadmin.war、apache-tomcat-8.5.42.tar.gz ``` mkdir /apps cd apps tar xvf apache-tomcat-8.5.42.tar.gz
cd apache-tomcat-8.5.42/webapps/
移动
mv /apps/dubboadmin.war .
解压到指定目录
unzip dubboadmin.war -d dubboadmin
删除或移走解压包
rm -rf dubboadmin.war ```
```
配置
cat dubboadmin/WEB-INF/dubbo.properties dubbo.registry.address=zookeeper://192.168.37.104:2181 | zookeeper://192.168.37.105:2181 | zookeeper://192.168.37.106:2181 dubbo.admin.root.password=root <--账号:root 密码:root dubbo.admin.guest.password=guest <--账号:guest 密码:guest 启动tomcat
/apps/apache-tomcat-8.5.42/bin/catalina.sh start ```