主頁 >  其他 > 【Spring Cloud Alibaba 溫故而知新】(五)SpringCloud Sleuth + Zipkin:分布式日志追蹤

【Spring Cloud Alibaba 溫故而知新】(五)SpringCloud Sleuth + Zipkin:分布式日志追蹤

2021-11-05 07:42:18 其他

目錄

8.1.1 SpringCloud Sleuth 是什么

  • SpringCloud Sleuth 必知必會
    • SpringCloud Sleuth 實作的功能是:它會自動為當前應用構建起各通信通道的跟蹤機制
      1. 通過諸如 RabbitMQ、Kafka(或者其他任何 SpringCloud Sleuth 系結器實作的訊息中間件)傳遞的請求
      2. 通過 Zuul、Gateway 代理傳遞的請求
      3. 通過 RestTemplate 發起的請求
  • SpringCloud Sleuth 跟蹤實作原理
    • 為了實作請求跟蹤:當請求發送到分布式系統的入口端點時,只需要服務跟蹤框架為該請求創建一個唯一的跟蹤標識 Trace ID
    • 為了統計各處理單元的時間延遲,當請求到達各個服務組件時,或是處理邏輯到達某個狀態時,也通過一個唯一標識來標記它的開始、具體程序以及結束,Span ID
<style>#mermaid-svg-01gUNKYLeG2FibyJ .label{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);fill:#333;color:#333}#mermaid-svg-01gUNKYLeG2FibyJ .label text{fill:#333}#mermaid-svg-01gUNKYLeG2FibyJ .node rect,#mermaid-svg-01gUNKYLeG2FibyJ .node circle,#mermaid-svg-01gUNKYLeG2FibyJ .node ellipse,#mermaid-svg-01gUNKYLeG2FibyJ .node polygon,#mermaid-svg-01gUNKYLeG2FibyJ .node path{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-01gUNKYLeG2FibyJ .node .label{text-align:center;fill:#333}#mermaid-svg-01gUNKYLeG2FibyJ .node.clickable{cursor:pointer}#mermaid-svg-01gUNKYLeG2FibyJ .arrowheadPath{fill:#333}#mermaid-svg-01gUNKYLeG2FibyJ .edgePath .path{stroke:#333;stroke-width:1.5px}#mermaid-svg-01gUNKYLeG2FibyJ .flowchart-link{stroke:#333;fill:none}#mermaid-svg-01gUNKYLeG2FibyJ .edgeLabel{background-color:#e8e8e8;text-align:center}#mermaid-svg-01gUNKYLeG2FibyJ .edgeLabel rect{opacity:0.9}#mermaid-svg-01gUNKYLeG2FibyJ .edgeLabel span{color:#333}#mermaid-svg-01gUNKYLeG2FibyJ .cluster rect{fill:#ffffde;stroke:#aa3;stroke-width:1px}#mermaid-svg-01gUNKYLeG2FibyJ .cluster text{fill:#333}#mermaid-svg-01gUNKYLeG2FibyJ div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:12px;background:#ffffde;border:1px solid #aa3;border-radius:2px;pointer-events:none;z-index:100}#mermaid-svg-01gUNKYLeG2FibyJ .actor{stroke:#ccf;fill:#ECECFF}#mermaid-svg-01gUNKYLeG2FibyJ text.actor>tspan{fill:#000;stroke:none}#mermaid-svg-01gUNKYLeG2FibyJ .actor-line{stroke:grey}#mermaid-svg-01gUNKYLeG2FibyJ .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333}#mermaid-svg-01gUNKYLeG2FibyJ .messageLine1{stroke-width:1.5;stroke-dasharray:2, 2;stroke:#333}#mermaid-svg-01gUNKYLeG2FibyJ #arrowhead path{fill:#333;stroke:#333}#mermaid-svg-01gUNKYLeG2FibyJ .sequenceNumber{fill:#fff}#mermaid-svg-01gUNKYLeG2FibyJ #sequencenumber{fill:#333}#mermaid-svg-01gUNKYLeG2FibyJ #crosshead path{fill:#333;stroke:#333}#mermaid-svg-01gUNKYLeG2FibyJ .messageText{fill:#333;stroke:#333}#mermaid-svg-01gUNKYLeG2FibyJ .labelBox{stroke:#ccf;fill:#ECECFF}#mermaid-svg-01gUNKYLeG2FibyJ .labelText,#mermaid-svg-01gUNKYLeG2FibyJ .labelText>tspan{fill:#000;stroke:none}#mermaid-svg-01gUNKYLeG2FibyJ .loopText,#mermaid-svg-01gUNKYLeG2FibyJ .loopText>tspan{fill:#000;stroke:none}#mermaid-svg-01gUNKYLeG2FibyJ .loopLine{stroke-width:2px;stroke-dasharray:2, 2;stroke:#ccf;fill:#ccf}#mermaid-svg-01gUNKYLeG2FibyJ .note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-01gUNKYLeG2FibyJ .noteText,#mermaid-svg-01gUNKYLeG2FibyJ .noteText>tspan{fill:#000;stroke:none}#mermaid-svg-01gUNKYLeG2FibyJ .activation0{fill:#f4f4f4;stroke:#666}#mermaid-svg-01gUNKYLeG2FibyJ .activation1{fill:#f4f4f4;stroke:#666}#mermaid-svg-01gUNKYLeG2FibyJ .activation2{fill:#f4f4f4;stroke:#666}#mermaid-svg-01gUNKYLeG2FibyJ .mermaid-main-font{font-family:"trebuchet ms", verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-01gUNKYLeG2FibyJ .section{stroke:none;opacity:0.2}#mermaid-svg-01gUNKYLeG2FibyJ .section0{fill:rgba(102,102,255,0.49)}#mermaid-svg-01gUNKYLeG2FibyJ .section2{fill:#fff400}#mermaid-svg-01gUNKYLeG2FibyJ .section1,#mermaid-svg-01gUNKYLeG2FibyJ .section3{fill:#fff;opacity:0.2}#mermaid-svg-01gUNKYLeG2FibyJ .sectionTitle0{fill:#333}#mermaid-svg-01gUNKYLeG2FibyJ .sectionTitle1{fill:#333}#mermaid-svg-01gUNKYLeG2FibyJ .sectionTitle2{fill:#333}#mermaid-svg-01gUNKYLeG2FibyJ .sectionTitle3{fill:#333}#mermaid-svg-01gUNKYLeG2FibyJ .sectionTitle{text-anchor:start;font-size:11px;text-height:14px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-01gUNKYLeG2FibyJ .grid .tick{stroke:#d3d3d3;opacity:0.8;shape-rendering:crispEdges}#mermaid-svg-01gUNKYLeG2FibyJ .grid .tick text{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-01gUNKYLeG2FibyJ .grid path{stroke-width:0}#mermaid-svg-01gUNKYLeG2FibyJ .today{fill:none;stroke:red;stroke-width:2px}#mermaid-svg-01gUNKYLeG2FibyJ .task{stroke-width:2}#mermaid-svg-01gUNKYLeG2FibyJ .taskText{text-anchor:middle;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-01gUNKYLeG2FibyJ .taskText:not([font-size]){font-size:11px}#mermaid-svg-01gUNKYLeG2FibyJ .taskTextOutsideRight{fill:#000;text-anchor:start;font-size:11px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-01gUNKYLeG2FibyJ .taskTextOutsideLeft{fill:#000;text-anchor:end;font-size:11px}#mermaid-svg-01gUNKYLeG2FibyJ .task.clickable{cursor:pointer}#mermaid-svg-01gUNKYLeG2FibyJ .taskText.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-01gUNKYLeG2FibyJ .taskTextOutsideLeft.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-01gUNKYLeG2FibyJ .taskTextOutsideRight.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-01gUNKYLeG2FibyJ .taskText0,#mermaid-svg-01gUNKYLeG2FibyJ .taskText1,#mermaid-svg-01gUNKYLeG2FibyJ .taskText2,#mermaid-svg-01gUNKYLeG2FibyJ .taskText3{fill:#fff}#mermaid-svg-01gUNKYLeG2FibyJ .task0,#mermaid-svg-01gUNKYLeG2FibyJ .task1,#mermaid-svg-01gUNKYLeG2FibyJ .task2,#mermaid-svg-01gUNKYLeG2FibyJ .task3{fill:#8a90dd;stroke:#534fbc}#mermaid-svg-01gUNKYLeG2FibyJ .taskTextOutside0,#mermaid-svg-01gUNKYLeG2FibyJ .taskTextOutside2{fill:#000}#mermaid-svg-01gUNKYLeG2FibyJ .taskTextOutside1,#mermaid-svg-01gUNKYLeG2FibyJ .taskTextOutside3{fill:#000}#mermaid-svg-01gUNKYLeG2FibyJ .active0,#mermaid-svg-01gUNKYLeG2FibyJ .active1,#mermaid-svg-01gUNKYLeG2FibyJ .active2,#mermaid-svg-01gUNKYLeG2FibyJ .active3{fill:#bfc7ff;stroke:#534fbc}#mermaid-svg-01gUNKYLeG2FibyJ .activeText0,#mermaid-svg-01gUNKYLeG2FibyJ .activeText1,#mermaid-svg-01gUNKYLeG2FibyJ .activeText2,#mermaid-svg-01gUNKYLeG2FibyJ .activeText3{fill:#000 !important}#mermaid-svg-01gUNKYLeG2FibyJ .done0,#mermaid-svg-01gUNKYLeG2FibyJ .done1,#mermaid-svg-01gUNKYLeG2FibyJ .done2,#mermaid-svg-01gUNKYLeG2FibyJ .done3{stroke:grey;fill:#d3d3d3;stroke-width:2}#mermaid-svg-01gUNKYLeG2FibyJ .doneText0,#mermaid-svg-01gUNKYLeG2FibyJ .doneText1,#mermaid-svg-01gUNKYLeG2FibyJ .doneText2,#mermaid-svg-01gUNKYLeG2FibyJ .doneText3{fill:#000 !important}#mermaid-svg-01gUNKYLeG2FibyJ .crit0,#mermaid-svg-01gUNKYLeG2FibyJ .crit1,#mermaid-svg-01gUNKYLeG2FibyJ .crit2,#mermaid-svg-01gUNKYLeG2FibyJ .crit3{stroke:#f88;fill:red;stroke-width:2}#mermaid-svg-01gUNKYLeG2FibyJ .activeCrit0,#mermaid-svg-01gUNKYLeG2FibyJ .activeCrit1,#mermaid-svg-01gUNKYLeG2FibyJ .activeCrit2,#mermaid-svg-01gUNKYLeG2FibyJ .activeCrit3{stroke:#f88;fill:#bfc7ff;stroke-width:2}#mermaid-svg-01gUNKYLeG2FibyJ .doneCrit0,#mermaid-svg-01gUNKYLeG2FibyJ .doneCrit1,#mermaid-svg-01gUNKYLeG2FibyJ .doneCrit2,#mermaid-svg-01gUNKYLeG2FibyJ .doneCrit3{stroke:#f88;fill:#d3d3d3;stroke-width:2;cursor:pointer;shape-rendering:crispEdges}#mermaid-svg-01gUNKYLeG2FibyJ .milestone{transform:rotate(45deg) scale(0.8, 0.8)}#mermaid-svg-01gUNKYLeG2FibyJ .milestoneText{font-style:italic}#mermaid-svg-01gUNKYLeG2FibyJ .doneCritText0,#mermaid-svg-01gUNKYLeG2FibyJ .doneCritText1,#mermaid-svg-01gUNKYLeG2FibyJ .doneCritText2,#mermaid-svg-01gUNKYLeG2FibyJ .doneCritText3{fill:#000 !important}#mermaid-svg-01gUNKYLeG2FibyJ .activeCritText0,#mermaid-svg-01gUNKYLeG2FibyJ .activeCritText1,#mermaid-svg-01gUNKYLeG2FibyJ .activeCritText2,#mermaid-svg-01gUNKYLeG2FibyJ .activeCritText3{fill:#000 !important}#mermaid-svg-01gUNKYLeG2FibyJ .titleText{text-anchor:middle;font-size:18px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-01gUNKYLeG2FibyJ g.classGroup text{fill:#9370db;stroke:none;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:10px}#mermaid-svg-01gUNKYLeG2FibyJ g.classGroup text .title{font-weight:bolder}#mermaid-svg-01gUNKYLeG2FibyJ g.clickable{cursor:pointer}#mermaid-svg-01gUNKYLeG2FibyJ g.classGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-01gUNKYLeG2FibyJ g.classGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-01gUNKYLeG2FibyJ .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5}#mermaid-svg-01gUNKYLeG2FibyJ .classLabel .label{fill:#9370db;font-size:10px}#mermaid-svg-01gUNKYLeG2FibyJ .relation{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-01gUNKYLeG2FibyJ .dashed-line{stroke-dasharray:3}#mermaid-svg-01gUNKYLeG2FibyJ #compositionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-01gUNKYLeG2FibyJ #compositionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-01gUNKYLeG2FibyJ #aggregationStart{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-01gUNKYLeG2FibyJ #aggregationEnd{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-01gUNKYLeG2FibyJ #dependencyStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-01gUNKYLeG2FibyJ #dependencyEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-01gUNKYLeG2FibyJ #extensionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-01gUNKYLeG2FibyJ #extensionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-01gUNKYLeG2FibyJ .commit-id,#mermaid-svg-01gUNKYLeG2FibyJ .commit-msg,#mermaid-svg-01gUNKYLeG2FibyJ .branch-label{fill:lightgrey;color:lightgrey;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-01gUNKYLeG2FibyJ .pieTitleText{text-anchor:middle;font-size:25px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-01gUNKYLeG2FibyJ .slice{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-01gUNKYLeG2FibyJ g.stateGroup text{fill:#9370db;stroke:none;font-size:10px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-01gUNKYLeG2FibyJ g.stateGroup text{fill:#9370db;fill:#333;stroke:none;font-size:10px}#mermaid-svg-01gUNKYLeG2FibyJ g.statediagram-cluster .cluster-label text{fill:#333}#mermaid-svg-01gUNKYLeG2FibyJ g.stateGroup .state-title{font-weight:bolder;fill:#000}#mermaid-svg-01gUNKYLeG2FibyJ g.stateGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-01gUNKYLeG2FibyJ g.stateGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-01gUNKYLeG2FibyJ .transition{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-01gUNKYLeG2FibyJ .stateGroup .composit{fill:white;border-bottom:1px}#mermaid-svg-01gUNKYLeG2FibyJ .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px}#mermaid-svg-01gUNKYLeG2FibyJ .state-note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-01gUNKYLeG2FibyJ .state-note text{fill:black;stroke:none;font-size:10px}#mermaid-svg-01gUNKYLeG2FibyJ .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.7}#mermaid-svg-01gUNKYLeG2FibyJ .edgeLabel text{fill:#333}#mermaid-svg-01gUNKYLeG2FibyJ .stateLabel text{fill:#000;font-size:10px;font-weight:bold;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-01gUNKYLeG2FibyJ .node circle.state-start{fill:black;stroke:black}#mermaid-svg-01gUNKYLeG2FibyJ .node circle.state-end{fill:black;stroke:white;stroke-width:1.5}#mermaid-svg-01gUNKYLeG2FibyJ #statediagram-barbEnd{fill:#9370db}#mermaid-svg-01gUNKYLeG2FibyJ .statediagram-cluster rect{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-01gUNKYLeG2FibyJ .statediagram-cluster rect.outer{rx:5px;ry:5px}#mermaid-svg-01gUNKYLeG2FibyJ .statediagram-state .divider{stroke:#9370db}#mermaid-svg-01gUNKYLeG2FibyJ .statediagram-state .title-state{rx:5px;ry:5px}#mermaid-svg-01gUNKYLeG2FibyJ .statediagram-cluster.statediagram-cluster .inner{fill:white}#mermaid-svg-01gUNKYLeG2FibyJ .statediagram-cluster.statediagram-cluster-alt .inner{fill:#e0e0e0}#mermaid-svg-01gUNKYLeG2FibyJ .statediagram-cluster .inner{rx:0;ry:0}#mermaid-svg-01gUNKYLeG2FibyJ .statediagram-state rect.basic{rx:5px;ry:5px}#mermaid-svg-01gUNKYLeG2FibyJ .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#efefef}#mermaid-svg-01gUNKYLeG2FibyJ .note-edge{stroke-dasharray:5}#mermaid-svg-01gUNKYLeG2FibyJ .statediagram-note rect{fill:#fff5ad;stroke:#aa3;stroke-width:1px;rx:0;ry:0}:root{--mermaid-font-family: '"trebuchet ms", verdana, arial';--mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive}#mermaid-svg-01gUNKYLeG2FibyJ .error-icon{fill:#522}#mermaid-svg-01gUNKYLeG2FibyJ .error-text{fill:#522;stroke:#522}#mermaid-svg-01gUNKYLeG2FibyJ .edge-thickness-normal{stroke-width:2px}#mermaid-svg-01gUNKYLeG2FibyJ .edge-thickness-thick{stroke-width:3.5px}#mermaid-svg-01gUNKYLeG2FibyJ .edge-pattern-solid{stroke-dasharray:0}#mermaid-svg-01gUNKYLeG2FibyJ .edge-pattern-dashed{stroke-dasharray:3}#mermaid-svg-01gUNKYLeG2FibyJ .edge-pattern-dotted{stroke-dasharray:2}#mermaid-svg-01gUNKYLeG2FibyJ .marker{fill:#333}#mermaid-svg-01gUNKYLeG2FibyJ .marker.cross{stroke:#333} :root { --mermaid-font-family: "trebuchet ms", verdana, arial;}</style> <style>#mermaid-svg-01gUNKYLeG2FibyJ { color: rgba(0, 0, 0, 0.75); font: ; }</style>
Service A - traceId, spanIdA
Service B - traceId, spanIdA1
Service C - traceId, spanIdA12
Service D - traceId, spanIdA11

Span ID 如果要計算時間延遲,可以通過 spanIdA11 - spanIdA1

8.1.2 Zipkin 是什么

  • Zipkin 的基礎概念
    • Zipkin 解決微服務架構中的延遲問題,包括資料的收集、存盤、查找和展現
    • Zipkin 有四大核心組件構成
      1. Collector:收集器組件
      2. Storge:存盤組件
      3. API:RESTFul API,提供外部訪問介面
      4. UI:Web UI,提供可視化查詢頁面

8.2.1 集成 SpringCloud Sleuth 實作微服務通信跟蹤

8.2.1.1 集成步驟

  • 保證服務與服務之間存在跨行程通信
  • Maven 依賴

8.2.1.2 撰寫測驗代碼

sca-commerce-gateway 與 sca-commerce-alibaba-nacos-client 添加 Maven 依賴

<!-- 通過 Sleuth 實作鏈路跟蹤 -->
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>

sca-commerce-alibaba-nacos-client 撰寫測驗業務代碼與控制層代碼

SleuthTraceInfoService

package com.edcode.commerce.service;

import brave.Tracer;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author eddie.lee
 * @blog blog.eddilee.cn
 * @description 使用代碼更直觀的看到 Sleuth 生成的相關跟蹤資訊
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class SleuthTraceInfoService {

    /** brave.Tracer 跟蹤物件 */
    private final Tracer tracer;

    /**
     * 列印當前的跟蹤資訊到日志中
     */
    public void logCurrentTraceInfo() {

        log.info("Sleuth trace id: [{}]", tracer.currentSpan().context().traceId());
        log.info("Sleuth span id: [{}]", tracer.currentSpan().context().spanId());
    }
}

SleuthTraceInfoController

package com.edcode.commerce.controller;

import com.edcode.commerce.service.SleuthTraceInfoService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author eddie.lee
 * @blog blog.eddilee.cn
 * @description 列印跟蹤資訊
 */
@Slf4j
@RestController
@RequestMapping("/sleuth")
@RequiredArgsConstructor
public class SleuthTraceInfoController {

    private final SleuthTraceInfoService traceInfoService;

    /**
     * 列印日志跟蹤資訊
     */
    @GetMapping("/trace-info")
    public void logCurrentTraceInfo() {
        traceInfoService.logCurrentTraceInfo();
    }
}

8.2.1.2 測驗請求與查看控制臺日志

發起請求

### 查看 Sleuth 跟蹤資訊
GET http://127.0.0.1:9001/edcode/scacommerce-nacos-client/sleuth/trace-info
Accept: application/json
sca-commerce-user: eyJhbGciOiJSUzI1NiJ9.eyJzY2EtY29tbWVyY2UtdXNlciI6IntcImlkXCI6MTEsXCJ1c2VybmFtZVwiOlwiZWRkaWVAcXEuY29tXCJ9IiwianRpIjoiZjQ3M2NhZjctY2RjMi00ZmE4LWExNzQtZjZhYmQ5ZDFjMzAzIiwiZXhwIjoxNjM1ODY4ODAwfQ.iTtQE2gHzjPxVP5SEFHrDBkvrzI-yt6oy-w1x--Q3ahhTvYLTiYnvndtIx7IIyYipr_ayZnAQyluPt3oiLaS80r9qByaN3zQF-6gBW_wu_fd0yd89hIjPnQeP1mY2NcchV2FaMUW7Jlq8CUDPurEhW4GUDXOqBXgmxai5UTu4yoXBUfyXUXznKTx697cGo5aoVKTAKvMReJg-77n5sQuafZNDu6pz2D1KMvEucNyZtbXw0JRIl1CsK777Jt3IG1bnOnwRBt8o1tkodZ3zJbfgTGVCHJmfEuUnXwdf4DLAq568pNVvylPLh4_r-UUGGxE6Az9XwOtl1w4vzK1M2ATzw
token: edcode

回應資訊

GET http://127.0.0.1:9001/edcode/scacommerce-nacos-client/sleuth/trace-info

HTTP/1.1 200 OK
transfer-encoding: chunked
Content-Type: application/json
Date: Tue, 02 Nov 2021 13:04:55 GMT

{
  "code": 0,
  "message": "",
  "data": null
}

Response code: 200 (OK); Time: 1160ms; Content length: 35 bytes

查看日志

sca-commerce-gateway

2021-11-02 21:04:55.332  INFO [sca-commerce-gateway,353ea734cc43d6ee,353ea734cc43d6ee,true] 1060 --- [ctor-http-nio-2] c.netflix.config.ChainedDynamicProperty  : Flipping property: sca-commerce-nacos-client.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
2021-11-02 21:04:55.347  INFO [sca-commerce-gateway,353ea734cc43d6ee,353ea734cc43d6ee,true] 1060 --- [ctor-http-nio-2] c.netflix.loadbalancer.BaseLoadBalancer  : Client: sca-commerce-nacos-client instantiated a LoadBalancer: DynamicServerListLoadBalancer:{NFLoadBalancer:name=sca-commerce-nacos-client,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:null
2021-11-02 21:04:55.353  INFO [sca-commerce-gateway,353ea734cc43d6ee,353ea734cc43d6ee,true] 1060 --- [ctor-http-nio-2] c.n.l.DynamicServerListLoadBalancer      : Using serverListUpdater PollingServerListUpdater
2021-11-02 21:04:55.372  INFO [sca-commerce-gateway,353ea734cc43d6ee,353ea734cc43d6ee,true] 1060 --- [ctor-http-nio-2] c.netflix.config.ChainedDynamicProperty  : Flipping property: sca-commerce-nacos-client.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
2021-11-02 21:04:55.374  INFO [sca-commerce-gateway,353ea734cc43d6ee,353ea734cc43d6ee,true] 1060 --- [ctor-http-nio-2] c.n.l.DynamicServerListLoadBalancer      : DynamicServerListLoadBalancer for client sca-commerce-nacos-client initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=sca-commerce-nacos-client,current list of Servers=[192.168.3.192:8000],Load balancer stats=Zone stats: {unknown=[Zone:unknown;	Instance count:1;	Active connections count: 0;	Circuit breaker tripped count: 0;	Active connections per server: 0.0;]
},Server stats: [[Server:192.168.3.192:8000;	Zone:UNKNOWN;	Total Requests:0;	Successive connection failure:0;	Total blackout seconds:0;	Last connection made:Thu Jan 01 08:00:00 CST 1970;	First connection made: Thu Jan 01 08:00:00 CST 1970;	Active Connections:0;	total failure count in last (1000) msecs:0;	average resp time:0.0;	90 percentile resp time:0.0;	95 percentile resp time:0.0;	min resp time:0.0;	max resp time:0.0;	stddev resp time:0.0]
]}ServerList:com.alibaba.cloud.nacos.ribbon.NacosServerList@72186c8f
2021-11-02 21:04:55.592  INFO [sca-commerce-gateway,353ea734cc43d6ee,353ea734cc43d6ee,true] 1060 --- [ctor-http-nio-2] c.e.c.filter.GlobalElapsedLogFilter      : [/edcode/scacommerce-nacos-client/sleuth/trace-info] elapsed: [1034ms]
2021-11-02 21:04:56.358  INFO [sca-commerce-gateway,,,] 1060 --- [erListUpdater-0] c.netflix.config.ChainedDynamicProperty  : Flipping property: sca-commerce-nacos-client.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647

sca-commerce-alibaba-nacos-client

2021-11-02 21:04:55.543  INFO [sca-commerce-nacos-client,353ea734cc43d6ee,c85be2c1bb127558,true] 33740 --- [nio-8000-exec-1] c.e.c.service.SleuthTraceInfoService     : Sleuth trace id: [3836687777773377262]
2021-11-02 21:04:55.543  INFO [sca-commerce-nacos-client,353ea734cc43d6ee,c85be2c1bb127558,true] 33740 --- [nio-8000-exec-1] c.e.c.service.SleuthTraceInfoService     : Sleuth span id: [-4009361721548180136]

決議:[sca-commerce-nacos-client,353ea734cc43d6ee,c85be2c1bb127558,true]
第一行:service name
第二行:trace id
第三行:span id

8.3.1 搭建 Zipkin Server 實作對跟蹤資訊的收集

8.3.1.1 ZS搭建步驟

  • Tips:SpringCloud Finchley 版本(包含)之后,官方不建議自己搭建 Zipkin-Server,提供了已經打包好的jar檔案(SpringBoot工程),直接下載啟動即可
  • 下載地址
    • curl -sSL https://zipkin.io/quickstart.sh | bash -s
    1. 選擇自己需要的版本即可
    2. 選擇 *.exec.jar 結尾的 jar

8.3.1.2 Linux 終端

[root@localhost opt]# curl -sSL https://zipkin.io/quickstart.sh | bash -s 
Thank you for trying Zipkin!
This installer is provided as a quick-start helper, so you can try Zipkin out
without a lengthy installation process.

Fetching version number of latest io.zipkin:zipkin-server release...
Latest release of io.zipkin:zipkin-server seems to be 2.23.4

Downloading io.zipkin:zipkin-server:2.23.4:exec to zipkin.jar...
> curl -fL -o 'zipkin.jar' 'https://repo1.maven.org/maven2/io/zipkin/zipkin-server/2.23.4/zipkin-server-2.23.4-exec.jar'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 59.0M  100 59.0M    0     0  34146      0  0:30:14  0:30:14 --:--:-- 33309

Verifying checksum...
> curl -fL -o 'zipkin.jar.md5' 'https://repo1.maven.org/maven2/io/zipkin/zipkin-server/2.23.4/zipkin-server-2.23.4-exec.jar.md5'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    32  100    32    0     0     17      0  0:00:01  0:00:01 --:--:--    17
> md5sum -c <<< "$(cat zipkin.jar.md5)  zipkin.jar"
zipkin.jar: OK
Checksum for zipkin.jar passes verification

Verifying GPG signature of zipkin.jar...
> curl -fL -o 'zipkin.jar.asc' 'https://repo1.maven.org/maven2/io/zipkin/zipkin-server/2.23.4/zipkin-server-2.23.4-exec.jar.asc'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   833  100   833    0     0     91      0  0:00:09  0:00:09 --:--:--   180

GPG signing key is not known, skipping signature verification.
Use the following commands to manually verify the signature of zipkin.jar:

    gpg --keyserver keyserver.ubuntu.com --recv FF31B515
    # Optionally trust the key via 'gpg --edit-key FF31B515', then typing 'trust',
    # choosing a trust level, and exiting the interactive GPG session by 'quit'
    gpg --verify zipkin.jar.asc zipkin.jar


You can now run the downloaded executable jar:

    java -jar zipkin.jar

[root@localhost opt]# nohup java -jar zipkin.jar &
[1] 30238
[root@localhost opt]# nohup: ignoring input and appending output to ‘nohup.out’

8.3.1.3 Zipkin Web UI

訪問:IP:9411
在這里插入圖片描述

8.3.2 配置 Zipkin Server 實作對跟蹤資訊的收集

  • 配置 ZS
    • 為什么需要對 ZS 做自定義配置?
      1. 默認情況下, ZS 將 跟蹤資訊存盤在記憶體中(JVM),重啟會丟失
      2. ZS 默認使用 HTTP 方式上報跟蹤資料,性能較差
    • ZS 配置 MySQL 跟蹤資料持久化 (同時它也支持 ES)
      1. MySQL 中添加資料表:https://github.com/openzipkin/zipkin/blob/master/zipkin-storage/mysql-v1/src/main/resources/mysql.sql
      2. ZS 啟動指定 MySQL 路徑

在這里插入圖片描述

8.4.1 SpringCloud Sleuth 整合 Zipkin 實作分布式鏈路跟蹤、收集

  • SpringCloud Sleuth 整合 Zipkin 步驟

    • 簡單的兩個步驟(Zipkin Server 使用 MySQL 實作跟蹤資料持久化)
      • Maven 依賴
      • bootstrap.yml 中增加 Zipkin 的配置
  • 下載、安裝 Kafka

    • 下載 Kafka:https://kafka.apache.org/quickstart
    • 解壓、啟動 ZK 和 Kafka Server 即可 (使用默認配置)

8.4.1.1 下載與解壓 Kafka

Downloads

https://kafka.apache.org/downloads
在這里插入圖片描述

Linux 步驟

[root@localhost opt]# wget https://dlcdn.apache.org/kafka/3.0.0/kafka_2.13-3.0.0.tgz
[root@localhost opt]# tar -zxf kafka_2.13-3.0.0.tgz 
[root@localhost opt]# ls -la | grep kafka
drwxr-xr-x.  8 root root       134 Nov  3 01:48 kafka_2.13-3.0.0
-rw-r--r--.  1 root root  86396520 Sep 20 04:46 kafka_2.13-3.0.0.tgz

8.4.1.2 啟動 zookeeper 與 Kafka

對外訪問需要修改 Kafka 的 server.properties

找到 advertised.listeners 或者 自行添加 advertised.listeners 指定 IP 地址

[root@localhost kafka_2.13-3.0.0]# vim /opt/kafka_2.13-3.0.0/config/server.properties

advertised.listeners=PLAINTEXT://192.168.3.250:9092
后臺啟動 zookeeper
[root@localhost kafka_2.13-3.0.0]# nohup /opt/kafka_2.13-3.0.0/bin/zookeeper-server-start.sh config/zookeeper.properties &
[1] 31998
[root@localhost kafka_2.13-3.0.0]# nohup: ignoring input and appending output to ‘nohup.out’
后臺啟動 kafka
[root@localhost kafka_2.13-3.0.0]# nohup /opt/kafka_2.13-3.0.0/bin/kafka-server-start.sh config/server.properties &
[1] 32574
[root@localhost kafka_2.13-3.0.0]# nohup: ignoring input and appending output to ‘nohup.out’

8.4.1.3 運行 ZipKin 關聯 Kafka 與 MySQL

[root@localhost opt]# nohup java -DKAFKA_BOOTSTRAP_SERVERS=127.0.0.1:9092 -jar zipkin.jar --STORAGE_TYPE=mysql --MYSQL_USER=root --MYSQL_PASS=123456 --MYSQL_HOST=127.0.0.1 --MYSQL_TCP_PORT=3306 --MYSQL_DB=zipkin &
[1] 601
[root@localhost opt]# nohup: ignoring input and appending output to ‘nohup.out’

連接kafka:-DKAFKA_BOOTSTRAP_SERVERS=127.0.0.1:9092

連接MySQL:–STORAGE_TYPE=mysql --MYSQL_USER=root --MYSQL_PASS=123456 --MYSQL_HOST=127.0.0.1 --MYSQL_TCP_PORT=3306 --MYSQL_DB=zipkin

8.4.1.4 檢查 Linux 服務是否啟動

[root@localhost opt]# ps -aux | grep -E 'nacos|zipkin|kafka|zookeeper'  
[root@localhost opt]# netstat -ltnp | grep -E '8848|9092|9411|2181' 
tcp6       0      0 :::8848                 :::*                    LISTEN      1932/java           
tcp6       0      0 :::9411                 :::*                    LISTEN      601/java            
tcp6       0      0 :::9092                 :::*                    LISTEN      32574/java          
tcp6       0      0 :::2181                 :::*                    LISTEN      31998/java 

8.4.1.4 IDEA 啟動服務與測驗發起請求

Maven 依賴 (zipkin 與 kafka)

<!-- 通過 Sleuth 實作鏈路跟蹤 -->
<!--        <dependency>-->
<!--            <groupId>org.springframework.cloud</groupId>-->
<!--            <artifactId>spring-cloud-starter-sleuth</artifactId>-->
<!--        </dependency>-->
<!-- zipkin = spring-cloud-starter-sleuth + spring-cloud-sleuth-zipkin-->
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.kafka</groupId>
    <artifactId>spring-kafka</artifactId>
    <version>2.5.0.RELEASE</version>
</dependency>

修改 Gateway 與 Nacos-Client 服務的組態檔

spring:
  kafka:
    bootstrap-servers: ${KAFKA_SERVER:127.0.0.1}:${KAFKA_PORT:9092}
    producer:
      retries: 3
    consumer:
      auto-offset-reset: latest
  zipkin:
    sender:
      type: ${ZIPKIN_KAFKA_SENDER:web} # 默認是 web
    base-url: http://${ZIPKIN_URL:localhost}:${ZIPKIN_PORT:9411}/

兩個服務都需要添加 kafka 與 zipkin 的連接資訊

啟動服務

  • 啟動以下服務
    • AuthorityCenterApplication :7000/ # 如果 token 過期,需要重新簽發
    • NacosClientApplication :8000/
    • GatewayApplication :9001/

請求測驗

sca-commerce-gateway/src/main/resources/http/nacos-client.http

### 查詢服務
GET http://127.0.0.1:9001/edcode/scacommerce-nacos-client/nacos-client/service-instance?serviceId=sca-commerce-gateway
Accept: application/json
sca-commerce-user: eyJhbGciOiJSUzI1NiJ9.eyJzY2EtY29tbWVyY2UtdXNlciI6IntcImlkXCI6MTEsXCJ1c2VybmFtZVwiOlwiZWRkaWVAcXEuY29tXCJ9IiwianRpIjoiMWU1MGI2ZWYtNmUzOS00YmY2LWJlMjktZDc4NWU3NWQyNmY1IiwiZXhwIjoxNjM1OTU1MjAwfQ.P7GxZuMUrgiMUbD4dNYzQiV3A6YkaFpvlzg8cpBdu_hvxqDsVEuuiYODQSzZPQeN3xTQPbJ70zkSY084HV7Vsk929en1lqNiX_dpQEuGSbz2JSPqyJuLZ6v7hRX9GI32sPrZAnaKVXMdeHUXCMMmaS1L3osimSvAlaoDE0n2UukDLgu83xRlL3bddHIJbmFD5BrV6Y-u9d-blqXPOpxFEYkdwS_XrljYiULTH7Olr71TAwODUPdttnmVhHPXB0_dnOG5DZMOC0OxqokHGZJ7CC86paE4TvdNPwqotB6u6zh_d_YCCBWM3t1LmKYB6E_bnz2taL5Q4AYHlRaZZotaAA
token: edcode ## HeaderTokenGatewayFilter

###

8.4.1.5 Zipkin Web UI

如何簡單的使用

打開 http://192.168.3.250:9411

在這里插入圖片描述
默認 all,然后直接查找,會顯示所有的請求資訊,點擊其中一條

在這里插入圖片描述就會看到該請求的所有經過哪些服務,耗時多少

同樣,也可以在終端拿 trace Id:669b59f38adf2c38 去跟蹤鏈路

在這里插入圖片描述trace Id 搜索框:669b59f38adf2c38

在這里插入圖片描述

如何查看服務之間的依賴關系

點擊上方的【依賴】
在這里插入圖片描述

8.5.1 Spring Cloud Sleuth 設定采樣率、抽樣收集策略

8.5.1.1 Spring Cloud Sleuth 采樣收集

  • 收集跟蹤資訊是一把雙刃劍,需要做好權衡
    • 收集的跟蹤資訊越多,越能反映出系統的實際運行情況
    • 高并發場景下,大量的請求呼叫會產生海量的跟蹤日志資訊,性能開銷太大

開發與測驗環境可以使用高的采樣率,但是生產環境建議不要這么做,

  • 可以自由選擇 Zipkin brave 自帶的兩個抽樣策略
    • ProbabilityBasedSampler 采樣率策略
      • 默認使用的策略,以請求百分比 的方式配置和手機跟蹤資訊:它的默認值為 0.1,代表手機 10% 的請求跟蹤資訊
      • spring.sleuth.sampler.probability=0.5
    • RateLimitingSampler 抽樣策略
      • 限速采集,也就是說它可以用來限制每秒追蹤請求的最大數量,優先級更高
      • spring.sleuth.sampler.rate=10 ## 一秒最大只有10個跟蹤策略給采集

8.5.1.2 bootstrap.yml 配置 Sleuth

sca-commerce-alibaba-nacos-client

spring:
  sleuth:
    sampler:
      # RateLimitingSampler 抽樣策略,設定了限速采樣,spring.sleuth.sampler.probability 屬性值無效
      rate: 100 # 每秒間隔接受的 trace 量
      # Probability 抽樣策略
      probability: 1.0 # 采樣比例,1.0 表示 100%, 默認:0.1

8.5.1.3 代碼配置 Sleuth

package com.edcode.commerce.sampler;

import brave.sampler.RateLimitingSampler;
import brave.sampler.Sampler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author eddie.lee
 * @blog blog.eddilee.cn
 * @description 使用配置的方式設定抽樣率 (二選一)
 */
@Configuration
public class SamplerConfig {

    /**
     * 限速采集(推薦)
     */
    @Bean
    public Sampler sampler() {
        return RateLimitingSampler.create(100);
    }

//    /**
//     * 概率采集, 默認的采樣策略, 默認值是 0.1
//     */
//    @Bean
//    public Sampler defaultSampler() {
//        return ProbabilityBasedSampler.create(0.5f);
//    }
}

代碼Yaml檔案配置是二選一,方便簡潔肯定是 Yaml配置

限速采集概率采集無論是代碼還是 Yaml檔案 都是二選一

8.6.1 SpringCloud Sleuth+Zipkin 分布式日志追蹤總結

8.6.1.1 SpringCloud Sleuth+Zipkin 邏輯架構圖

  • 跟蹤、收集所涉及的三個組件(模塊)Sleuth、Zipkin、Brave
  • 三個組件之間的關系
    • Brave 是一個 tracer 庫,提供的是 tracer 介面
    • Sleuth 采用了 Brave 作為 tracer 庫
    • Sleuth 可以不使用 Zipkin

在這里插入圖片描述

8.6.1.2 Brave 解讀

  • Brave 的兩個最基本、也是最核心的概念

    • trace:以看作是一個邏輯執行程序中的整個鏈條 (可以看作一棵樹)
    • span:是 trace 跟蹤的基本單位
  • Brave 中常用的資料結構以及說明

    • Tracing:工具類,用于生成 Tracer 類實體
    • Tracer:也是工具類,用于生成 Span
    • Span:實際記錄每個功能塊執行資訊的類
    • TraceContext:記錄 trace 的執行程序中的元資料資訊類
    • Propagation:用于在分布式環境或者跨行程條件下的 trace 跟蹤時實作 TraceContext 傳遞的工具類

8.6.1.2 SpringCloud Sleuth 如何實作跨服務Trace 追蹤

  • SpringCloud Sleuth 實作跨服務 Trace 追蹤
    • SpringCloud Sleuth 和 Brave 提供了很多不同的分布式框架的支持,例如 gRPC、Kafka、HTTP等

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/348308.html

標籤:其他

上一篇:centos7安裝hadoop集群(親測可用)

下一篇:5.springboot整合RabbitMQ

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • 網閘典型架構簡述

    網閘架構一般分為兩種:三主機的三系統架構網閘和雙主機的2+1架構網閘。 三主機架構分別為內端機、外端機和仲裁機。三機無論從軟體和硬體上均各自獨立。首先從硬體上來看,三機都用各自獨立的主板、記憶體及存盤設備。從軟體上來看,三機有各自獨立的作業系統。這樣能達到完全的三機獨立。對于“2+1”系統,“2”分為 ......

    uj5u.com 2020-09-10 02:00:44 more
  • 如何從xshell上傳檔案到centos linux虛擬機里

    如何從xshell上傳檔案到centos linux虛擬機里及:虛擬機CentOs下執行 yum -y install lrzsz命令,出現錯誤:鏡像無法找到軟體包 前言 一、安裝lrzsz步驟 二、上傳檔案 三、遇到的問題及解決方案 總結 前言 提示:其實很簡單,往虛擬機上安裝一個上傳檔案的工具 ......

    uj5u.com 2020-09-10 02:00:47 more
  • 一、SQLMAP入門

    一、SQLMAP入門 1、判斷是否存在注入 sqlmap.py -u 網址/id=1 id=1不可缺少。當注入點后面的引數大于兩個時。需要加雙引號, sqlmap.py -u "網址/id=1&uid=1" 2、判斷文本中的請求是否存在注入 從文本中加載http請求,SQLMAP可以從一個文本檔案中 ......

    uj5u.com 2020-09-10 02:00:50 more
  • Metasploit 簡單使用教程

    metasploit 簡單使用教程 浩先生, 2020-08-28 16:18:25 分類專欄: kail 網路安全 linux 文章標簽: linux資訊安全 編輯 著作權 metasploit 使用教程 前言 一、Metasploit是什么? 二、準備作業 三、具體步驟 前言 Msfconsole ......

    uj5u.com 2020-09-10 02:00:53 more
  • 游戲逆向之驅動層與用戶層通訊

    驅動層代碼: #pragma once #include <ntifs.h> #define add_code CTL_CODE(FILE_DEVICE_UNKNOWN,0x800,METHOD_BUFFERED,FILE_ANY_ACCESS) /* 更多游戲逆向視頻www.yxfzedu.com ......

    uj5u.com 2020-09-10 02:00:56 more
  • 北斗電力時鐘(北斗授時服務器)讓網路資料更精準

    北斗電力時鐘(北斗授時服務器)讓網路資料更精準 北斗電力時鐘(北斗授時服務器)讓網路資料更精準 京準電子科技官微——ahjzsz 近幾年,資訊技術的得了快速發展,互聯網在逐漸普及,其在人們生活和生產中都得到了廣泛應用,并且取得了不錯的應用效果。計算機網路資訊在電力系統中的應用,一方面使電力系統的運行 ......

    uj5u.com 2020-09-10 02:01:03 more
  • 【CTF】CTFHub 技能樹 彩蛋 writeup

    ?碎碎念 CTFHub:https://www.ctfhub.com/ 筆者入門CTF時時剛開始刷的是bugku的舊平臺,后來才有了CTFHub。 感覺不論是網頁UI設計,還是題目質量,賽事跟蹤,工具軟體都做得很不錯。 而且因為獨到的金幣制度的確讓人有一種想去刷題賺金幣的感覺。 個人還是非常喜歡這個 ......

    uj5u.com 2020-09-10 02:04:05 more
  • 02windows基礎操作

    我學到了一下幾點 Windows系統目錄結構與滲透的作用 常見Windows的服務詳解 Windows埠詳解 常用的Windows注冊表詳解 hacker DOS命令詳解(net user / type /md /rd/ dir /cd /net use copy、批處理 等) 利用dos命令制作 ......

    uj5u.com 2020-09-10 02:04:18 more
  • 03.Linux基礎操作

    我學到了以下幾點 01Linux系統介紹02系統安裝,密碼啊破解03Linux常用命令04LAMP 01LINUX windows: win03 8 12 16 19 配置不繁瑣 Linux:redhat,centos(紅帽社區版),Ubuntu server,suse unix:金融機構,證券,銀 ......

    uj5u.com 2020-09-10 02:04:30 more
  • 05HTML

    01HTML介紹 02頭部標簽講解03基礎標簽講解04表單標簽講解 HTML前段語言 js1.了解代碼2.根據代碼 懂得挖掘漏洞 (POST注入/XSS漏洞上傳)3.黑帽seo 白帽seo 客戶網站被黑帽植入劫持代碼如何處理4.熟悉html表單 <html><head><title>TDK標題,描述 ......

    uj5u.com 2020-09-10 02:04:36 more
最新发布
  • 2023年最新微信小程式抓包教程

    01 開門見山 隔一個月發一篇文章,不過分。 首先回顧一下《微信系結手機號資料庫被脫庫事件》,我也是第一時間得知了這個訊息,然后跟蹤了整件事情的經過。下面是這起事件的相關截圖以及近日流出的一萬條資料樣本: 個人認為這件事也沒什么,還不如關注一下之前45億快遞資料查詢渠道疑似在近日復活的訊息。 訊息是 ......

    uj5u.com 2023-04-20 08:48:24 more
  • web3 產品介紹:metamask 錢包 使用最多的瀏覽器插件錢包

    Metamask錢包是一種基于區塊鏈技術的數字貨幣錢包,它允許用戶在安全、便捷的環境下管理自己的加密資產。Metamask錢包是以太坊生態系統中最流行的錢包之一,它具有易于使用、安全性高和功能強大等優點。 本文將詳細介紹Metamask錢包的功能和使用方法。 一、 Metamask錢包的功能 數字資 ......

    uj5u.com 2023-04-20 08:47:46 more
  • vulnhub_Earth

    前言 靶機地址->>>vulnhub_Earth 攻擊機ip:192.168.20.121 靶機ip:192.168.20.122 參考文章 https://www.cnblogs.com/Jing-X/archive/2022/04/03/16097695.html https://www.cnb ......

    uj5u.com 2023-04-20 07:46:20 more
  • 從4k到42k,軟體測驗工程師的漲薪史,給我看哭了

    清明節一過,盲猜大家已經無心上班,在數著日子準備過五一,但一想到銀行卡里的余額……瞬間心情就不美麗了。最近,2023年高校畢業生就業調查顯示,本科畢業月平均起薪為5825元。調查一出,便有很多同學表示自己又被平均了。看著這一資料,不免讓人想到前不久中國青年報的一項調查:近六成大學生認為畢業10年內會 ......

    uj5u.com 2023-04-20 07:44:00 more
  • 最新版本 Stable Diffusion 開源 AI 繪畫工具之中文自動提詞篇

    🎈 標簽生成器 由于輸入正向提示詞 prompt 和反向提示詞 negative prompt 都是使用英文,所以對學習母語的我們非常不友好 使用網址:https://tinygeeker.github.io/p/ai-prompt-generator 這個網址是為了讓大家在使用 AI 繪畫的時候 ......

    uj5u.com 2023-04-20 07:43:36 more
  • 漫談前端自動化測驗演進之路及測驗工具分析

    隨著前端技術的不斷發展和應用程式的日益復雜,前端自動化測驗也在不斷演進。隨著 Web 應用程式變得越來越復雜,自動化測驗的需求也越來越高。如今,自動化測驗已經成為 Web 應用程式開發程序中不可或缺的一部分,它們可以幫助開發人員更快地發現和修復錯誤,提高應用程式的性能和可靠性。 ......

    uj5u.com 2023-04-20 07:43:16 more
  • CANN開發實踐:4個DVPP記憶體問題的典型案例解讀

    摘要:由于DVPP媒體資料處理功能對存放輸入、輸出資料的記憶體有更高的要求(例如,記憶體首地址128位元組對齊),因此需呼叫專用的記憶體申請介面,那么本期就分享幾個關于DVPP記憶體問題的典型案例,并給出原因分析及解決方法。 本文分享自華為云社區《FAQ_DVPP記憶體問題案例》,作者:昇騰CANN。 DVPP ......

    uj5u.com 2023-04-20 07:43:03 more
  • msf學習

    msf學習 以kali自帶的msf為例 一、msf核心模塊與功能 msf模塊都放在/usr/share/metasploit-framework/modules目錄下 1、auxiliary 輔助模塊,輔助滲透(埠掃描、登錄密碼爆破、漏洞驗證等) 2、encoders 編碼器模塊,主要包含各種編碼 ......

    uj5u.com 2023-04-20 07:42:59 more
  • Halcon軟體安裝與界面簡介

    1. 下載Halcon17版本到到本地 2. 雙擊安裝包后 3. 步驟如下 1.2 Halcon軟體安裝 界面分為四大塊 1. Halcon的五個助手 1) 影像采集助手:與相機連接,設定相機引數,采集影像 2) 標定助手:九點標定或是其它的標定,生成標定檔案及內參外參,可以將像素單位轉換為長度單位 ......

    uj5u.com 2023-04-20 07:42:17 more
  • 在MacOS下使用Unity3D開發游戲

    第一次發博客,先發一下我的游戲開發環境吧。 去年2月份買了一臺MacBookPro2021 M1pro(以下簡稱mbp),這一年來一直在用mbp開發游戲。我大致分享一下我的開發工具以及使用體驗。 1、Unity 官網鏈接: https://unity.cn/releases 我一般使用的Apple ......

    uj5u.com 2023-04-20 07:40:19 more