alertManager部署安裝、告警規則配置詳解及告警消息推送

?

?
java接受告警請求@RestController
@RequestMapping("/alert")
@Slf4j
public class TestApi {private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");@RequestMappingpublic void sendTemplate(HttpServletRequest request) throws Exception {String requestBody = StreamUtils.copyToString(request.getInputStream(), StandardCharsets.UTF_8);JSONObject jsonObject = JSONUtil.parseObj(requestBody);log.info("sendTemplate {}", jsonObject);// 遍歷告警信息JSONArray alerts = jsonObject.getJSONArray("alerts");for (int i = 0; i < alerts.size(); i++) {JSONObject alert = alerts.getJSONObject(i);JSONObject labels = alert.getJSONObject("labels");JSONObject annotations = alert.getJSONObject("annotations");// 替換模板中的占位符Map<String, Object> templateData = new HashMap<>();templateData.put("sendTime", LocalDateTime.now().format(FORMATTER));templateData.put("alertname", labels.getStr("alertname"));templateData.put("instance", labels.getStr("instance"));templateData.put("severity", labels.getStr("severity"));templateData.put("status", alert.getStr("status"));templateData.put("startsAt", alert.getStr("startsAt"));templateData.put("description", annotations.getStr("description"));templateData.put("generatorURL", alert.getStr("generatorURL"));String alertMsg = TemplateUtils.renderTemplate("alert.ftl", templateData);// 調用企業微信機器人發送消息WeComBot.sendToWeComBot(alertMsg);}}
}?


       <!-- FreeMarker Template Engine --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-freemarker</artifactId></dependency>import freemarker.template.Configuration;
import freemarker.template.Template;import java.io.StringWriter;
import java.util.Map;public class TemplateUtils {private static final Configuration freemarkerConfig;// 靜態初始化 FreeMarker 配置static {freemarkerConfig = new Configuration(Configuration.VERSION_2_3_31);freemarkerConfig.setClassForTemplateLoading(TemplateUtils.class, "/templates");freemarkerConfig.setDefaultEncoding("UTF-8");}/*** 使用 FreeMarker 渲染模板** @param templateName 模板文件名(如 "alert.ftl")* @param data         數據模型(鍵值對)* @return 渲染后的字符串*/public static String renderTemplate(String templateName, Map<String, Object> data) {try {// 加載模板Template template = freemarkerConfig.getTemplate(templateName);// 渲染模板StringWriter writer = new StringWriter();template.process(data, writer);return writer.toString();} catch (Exception e) {throw new RuntimeException("模板渲染失敗", e);}}
}public class WeComBot {private static final String WEBHOOK_URL = "https://qyapi.weixin.qq.com/cgi-binbbfc-4412c60ad031";/*** 發送消息到企業微信機器人** @param message 消息內容* @throws Exception 如果發送失敗*/public static void sendToWeComBot(String message) throws Exception {// 構造 JSON 數據String jsonPayload = JSONUtil.createObj().put("msgtype", "markdown").put("markdown", JSONUtil.createObj().put("content", message)).toString();// 發送 HTTP POST 請求HttpResponse response = HttpRequest.post(WEBHOOK_URL).header("Content-Type", "application/json; utf-8") // 設置請求頭.body(jsonPayload) // 設置請求體.timeout(5000) // 設置超時時間為 5 秒(單位:毫秒).execute(); // 執行請求// 檢查響應狀態碼if (response.getStatus() != 200) {throw new RuntimeException("Failed to send message: HTTP error code " + response.getStatus());}}
}


? alertmanager:
? ? image: prom/alertmanager:v0.26.0
? ? environment:
? ? ? - TZ=Asia/Shanghai
? ? container_name: alertmanager
? ? volumes:
? ? ? - ./alertmanager.yml:/etc/alertmanager/alertmanager.yml
? ? ? - ./alertmanager/templates:/etc/alertmanager/templates
? ? ? - ./alertmanager/data:/alertmanager
? ? command:
? ? ? - "--config.file=/etc/alertmanager/alertmanager.yml"
? ? ? - "--storage.path=/alertmanager"
? ? ? - "--log.level=info" ? ? ? ? ? ? # 設置日志級別(可選)
? ? ports:
? ? ? - "9093:9093"
? ? ? - "9094:9094"
? ? restart: always


docker-prometheus.yamlversion: '3.8'services:prometheus:image: bitnami/prometheus:3.0.0container_name: prometheushostname: prometheusports:- "9090:9090" # Prometheus Web UI 端口volumes:- ./prometheus.yml:/etc/prometheus/prometheus.yml- ./prometheus-data:/prometheus- ./rules:/rulescommand:- '--config.file=/etc/prometheus/prometheus.yml'- '--web.external-url=http://192.168.118.20:9090/'- '--web.enable-lifecycle'- '--storage.tsdb.retention.time=90d'- "--storage.tsdb.path=/prometheus"- "--web.enable-admin-api"restart: alwaysalertmanager:image: prom/alertmanager:v0.26.0environment:- TZ=Asia/Shanghaicontainer_name: alertmanagervolumes:- ./alertmanager.yml:/etc/alertmanager/alertmanager.yml- ./alertmanager/templates:/etc/alertmanager/templates- ./alertmanager/data:/alertmanagercommand:- "--config.file=/etc/alertmanager/alertmanager.yml"- "--storage.path=/alertmanager"- "--log.level=info"             # 設置日志級別(可選)ports:- "9093:9093"- "9094:9094"restart: alwaysgrafana:image: grafana/grafana:11.3.3container_name: grafanahostname: grafanaports:- "3000:3000" # Grafana Web UI 端口environment:GF_SECURITY_ADMIN_PASSWORD: admin # 設置 Grafana 的管理員密碼volumes:- ./grafana-storage:/var/lib/grafanarestart: alwaysnode-exporter:image: bitnami/node-exporter:1.8.1container_name: node-exporterrestart: unless-stoppedports:- "9100:9100"volumes:- /proc:/host/proc:ro- /sys:/host/sys:ro- /:/rootfs:roenvironment:IGNORE_MOUNT_POINTS: "^/(sys|proc|dev|host|etc)($$|/)"IGNORE_FS_TYPES: "^(sys|proc|auto)fs$$"command:- '--path.procfs=/host/proc'- '--path.sysfs=/host/sys'- '--path.rootfs=/rootfs'  # 修復了未閉合的引號- '--collector.filesystem.ignored-mount-points=${IGNORE_MOUNT_POINTS}'- '--collector.filesystem.ignored-fs-types=${IGNORE_FS_TYPES}'  # 修復了無效的 #{}


alertmanager.ymlglobal:resolve_timeout: 5m #表示如果告警在 5 分鐘內沒有被解決,則認為該告警已恢復route:receiver: 'default'group_by: ['instance'] #通過alertname(告警名稱)的值對告警進行分類 ;按照實例(instance)對告警進行分組group_wait: 10s  #表示第一次觸發告警時會等待 10 秒后再發送通group_interval: 20s #表示兩次告警之間的最小間隔為 20 秒; 同一組內兩次告警之間的最小間隔為 20 秒repeat_interval: 1m #如果告警持續存在,每隔 1 分鐘重復發送一次通知routes:- receiver: "hook"  #webhook通知group_wait: 10s#match:# service: "test"#severity: "critical"# match_re:#   service: "pods|critical"#   severity: "warning"# matchers:#   - service =~ "test|pods|critical"#   - severity =~ "critical|warning"- receiver: "hook1"  #郵件通知group_wait: 25s#matchers:# - severity =~ "critical|warning|info"receivers:
- name: 'hook'webhook_configs:- url: 'http://192.168.118.47:7998/alert'- name: "hook1"webhook_configs:- url: 'https://xe88-864e-8a9e7c476a18'send_resolved: true #通知已經恢復的告警- name: "default"webhook_configs:- url: 'https://x4af1-bbfc-4412c60ad031'send_resolved: true #通知已經恢復的告警- name: 'wechat'webhook_configs:- url: 'https://x-bbfc-4412c60ad031'send_resolved: trueinhibit_rules: #抑制的規則
- source_match:severity: 'critical'target_match:severity: 'warning'equal: ['alertname', 'dev', 'instance']


alerting:
? alertmanagers:
? ? - static_configs:
? ? ? ? - targets:
? ? ? ? ? ? - 192.168.118.20:9093


rule_files:
? - "/rules/*_rules.yaml"

prometheus.ymlglobal:scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.# scrape_timeout is set to the global default (10s).# Alertmanager configuration
alerting:alertmanagers:- static_configs:- targets:- 192.168.118.20:9093rule_files:- "/rules/*_rules.yaml"scrape_configs:- job_name: 'kafka'static_configs:- targets:- '192.168.118.20:9101' # 對應 kafka1 的 JMX Exporter 端口- '192.168.118.20:9102' # 對應 kafka2 的 JMX Exporter 端口- '192.168.118.20:9103' # 對應 kafka3 的 JMX Exporter 端口- job_name: "node"static_configs:- targets: ["192.168.118.20:9100"]- job_name: 'prometheus'metrics_path: /actuator/prometheusstatic_configs:- targets: ['192.168.118.47:7998']- job_name: 'prometheus1'metrics_path: /actuator/prometheusstatic_configs:- targets: ['192.168.118.148:7998']

customer_rules.yamlgroups:- name: node-alertrules:- alert: NodeDownexpr: up == 0for: 5mlabels:severity: criticalinstance: "{{ $labels.instance }}"annotations:summary: "instance: {{ $labels.instance }} down"description: "Instance: {{ $labels.instance }} 已經宕機 5分鐘"value: "{{ $value }}"- alert: NodeCpuHighexpr: (1 - avg by (instance) (irate(node_cpu_seconds_total{mode="idle"}[5m]))) * 100 > 10for: 10slabels:severity: warninginstance: "{{ $labels.instance }}"annotations:summary: "instance: {{ $labels.instance }} cpu使用率過高"description: "CPU 使用率超過 80%"value: "{{ $value }}"- alert: NodeCpuIowaitHighexpr: avg by (instance) (irate(node_cpu_seconds_total{mode="iowait"}[5m])) * 100 > 80for: 5mlabels:severity: warninginstance: "{{ $labels.instance }}"annotations:summary: "instance: {{ $labels.instance }} cpu iowait 使用率過高"description: "CPU iowait 使用率超過 50%"value: "{{ $value }}"- alert: NodeLoad5Highexpr: node_load5 > (count by (instance) (node_cpu_seconds_total{mode='system'})) * 1.2for: 5mlabels:severity: warninginstance: "{{ $labels.instance }}"annotations:summary: "instance: {{ $labels.instance }} load(5m) 過高"description: "Load(5m) 過高,超出cpu核數 1.2倍"value: "{{ $value }}"- alert: NodeMemoryHighexpr: (1 - node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes) * 100 > 10for: 10slabels:severity: warninginstance: "{{ $labels.instance }}"annotations:summary: "instance: {{ $labels.instance }} memory 使用率過高"description: "Memory 使用率超過 10%"value: "{{ $value }}"- alert: NodeDiskRootHighexpr: (1 - node_filesystem_avail_bytes{fstype=~"ext.*|xfs",mountpoint ="/"} / node_filesystem_size_bytes{fstype=~"ext.*|xfs",mountpoint ="/"}) * 100 > 50for: 1mlabels:severity: warninginstance: "{{ $labels.instance }}"annotations:summary: "instance: {{ $labels.instance }} disk(/ 分區) 使用率過高"description: "Disk(/ 分區) 使用率超過 50%"value: "{{ $value }}"- alert: NodeDiskBootHighexpr: (1 - node_filesystem_avail_bytes{fstype=~"ext.*|xfs",mountpoint ="/boot"} / node_filesystem_size_bytes{fstype=~"ext.*|xfs",mountpoint ="/boot"}) * 100 > 50for: 10slabels:severity: warninginstance: "{{ $labels.instance }}"annotations:summary: "instance: {{ $labels.instance }} disk(/boot 分區) 使用率過高"description: "Disk(/boot 分區) 使用率超過 50%"value: "{{ $value }}"- alert: NodeDiskReadHighexpr: irate(node_disk_read_bytes_total[5m]) > 20 * (1024 ^ 2)for: 5mlabels:severity: warninginstance: "{{ $labels.instance }}"annotations:summary: "instance: {{ $labels.instance }} disk 讀取字節數 速率過高"description: "Disk 讀取字節數 速率超過 20 MB/s"value: "{{ $value }}"- alert: NodeDiskWriteHighexpr: irate(node_disk_written_bytes_total[5m]) > 20 * (1024 ^ 2)for: 5mlabels:severity: warninginstance: "{{ $labels.instance }}"annotations:summary: "instance: {{ $labels.instance }} disk 寫入字節數 速率過高"description: "Disk 寫入字節數 速率超過 20 MB/s"value: "{{ $value }}"- alert: NodeDiskReadRateCountHighexpr: irate(node_disk_reads_completed_total[5m]) > 3000for: 5mlabels:severity: warninginstance: "{{ $labels.instance }}"annotations:summary: "instance: {{ $labels.instance }} disk iops 每秒讀取速率過高"description: "Disk iops 每秒讀取速率超過 3000 iops"value: "{{ $value }}"- alert: NodeDiskWriteRateCountHighexpr: irate(node_disk_writes_completed_total[5m]) > 3000for: 5mlabels:severity: warninginstance: "{{ $labels.instance }}"annotations:summary: "instance: {{ $labels.instance }} disk iops 每秒寫入速率過高"description: "Disk iops 每秒寫入速率超過 3000 iops"value: "{{ $value }}"- alert: NodeInodeRootUsedPercentHighexpr: (1 - node_filesystem_files_free{fstype=~"ext4|xfs",mountpoint="/"} / node_filesystem_files{fstype=~"ext4|xfs",mountpoint="/"}) * 100 > 80for: 10mlabels:severity: warninginstance: "{{ $labels.instance }}"annotations:summary: "instance: {{ $labels.instance }} disk(/ 分區) inode 使用率過高"description: "Disk (/ 分區) inode 使用率超過 80%"value: "{{ $value }}"- alert: NodeInodeBootUsedPercentHighexpr: (1 - node_filesystem_files_free{fstype=~"ext4|xfs",mountpoint="/boot"} / node_filesystem_files{fstype=~"ext4|xfs",mountpoint="/boot"}) * 100 > 80for: 10mlabels:severity: warninginstance: "{{ $labels.instance }}"annotations:summary: "instance: {{ $labels.instance }} disk(/boot 分區) inode 使用率過高"description: "Disk (/boot 分區) inode 使用率超過 80%"value: "{{ $value }}"- alert: NodeFilefdAllocatedPercentHighexpr: node_filefd_allocated / node_filefd_maximum * 100 > 80for: 10mlabels:severity: warninginstance: "{{ $labels.instance }}"annotations:summary: "instance: {{ $labels.instance }} filefd 打開百分比過高"description: "Filefd 打開百分比 超過 80%"value: "{{ $value }}"- alert: NodeNetworkNetinBitRateHighexpr: avg by (instance) (irate(node_network_receive_bytes_total{device=~"eth0|eth1|ens33|ens37"}[1m]) * 8) > 20 * (1024 ^ 2) * 8for: 3mlabels:severity: warninginstance: "{{ $labels.instance }}"annotations:summary: "instance: {{ $labels.instance }} network 接收比特數 速率過高"description: "Network 接收比特數 速率超過 20MB/s"value: "{{ $value }}"- alert: NodeNetworkNetoutBitRateHighexpr: avg by (instance) (irate(node_network_transmit_bytes_total{device=~"eth0|eth1|ens33|ens37"}[1m]) * 8) > 20 * (1024 ^ 2) * 8for: 3mlabels:severity: warninginstance: "{{ $labels.instance }}"annotations:summary: "instance: {{ $labels.instance }} network 發送比特數 速率過高"description: "Network 發送比特數 速率超過 20MB/s"value: "{{ $value }}"- alert: NodeNetworkNetinPacketErrorRateHighexpr: avg by (instance) (irate(node_network_receive_errs_total{device=~"eth0|eth1|ens33|ens37"}[1m])) > 15for: 3mlabels:severity: warninginstance: "{{ $labels.instance }}"annotations:summary: "instance: {{ $labels.instance }} 接收錯誤包 速率過高"description: "Network 接收錯誤包 速率超過 15個/秒"value: "{{ $value }}"- alert: NodeNetworkNetoutPacketErrorRateHighexpr: avg by (instance) (irate(node_network_transmit_packets_total{device=~"eth0|eth1|ens33|ens37"}[1m])) > 15for: 3mlabels:severity: warninginstance: "{{ $labels.instance }}"annotations:summary: "instance: {{ $labels.instance }} 發送錯誤包 速率過高"description: "Network 發送錯誤包 速率超過 15個/秒"value: "{{ $value }}"- alert: NodeProcessBlockedHighexpr: node_procs_blocked{job="node"} > 10for: 10mlabels:severity: warninginstance: "{{ $labels.instance }}"annotations:summary: "instance: {{ $labels.instance }} 當前被阻塞的任務的數量過多"description: "Process 當前被阻塞的任務的數量超過 10個"value: "{{ $value }}"- alert: NodeTimeOffsetHighexpr: abs(node_timex_offset_seconds{job="node"}) > 3 * 60for: 2mlabels:severity: infoinstance: "{{ $labels.instance }}"annotations:summary: "instance: {{ $labels.instance }} 時間偏差過大"description: "Time 節點的時間偏差超過 3m"value: "{{ $value }}"

?

?


https://segmentfault.com/a/1190000043690204

prometheus結合consul+confd實現動態注冊服務和動態更新配置告警規則_prometheus confd-CSDN博客





如若想動態修改下面規則內容;? ?可采用以下方案;
rule_files:
? # - "first_rules.yml"
? # - "second_rules.yml"
? - "/rules/*_rules.yaml"
?

# Download the binary
wget https://github.com/kelseyhightower/confd/releases/download/v0.16.0/confd-0.16.0-linux-amd64
?
# 重命名二進制文件,并移動到PATH的目錄下
mv confd-0.16.0-linux-amd64 /usr/local/bin/confd
chmod +x /usr/local/bin/confd
?
# 驗證是否安裝成功
confd --help

sudo mkdir -p /etc/confd/{conf.d,templates,rules}


本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/web/76279.shtml
繁體地址,請注明出處:http://hk.pswp.cn/web/76279.shtml
英文地址,請注明出處:http://en.pswp.cn/web/76279.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

數據庫勒索病毒威脅升級:企業數據安全防線如何用安當RDM組件重構

摘要&#xff1a;2025年Q1全球數據庫勒索攻擊量同比激增101.8%&#xff0c;Cl0p、Akira等團伙通過邊緣設備漏洞滲透企業核心系統&#xff0c;制造業、金融業等關鍵領域面臨數據加密與業務停擺雙重危機。本文深度解析勒索病毒對數據庫的五大毀滅性影響&#xff0c;結合安當RDM防…

thanos sidecar和receive區別?

Thanos Sidecar 和 Thanos Receive 是 Thanos 生態系統中兩個關鍵組件&#xff0c;但它們在架構中的作用和功能上有明顯的區別。以下是它們的主要區別&#xff1a; 1. Thanos Sidecar 功能&#xff1a; 與 Prometheus 集成&#xff1a; Sidecar 是一個部署在每個 Prometheus…

Unity入門筆記(緣更)

內容來源SiKi學院的Luna’s Fantasy 文章目錄 一、基礎知識1.準備2.基礎知識1.層級(Layer)2.軸心點3.預制體(Prefab)4.剛體組件(Rigidbody)5.碰撞器組件(BoxCollider) 二、代碼1.移動 一、基礎知識 1.準備 Unity安裝&#xff1a; https://unity.cn 2.基礎知識 1.層級(Layer…

使用VHD虛擬磁盤安裝雙系統,避免磁盤分區

前言 很多時候&#xff0c;我們對現在的操作系統不滿意,就想要自己安裝一個雙系統 但是安裝雙系統又涉及到硬盤分區,非常復雜,容易造成數據問題 虛擬機的話有經常用的不爽,這里其實有一個介于虛擬機和雙系統之間的解決方法,就是使用虛擬硬盤文件安裝系統. 相當于系統在機上…

ARINC818協議(五)

1.R_CTL,設置固定的0x44即可 2.Dest_ID:目的地D_ID,如果不需要目的地址&#xff0c;就設置為0&#xff1b;ADVB協議支持 多個視頻目的地址&#xff0c;廣播通信; 3.cs_ctl在FC-AV上不用 4.source_ID:S_ID [23:0]包含源實體的端口的地址標識&#xff1b;不用就設置為0. ADVB允許…

鴻蒙開發對于RelativeContainer高度設置‘auto‘后還是沒有自適應問題的解決方案

RelativeContainer設置高度為自適應‘auto’沒用生效&#xff0c;查看了官方文檔(文檔中心)也沒用給出明確的答案。只說了不能把錨點設置成父組件錨點&#xff08;__container__&#xff09;。也嘗試了使用guidline來替換父組件錨點&#xff0c;還是沒能自適應高度。 后來嘗試讓…

k8s教程3:Kubernetes應用的部署和管理

學習目標 理解Kubernetes中應用部署的基本概念和方法掌握Deployment、ReplicaSet、StatefulSet、DaemonSet、Job與CronJob等控制器的使用了解Helm作為Kubernetes的包管理工具的基本使用通過實際示例學習應用的部署、更新與管理 Kubernetes提供了一套強大而靈活的機制&#xff…

通過特定協議拉起 electron 應用

在 Android 通過 sheme 協議可以拉起其他應用。 electron 應用也可以通過類似特定協議被拉起。 在同時有 web、客戶端的應用里&#xff0c;可以通過這種方式在 web 拉起客戶端。 支持拉起客戶端 const PROTOCOL xxxif (process.defaultApp) {// 這里是開發環境&#xff0c;有…

算法備案的審核標準是什么?

隨著《互聯網信息服務算法推薦管理規定》等法規的出臺&#xff0c;算法備案成為了強制性備案&#xff0c;是產品合規上線的必要條件之一。本篇內容將從企業視角出發&#xff0c;分析算法備案的常見問題&#xff0c;意在對有備案需求的小伙伴們有所幫助。 一、誰需要做算法備案…

回顧與動機 - 為什么我們需要 Transformer

在接下來的旅程中,我們將一起探索深度學習領域最重要、最具影響力的模型架構之一——Transformer。從它的基本原理出發,逐步深入,最終能夠親手實現一個文本生成模型。 本系列教程假設你已經具備一定的深度學習基礎,了解神經網絡、損失函數、優化器等基本概念,并且熟悉 Py…

探索 Higress:下一代云原生 API 網關

引言 在云原生時代&#xff0c;API 網關作為連接客戶端與后端服務的橋梁&#xff0c;扮演著至關重要的角色。Higress 是一款由阿里巴巴開發的先進云原生 API 網關&#xff0c;基于開源的 Istio 和 Envoy 構建。它通過將流量網關、微服務網關和安全網關三者高度集成&#xff0c…

Spring Boot 整合 DeepSeek 實現AI對話 (保姆及教程)

文章目錄 文章目錄 前言 一、創建 spring boot 工程 二、申請key 三、修改配置文件 application.properties 四、編寫控制器&#xff08;controller&#xff09; 五、運行調試 前言 提示&#xff1a;隨著人工智能的不斷發展&#xff0c;ai這門技術也越來越重要&#xff0c;很多…

前端資源加載失敗后重試加載(CSS,JS等引用資源)

前端資源加載失敗后的重試 .前端引用資源時出現了資源加載失敗(這里針對的是路徑引用異常或者url解析錯誤時) 解決這個問題首先要明確一下幾個步驟 1.什么情況或者什么時候重試 2.如何重試 3.重試過程中的邊界處理 這里引入里三個測試腳本&#xff0c;分別加載里三個不同的腳…

無刷電機槽數相同、轉子極數不同的核心區別

一、基礎原理差異 無刷電機的核心參數: 槽數(定子槽數,記為 ( Z )):定子鐵芯上的繞組槽數量,決定繞組布局。極數(轉子磁極數,記為 ( 2p )):轉子上的永磁體磁極對數(總極數為 ( 2p ),如 ( p=4 ) 表示 8 極)。核心關系:槽極配合(( Z/2p ))決定電機電磁結構,相同…

6.Rust+Axum:打造高效 WebSocket 實時通信聊天室

摘要 本文詳細介紹 RustAxum 在 WebSocket 實時通信開發中的應用&#xff0c;包括雙向通信、狀態管理等&#xff0c;實踐構建聊天室應用。 一、引言 在當今的 Web 應用開發中&#xff0c;實時通信變得越來越重要。WebSocket 作為一種在單個 TCP 連接上進行全雙工通信的協議&…

clickhouse數據導出導入

clickhouse數據導出導入 CSV格式導出為csv格式導入為csv格式 JSON格式導出為json格式導入為json格式 SQL格式導出為SQL CSV格式 導出為csv格式 # 不帶表頭 clickhouse-client -h 127.0.0.1 --database"db" --query"select * from db.test_table FORMAT CSV&qu…

人臉掃描黑科技:多相機人臉掃描設備,打造你的專屬數字分身

隨著科技的迅猛發展&#xff0c;人臉掃描這個詞已經并不陌生&#xff0c;通過人臉掃描設備制作超寫實人臉可以為影視制作打造逼真角色、提升游戲沉浸感&#xff0c;還能助力教育機構等領域生產數字人以豐富教學資源&#xff0c;還在安防、身份識別等領域發揮關鍵作用&#xff0…

學習型組織與系統思考

真正的學習型組織不是只關注個人的學習&#xff0c;而是關注整個系統的學習。—彼得圣吉 在這兩年里&#xff0c;越來越多的企業開始詢問是否可以將系統思考的內容內化給自己的內訓師&#xff0c;進而在公司內部進行教學。我非常理解企業這樣做的動機&#xff0c;畢竟內部講師…

gl-matrix 庫簡介

gl-matrix 庫簡介 gl-matrix 是一個高性能的 JavaScript 矩陣和向量庫&#xff0c;專門為 WebGL 和其他 3D 圖形應用設計。它提供了處理 2D、3D 和 4D 向量以及矩陣運算的高效方法。 主要特性 高性能&#xff1a;經過高度優化&#xff0c;執行速度快輕量級&#xff1a;體積小…

大語言模型的訓練、微調及壓縮技術

The rock can talk — not interesting. The rock can read — that’s interesting. &#xff08;石頭能說話&#xff0c;不稀奇。稀奇的是石頭能讀懂。&#xff09; ----硅谷知名創業孵化器 YC 的總裁 Gar Tan 目錄 1. 什么是大語言模型&#xff1f; 2. 語言建模&#xff…