zipkin 禁止_MySQL数据库之zipkin使用mysql保存数据
本文主要向大家介绍了MySQL数据库之zipkin使用mysql保存数据 ,通过具体的内容向大家展现,希望对大家学习MySQL数据库有所帮助。
zipkin和mysql结合保存zipkin在项目监控中得到的所有数据。
io.zipkin.java
zipkin-server
io.zipkin.java
zipkin-storage-mysql
1.19.0
org.springframework.boot
spring-boot-starter-jdbc
mysql
mysql-connector-java
bootstrap.yml 省略部分配置,放到配置中心也行,
schema: classpath:/mysql.sql配置在数据库创建完以后,可以删除,不然每次都会寻找这个sql,耗费时间。
spring:
rabbitmq:
host: ${RABBIT_HOST:localhost}
datasource:
schema: classpath:/mysql.sql
url: jdbc:mysql://${MYSQL_HOST:localhost}/test
username: root
password: root
# Switch this on to create the schema on startup:
initialize: true
continueOnError: true
sleuth:
enabled: false
zipkin:
storage:
type: mysql
zipkin启动类
import javax.sql.DataSource;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
import zipkin.server.EnableZipkinServer;
import zipkin.storage.mysql.MySQLStorage;
@EnableDiscoveryClient
@EnableZipkinServer
@SpringBootApplication
public class ZipkinService {
public static void main(String[] args) {
SpringApplication.run(ZipkinService.class, args);
}
@Bean
public MySQLStorage mySQLStorage(DataSource datasource) {
return MySQLStorage.builder().datasource(datasource).executor(Runnable::run).build();
}
}
mysql.sql
CREATE TABLE IF NOT EXISTS zipkin_spans (
`trace_id_high` BIGINT NOT NULL DEFAULT 0 COMMENT ‘If non zero, this means the trace uses 128 bit traceIds instead of 64 bit‘,
`trace_id` BIGINT NOT NULL,
`id` BIGINT NOT NULL,
`name` VARCHAR(255) NOT NULL,
`parent_id` BIGINT,
`debug` BIT(1),
`start_ts` BIGINT COMMENT ‘Span.timestamp(): epoch micros used for endTs query and to implement TTL‘,
`duration` BIGINT COMMENT ‘Span.duration(): micros used for minDuration and maxDuration query‘
) ENGINE=InnoDB ROW_FORMAT=COMPRESSED CHARACTER SET=utf8 COLLATE utf8_general_ci;
ALTER TABLE zipkin_spans ADD UNIQUE KEY(`trace_id_high`, `trace_id`, `id`) COMMENT ‘ignore insert on duplicate‘;
ALTER TABLE zipkin_spans ADD INDEX(`trace_id_high`, `trace_id`, `id`) COMMENT ‘for joining with zipkin_annotations‘;
ALTER TABLE zipkin_spans ADD INDEX(`trace_id_high`, `trace_id`) COMMENT ‘for getTracesByIds‘;
ALTER TABLE zipkin_spans ADD INDEX(`name`) COMMENT ‘for getTraces and getSpanNames‘;
ALTER TABLE zipkin_spans ADD INDEX(`start_ts`) COMMENT ‘for getTraces ordering and range‘;
CREATE TABLE IF NOT EXISTS zipkin_annotations (
`trace_id_high` BIGINT NOT NULL DEFAULT 0 COMMENT ‘If non zero, this means the trace uses 128 bit traceIds instead of 64 bit‘,
`trace_id` BIGINT NOT NULL COMMENT ‘coincides with zipkin_spans.trace_id‘,
`span_id` BIGINT NOT NULL COMMENT ‘coincides with zipkin_spans.id‘,
`a_key` VARCHAR(255) NOT NULL COMMENT ‘BinaryAnnotation.key or Annotation.value if type == -1‘,
`a_value` BLOB COMMENT ‘BinaryAnnotation.value(), which must be smaller than 64KB‘,
`a_type` INT NOT NULL COMMENT ‘BinaryAnnotation.type() or -1 if Annotation‘,
`a_timestamp` BIGINT COMMENT ‘Used to implement TTL; Annotation.timestamp or zipkin_spans.timestamp‘,
`endpoint_ipv4` INT COMMENT ‘Null when Binary/Annotation.endpoint is null‘,
`endpoint_ipv6` BINARY(16) COMMENT ‘Null when Binary/Annotation.endpoint is null, or no IPv6 address‘,
`endpoint_port` SMALLINT COMMENT ‘Null when Binary/Annotation.endpoint is null‘,
`endpoint_service_name` VARCHAR(255) COMMENT ‘Null when Binary/Annotation.endpoint is null‘
) ENGINE=InnoDB ROW_FORMAT=COMPRESSED CHARACTER SET=utf8 COLLATE utf8_general_ci;
ALTER TABLE zipkin_annotations ADD UNIQUE KEY(`trace_id_high`, `trace_id`, `span_id`, `a_key`, `a_timestamp`) COMMENT ‘Ignore insert on duplicate‘;
ALTER TABLE zipkin_annotations ADD INDEX(`trace_id_high`, `trace_id`, `span_id`) COMMENT ‘for joining with zipkin_spans‘;
ALTER TABLE zipkin_annotations ADD INDEX(`trace_id_high`, `trace_id`) COMMENT ‘for getTraces/ByIds‘;
ALTER TABLE zipkin_annotations ADD INDEX(`endpoint_service_name`) COMMENT ‘for getTraces and getServiceNames‘;
ALTER TABLE zipkin_annotations ADD INDEX(`a_type`) COMMENT ‘for getTraces‘;
ALTER TABLE zipkin_annotations ADD INDEX(`a_key`) COMMENT ‘for getTraces‘;
CREATE TABLE IF NOT EXISTS zipkin_dependencies (
`day` DATE NOT NULL,
`parent` VARCHAR(255) NOT NULL,
`child` VARCHAR(255) NOT NULL,
`call_count` BIGINT
) ENGINE=InnoDB ROW_FORMAT=COMPRESSED CHARACTER SET=utf8 COLLATE utf8_general_ci;
ALTER TABLE zipkin_dependencies ADD UNIQUE KEY(`day`, `parent`, `child`);
本文由职坐标整理并发布,希望对同学们学习MySQL有所帮助,更多内容请关注职坐标数据库MySQL数据库频道!
zipkin 禁止_MySQL数据库之zipkin使用mysql保存数据相关推荐
- Docker最全教程——数据库容器化之持久保存数据(十一)
Docker最全教程--数据库容器化之持久保存数据(十一) 原文:Docker最全教程--数据库容器化之持久保存数据(十一) 上一节我们讲述了SQL Server容器化实践(注意,SQL Server ...
- mysql配置读写分离无效_MySQL数据库的同步配置+MySql 读写分离
MySQL数据库的同步. MySQL是开源的关系型数据库系统.主从同步复制(Replication)是从一台MySQL数据库服务器(主服务器master)复制数据到另一个服务器(从服务器slave)的 ...
- win上mysql忘记root密码_MySQL数据库之windows下mysql忘记root密码的解决方法
本文主要向大家介绍了MySQL数据库之windows下mysql忘记root密码的解决方法 ,通过具体的内容向大家展现,希望对大家学习MySQL数据库有所帮助. 方法一: 1.在DOS窗口下输入net ...
- jmeter连接MySQL出错_MySQL数据库之jmeter连接mysql数据库报错Cannot create PoolableConnectionFactory...
本文主要向大家介绍了MySQL数据库之jmeter连接mysql数据库报错Cannot create PoolableConnectionFactory ,通过具体的内容向大家展现,希望对大家学习M ...
- mysql链接出错_请配置/amysql/config.php文件_MySQL数据库之PHP连接mysql时mysql_connect()函数不可用...
本文主要向大家介绍了MySQL数据库之PHP连接mysql时mysql_connect()函数不可用 ,通过具体的内容向大家展现,希望对大家学习MySQL数据库有所帮助. 我在搭建环境时也没有再安装m ...
- mysql数据库快速传输方案_MySQL数据库迁移快速导出导入大量数据
数据库迁移是我们经常可遇到的问题,对于少量的数据,迁移基本上不会有什么问题.生产环境中,有以下情况需要做迁移工作: 磁盘空间不够.比如一些老项目,选用的机型并不一定适用于数据库.随着时间的推移,硬盘很 ...
- kibana数据导入导出_MySQL数据库批量导出和导入查询数据
MySQL数据库批量导出和导入查询数据的过程是使用-e参数去执行命令. 由于工作需要,我需要先在一个MySQL库中查询出结果,然后以查出结果为参数,去放入另外一个MySQL数据库中当成where的条件 ...
- Docker最全教程——数据库容器化之持久保存数据(十二)
上一节我们讲述了SQL Server容器化实践(注意,SQL Server现在也支持跨平台),本节将讲述如何持久保存数据,并且接下来将逐步讲解其他数据库(MySql.Redis.Mongodb等等)的 ...
- 解决mysql保存数据SQLException: Incorrect string value: ‘\xF0\x9F\x91\x87\xE5\x91...‘ for column ‘错误
今天在保存数据的时候mysql抛出了以下异常: 查了一下,发现是编码问题,本地数据库的默认编码是utf8,默认保存的是1到3个字节,但是现在的emoji表情采用4个字节保存,所以抛出异常. 环境: 操 ...
最新文章
- Android左右连接和USING
- 【快乐水题】412. Fizz Buzz
- C++标准库中的随机数生成
- 队列的其本应用_迷官问题
- [渝粤教育] 广东-国家-开放大学 21秋期末考试马克思主义基本原理概论(A)10882k1 (5)
- vue render函数_Vue原理解析(一):Vue到底是什么?
- 和大家探讨一下“虚拟光驱”原理
- kettle 批量多表同步_财务基础数据同步的方式
- android比较两个字符串,关于java:两个字符串的比较在android中不起作用
- 互联网十几年 我们错失了哪些创业机会
- matlab数字图像处理大作业_线上教学优秀案例(16) | 数字图像处理基于蓝墨云+企业微信的线上教学经验分享...
- easyUI s MVC h分页
- 易语言-数据类型及其长度
- matlab 汽车雷达模拟器,雷达回波模拟器在汽车雷达测试中的应用
- 计算机软件编程英语词汇集锦一
- 如何获取excel 中的 某几个列的值
- 云队友丨顶级高手,如何进行系统思考?
- File-backed Storage
- linux 打开三维stl文件,stl文件扩展名,stl文件怎么打开?
- 固态硬盘损坏数据如何挽救_大数据挽救生命
热门文章
- php json 驼峰 下划线,Go语言json编码驼峰转下划线、下划线转驼峰
- 魅蓝5s的android系统版本,系统配置对比 - 荣耀畅玩6A和魅蓝5s哪个好?从性能配置全方面区别评测解析...
- UnityShader[2] Dota2模型渲染
- 求最长公共子序列python_用Python计算最长公共子序列和最长公共子串
- codevs2189数字三角形(%100)
- java中数学函数的使用
- 计算机科学与技术情话,一个专业一句情话,你被哪个专业甜到了?
- Java神秘的抽象类,模板设计模式
- Request Id
- 又是一年的高峰跳槽季,你到底是跳还是留呢?