Zipkin进行数据存储的时候查询出问题

元气小坏坏 提交于 2020-02-11 14:41:13

 查询原因,由于是docker启动的,去看一下日志

[root@192 ~]# docker logs -f -t --tail 200f 2507f04de615
2020-02-11T05:07:36.413491428Z MySQL host: rm-bp1y5jh79h6b3eh9clo.mysql.rds.aliyuncs.com
2020-02-11T05:07:45.472237443Z
2020-02-11T05:07:45.472264582Z                   oo
2020-02-11T05:07:45.472268969Z                  oooo
2020-02-11T05:07:45.472272229Z                 oooooo
2020-02-11T05:07:45.472275233Z                oooooooo
2020-02-11T05:07:45.472278382Z               oooooooooo
2020-02-11T05:07:45.472281505Z              oooooooooooo
2020-02-11T05:07:45.472287296Z            ooooooo  ooooooo
2020-02-11T05:07:45.472290368Z           oooooo     ooooooo
2020-02-11T05:07:45.472293816Z          oooooo       ooooooo
2020-02-11T05:07:45.472296826Z         oooooo   o  o   oooooo
2020-02-11T05:07:45.472299989Z        oooooo   oo  oo   oooooo
2020-02-11T05:07:45.472303012Z      ooooooo  oooo  oooo  ooooooo
2020-02-11T05:07:45.472306267Z     oooooo   ooooo  ooooo  ooooooo
2020-02-11T05:07:45.472309232Z    oooooo   oooooo  oooooo  ooooooo
2020-02-11T05:07:45.472312259Z   oooooooo      oo  oo      oooooooo
2020-02-11T05:07:45.472315290Z   ooooooooooooo oo  oo ooooooooooooo
2020-02-11T05:07:45.472318808Z       oooooooooooo  oooooooooooo
2020-02-11T05:07:45.472321858Z           oooooooo  oooooooo
2020-02-11T05:07:45.472328849Z               oooo  oooo
2020-02-11T05:07:45.472331958Z
2020-02-11T05:07:45.472334855Z      ________ ____  _  _____ _   _
2020-02-11T05:07:45.472337991Z     |__  /_ _|  _ \| |/ /_ _| \ | |
2020-02-11T05:07:45.472341127Z       / / | || |_) | ' / | ||  \| |
2020-02-11T05:07:45.472344220Z      / /_ | ||  __/| . \ | || |\  |
2020-02-11T05:07:45.472347284Z     |____|___|_|   |_|\_\___|_| \_|
2020-02-11T05:07:45.472350395Z
2020-02-11T05:07:45.472353366Z :: version 2.19.2 :: commit 56d907b ::
2020-02-11T05:07:45.472356515Z
2020-02-11T05:07:47.048412888Z 2020-02-11 05:07:47.032  INFO 1 --- [           main] z.s.ZipkinServer                         : Starting ZipkinServer on 192.168.180.137 with PID 1 (/zipkin/BOOT-INF/classes started by zipkin in /zipkin)
2020-02-11T05:07:47.059257365Z 2020-02-11 05:07:47.050  INFO 1 --- [           main] z.s.ZipkinServer                         : The following profiles are active: shared
2020-02-11T05:07:49.990377915Z 2020-02-11 05:07:49.987  INFO 1 --- [           main] o.s.s.c.ThreadPoolTaskExecutor           : Initializing ExecutorService
2020-02-11T05:07:49.993147797Z 2020-02-11 05:07:49.990  INFO 1 --- [           main] o.s.s.c.ThreadPoolTaskExecutor           : Initializing ExecutorService 'mysqlExecutor'
2020-02-11T05:07:50.523374181Z 2020-02-11 05:07:50.521  INFO 1 --- [           main] c.l.a.c.Flags                            : com.linecorp.armeria.verboseExceptions: rate-limited=10 (default)
2020-02-11T05:17:20.580300904Z Caused by: java.sql.SQLException: Unknown column 'zipkin_spans.remote_service_name' in 'field list'
2020-02-11T05:17:20.580303257Z  at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.readErrorPacket(AbstractQueryProtocol.java:1599) ~[mariadb-java-client-2.5.1.jar:?]
2020-02-11T05:17:20.580305929Z  at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.readPacket(AbstractQueryProtocol.java:1461) ~[mariadb-java-client-2.5.1.jar:?]
2020-02-11T05:17:20.580310298Z  at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.getResult(AbstractQueryProtocol.java:1424) ~[mariadb-java-client-2.5.1.jar:?]
2020-02-11T05:17:20.580312896Z  at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:240) ~[mariadb-java-client-2.5.1.jar:?]
2020-02-11T05:17:20.580315359Z  at org.mariadb.jdbc.ClientSidePreparedStatement.executeInternal(ClientSidePreparedStatement.java:216) ~[mariadb-java-client-2.5.1.jar:?]
2020-02-11T05:17:20.580317733Z  at org.mariadb.jdbc.ClientSidePreparedStatement.execute(ClientSidePreparedStatement.java:145) ~[mariadb-java-client-2.5.1.jar:?]
2020-02-11T05:17:20.580320134Z  at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44) ~[HikariCP-3.4.1.jar:?]
2020-02-11T05:17:20.580322569Z  at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java) ~[HikariCP-3.4.1.jar:?]
2020-02-11T05:17:20.580325309Z  at org.jooq.tools.jdbc.DefaultPreparedStatement.execute(DefaultPreparedStatement.java:209) ~[jooq-3.12.2.jar:?]
2020-02-11T05:17:20.580327799Z  at org.jooq.impl.Tools.executeStatementAndGetFirstResultSet(Tools.java:3928) ~[jooq-3.12.2.jar:?]
2020-02-11T05:17:20.580330606Z  at org.jooq.impl.AbstractResultQuery.execute(AbstractResultQuery.java:294) ~[jooq-3.12.2.jar:?]
2020-02-11T05:17:20.580333516Z  at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:369) ~[jooq-3.12.2.jar:?]
2020-02-11T05:17:20.580335976Z  ... 27 more
2020-02-11T05:17:20.580338161Z
2020-02-11T05:17:25.691824204Z 2020-02-11 05:17:25.652  WARN 1 --- [ing-tasks-1-383] z.s.i.BodyIsExceptionMessage             : Unexpected error handling request.
2020-02-11T05:17:25.691849846Z
2020-02-11T05:17:25.691853805Z org.jooq.exception.DataAccessException: SQL [select `zipkin_spans`.`trace_id_high`, `zipkin_spans`.`trace_id`, `zipkin_spans`.`id`, `zipkin_spans`.`name`, `zipkin_spans`.`remote_service_name`, `zipkin_spans`.`parent_id`, `zipkin_spans`.`debug`, `zipkin_spans`.`start_ts`, `zipkin_spans`.`duration` from `zipkin_spans` where (`zipkin_spans`.`trace_id_high`, `zipkin_spans`.`trace_id`) in ((?, ?), (?, ?), (?, ?))]; (conn=10388) Unknown column 'zipkin_spans.remote_service_name' in 'field list'
2020-02-11T05:17:25.691857522Z  at org.jooq_3.12.2.MYSQL.debug(Unknown Source) ~[?:?]

 

看日志像是数据库少字段,应该是我的docker镜像是最新的,sql不是,去github拿最新最近即可

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,
  `remote_service_name` VARCHAR(255),
  `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',
  PRIMARY KEY (`trace_id_high`, `trace_id`, `id`)
) ENGINE=InnoDB ROW_FORMAT=COMPRESSED CHARACTER SET=utf8 COLLATE utf8_general_ci;

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(`remote_service_name`) COMMENT 'for getTraces and getRemoteServiceNames';
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 and autocomplete values';
ALTER TABLE zipkin_annotations ADD INDEX(`a_key`) COMMENT 'for getTraces and autocomplete values';
ALTER TABLE zipkin_annotations ADD INDEX(`trace_id`, `span_id`, `a_key`) COMMENT 'for dependencies job';

CREATE TABLE IF NOT EXISTS zipkin_dependencies (
  `day` DATE NOT NULL,
  `parent` VARCHAR(255) NOT NULL,
  `child` VARCHAR(255) NOT NULL,
  `call_count` BIGINT,
  `error_count` BIGINT,
  PRIMARY KEY (`day`, `parent`, `child`)
) ENGINE=InnoDB ROW_FORMAT=COMPRESSED CHARACTER SET=utf8 COLLATE utf8_general_ci;

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!