默认持久化
- H2 数据库
- config/application.yml
storage:selector: ${SW_STORAGE:h2}
MySQL持久化
修改配置
- MySQL 数据库
- config/application.yml
storage:selector: ${SW_STORAGE:h2}mysql:properties:jdbcUrl: ${SW_JDBC_URL:"jdbc:mysql://localhost:3306/swtest"}dataSource.user: ${SW_DATA_SOURCE_USER:root}dataSource.password: ${SW_DATA_SOURCE_PASSWORD:123456}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}maxSizeOfArrayColumn: ${SW_STORAGE_MAX_SIZE_OF_ARRAY_COLUMN:20}numOfSearchableValuesPerTag: ${SW_STORAGE_NUM_OF_SEARCHABLE_VALUES_PER_TAG:2}
启动服务
- 错误日志
问题原因
在lib目录下是没有mysql数据驱动包的,所以修改完配置启动是会报错,启动失败
解决办法
- 添加mysql数据驱动包到 oap-libs 目录下
- 创建数据库 swtest
- swtest 库中 生成了好多张表
测试
重启skywalking,验证跟踪数据不会丢失