首页 > 编程学习 > dubbo微服务链路追踪案例-skywalking

dubbo微服务链路追踪案例-skywalking

发布时间:2022/9/1 15:07:33

zk 10.0.0.7

consumer 10.0.0.13

provider 10.0.0.17

skywalking 10.0.0.4

es 10.0.0.2

安装jdk

wget https://download.oracle.com/java/18/latest/jdk-18_linux-x64_bin.rpm
rpm -ivh jdk-18_linux-x64_bin.rpm
java -version

下载并配置zk

wget https://dlcdn.apache.org/zookeeper/zookeeper-3.6.3/apache-zookeeper-3.6.3-bin.tar.gz --no-check-certificate
tar xvf apache-zookeeper-3.6.3-bin.tar.gz
cd /apps/apache-zookeeper-3.6.3-bin/conf
cp zoo_sample.cfg zoo.cfg

 启动

[root@VM-0-3-centos bin]# cd /apps/apache-zookeeper-3.6.3-bin/bin
[root@VM-0-3-centos bin]# ./zkServer.sh start
/usr/bin/java
ZooKeeper JMX enabled by default
Using config: /apps/apache-zookeeper-3.6.3-bin/bin/../conf/zoo.cfg
Starting zookeeper ... 
STARTED
[root@VM-0-3-centos bin]# ./zkServer.sh status
/usr/bin/java
ZooKeeper JMX enabled by default
Using config: /apps/apache-zookeeper-3.6.3-bin/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost. Client SSL: false.
Mode: standalone

provider和consumer都操作

yum install java-1.8.0-openjdk -y
wget https://dlcdn.apache.org/skywalking/java-agent/8.11.0/apache-skywalking-java-agent-8.11.0.tgz --no-check-certificate
tar -xvf apache-skywalking-java-agent-8.11.0.tgz -C /apps/
vim /data/skywalking-agent/config/agent.config
  # The group name is optional only.
  agent.service_name=${SW_AGENT_NAME:dubbo}
  
  # The agent namespace
  agent.namespace=${SW_AGENT_NAMESPACE:dubbo}
  # Backend service addresses.
  collector.backend_service=${SW_AGENT_COLLECTOR_BACKEND_SERVICES:10.0.0.4:11800}

provider

上传包 链接: https://pan.baidu.com/s/1KPELMK0ktxHO3fvUN0QXYg?pwd=8n22 提取码: 8n22

修改zk地址和dubbo启动脚本

tar -xvf dubbo-demo-provider-2.1.5-assembly.tar.gz -C /apps

vim dubbo-demo-provider-2.1.5/conf/dubbo.properties
  dubbo.registry.address=zookeeper://10.0.0.7:2181

vim dubbo-demo-provider-2.1.5/bin/start.sh 
    -javaagent:/data/skywalking-agent/skywalking-agent.jar
  
./bin/start.sh

consumer

tar xvf dubbo-demo-consumer-2.1.5-assembly.tar.gz -C /apps/

vim /apps/dubbo-demo-consumer-2.1.5/conf/dubbo.properties 
 dubbo.registry.address=zookeeper://10.0.0.7:2181
 
 vim dubbo-demo-provider-2.1.5/bin/start.sh 
    -javaagent:/data/skywalking-agent/skywalking-agent.jar
 
 ./bin/start.sh

启动成功日志provider

启动成功日志 consumer

再去观察skywalking已经有数据了

Copyright © 2010-2022 mfbz.cn 版权所有 |关于我们| 联系方式|豫ICP备15888888号