dubbo服务使用(2)


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.zipjava 包(可参考实现对主机和Tomcat监控(小节2)中windows主机部分)

图片.png

图片.png

图片.png

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 ```

图片.png

106

上传包dubboadmin.warapache-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 ```

图片.png

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值