skywalking Tomcat

废话不多。

一 下载skywalking

Downloads | Apache SkyWalking

最新版APM和Agent分开了。所以我们要下载2个

APM:

 

Agent:

下载后解压,cmd运行(tar -xvzf C:\Users\DELL\Downloads\文件名)

 

二 修改skywalking配置

1 apache-skywalking-apm-bin\config

application.yml

修改数据库配置(我用的Mysql),并在Mysql中创建一个swtest数据库

apache-skywalking-apm-bin\oap-libs目录下放入mysql-connector-java-8.0.30.jar

注意修改selector 为mysql,并mysql连接修改账号密码

storage:
  selector: ${SW_STORAGE:mysql}
  mysql:
    properties:
      jdbcUrl: ${SW_JDBC_URL:"jdbc:mysql://localhost:3306/swtest?rewriteBatchedStatements=true"}
      dataSource.user: ${SW_DATA_SOURCE_USER:root}
      dataSource.password: ${SW_DATA_SOURCE_PASSWORD:root}
      dataSource.cachePrepStmts: ${SW_DATA_SOURCE_CACHE_PREP_STMTS:true}
      dataSource.prepStmtCacheSize: ${SW_DATA_SOURCE_PREP_STMT_CACHE_SQL_SIZE:250}
      dataSource.prepStmtCacheSqlLimit: ${SW_DATA_SOURCE_PREP_STMT_CACHE_SQL_LIMIT:2048}
      dataSource.useServerPrepStmts: ${SW_DATA_SOURCE_USE_SERVER_PREP_STMTS:true}
    metadataQueryMaxSize: ${SW_STORAGE_MYSQL_QUERY_MAX_SIZE:5000}
    maxSizeOfBatchSql: ${SW_STORAGE_MAX_SIZE_OF_BATCH_SQL:2000}
    asyncBatchPersistentPoolSize: ${SW_STORAGE_ASYNC_BATCH_PERSISTENT_POOL_SIZE:4}

修改webapp下的application.yml

serverPort: ${SW_SERVER_PORT:-18080}

 

2 修改Tomcat配置

Tomcat\bin

catalina.bat

首行增加:

set "CATALINA_OPTS= -javaagent:C:\Users\DELL\Downloads\skywalking-agent\skywalking-agent.jar -Dskywalking.agent.service_name=test -Dskywalking.collector.backend_service=127.0.0.1:11800"

 catalina.sh  (linux)

CATALINA_OPTS="$CATALINA_OPTS -javaagent:/root/java/skywalking/skywalking-agent/skywalking-agent.jar -Dskywalking.agent.service_name=kintech::af9005 -Dskywalking.collector.backend_service=192.168.40.130:11800";export CATALINA_OPTS

 

三 运行

1 tomcat:

启动tomcat之前,先将springmvc的war包,放到tomcat的webapp下

运行startup.bat

2 skywalking

启动apache-skywalking-apm-bin\bin\startup.bat

 

posted @ 2023-02-08 14:24  正怒月神  阅读(255)  评论(0编辑  收藏  举报