当前位置: 首页 > news >正文

ES集群搭建及工具类

文章说明

本文主要记录Windows下搭建ES集群的过程,并提供了一个通用的ES工具类;工具类采用http接口调用es功能,目前仅提供了简单的查询功能,可在基础上额外扩展

集群搭建

ES的下载安装非常简单,只需要下载软件的 zip 压缩包,然后解压即用;本文演示采用的是 ES9.0 版本

下载地址:ES下载

下载之后默认是开启ssl的,可以关掉,然后直接启动即可获得单机版

ES常用接口

创建索引

URL:http://localhost:9201/log_2025.04.29

请求类型:PUT

请求体

{"mappings": {"properties": {"@timestamp": { "type": "date","format": "yyyy-MM-dd'T'HH:mm:ss.SSSZ||yyyy-MM-dd HH:mm:ss.SSS||strict_date_optional_time||epoch_millis"},"timestamp": {"type": "date","format": "yyyy-MM-dd HH:mm:ss.SSS||strict_date_optional_time||epoch_millis"},"startTime": {"type": "date","format": "yyyy-MM-dd HH:mm:ss.SSS||strict_date_optional_time||epoch_millis"},"endTime": {"type": "date","format": "yyyy-MM-dd HH:mm:ss.SSS||strict_date_optional_time||epoch_millis"},"message": { "type": "text" },"level": { "type": "keyword" },"serviceName": { "type": "keyword" },"appName": { "type": "keyword" },"eventId": { "type": "keyword" },"globalId": { "type": "keyword" },"elapsed": { "type": "long" },"currentIP": { "type": "keyword" },"accessIp": { "type": "keyword" },"nodeName": { "type": "keyword" },"path": { "type": "keyword" },"reqParam": { "type": "keyword" },"resParam": { "type": "keyword" },"parentEventId": { "type": "keyword" },"PtxId": { "type": "keyword" },"source": { "type": "keyword" },"offset": { "type": "long" },"beat": {"properties": {"hostname": { "type": "keyword" },"name": { "type": "keyword" },"version": { "type": "keyword" }}},"host": {"properties": {"name": { "type": "keyword" }}},"log": {"properties": {"file": {"properties": {"path": { "type": "keyword" }}}}}}}
}

查询索引

URL:http://localhost:9200/log_2025.04.23

请求类型:GET

删除索引

URL:http://localhost:9200/log_2025.04.23

请求类型:DELETE

添加数据

URL:http://localhost:9200/_bulk

请求类型:POST

请求体(需要末尾多一行)

{"index":{"_index":"log_2025.04.29"}}
{"这里放请求数据"}

查询数据

URL:http://localhost:9200/log_2025.04.29/_search

请求类型:POST

请求体

{"size": 20,"query": {"bool": {"must": [{"match": {"appName": "a"}},{"match": {"eventId": "1"}},{"range": {"timestamp": {"format": "yyyy-MM-dd HH:mm:ss.SSS","gte": "2025-04-27 15:04:18.104","lte": "2025-04-27 15:09:18.104"}}}]}},"sort": [{"timestamp": {"order": "asc"}}]
}

ES的集群搭建

ES的使用其实并不复杂,ES的集群搭建相对也比较简单;额外说明,ES集群会进行数据同步,集群搭建完成后访问集群中任一存活节点可以正常获取到所有节点的数据

配置文件

这里以搭建3个节点的集群为例

node-1

# Cluster name
cluster.name: my-cluster# Node name
node.name: node-1  # 修改为 node-2 或 node-3 在其他节点上# Paths
path.data: /path/to/data/node-1
path.logs: /path/to/logs/node-1# Network
network.host: 0.0.0.0
http.port: 9200
transport.port: 9300# Discovery
discovery.seed_hosts: ["127.0.0.1:9300", "127.0.0.1:9301", "127.0.0.1:9302"]cluster.initial_master_nodes: ["node-1", "node-2", "node-3"]# Security (可选)
xpack.security.enabled: false
xpack.security.transport.ssl.enabled: false
xpack.security.http.ssl.enabled: false

node-2

# Cluster name
cluster.name: my-cluster# Node name
node.name: node-2  # 修改为 node-2 或 node-3 在其他节点上# Paths
path.data: /path/to/data/node-2
path.logs: /path/to/logs/node-2# Network
network.host: 0.0.0.0
http.port: 9201
transport.port: 9301# Discovery
discovery.seed_hosts: ["127.0.0.1:9300", "127.0.0.1:9301", "127.0.0.1:9302"]cluster.initial_master_nodes: ["node-1", "node-2", "node-3"]# Security (可选)
xpack.security.enabled: false
xpack.security.transport.ssl.enabled: false
xpack.security.http.ssl.enabled: false

node-3

# Cluster name
cluster.name: my-cluster# Node name
node.name: node-3  # 修改为 node-2 或 node-3 在其他节点上# Paths
path.data: /path/to/data/node-3
path.logs: /path/to/logs/node-3# Network
network.host: 0.0.0.0
http.port: 9202
transport.port: 9302# Discovery
discovery.seed_hosts: ["127.0.0.1:9300", "127.0.0.1:9301", "127.0.0.1:9302"]cluster.initial_master_nodes: ["node-1", "node-2", "node-3"]# Security (可选)
xpack.security.enabled: false
xpack.security.transport.ssl.enabled: false
xpack.security.http.ssl.enabled: false

集群配置完成后逐个启动即可;这里我采用的是将压缩包解压三份,然后分别放在不同的目录下

启动完成后,集群搭建成功,此时可以正常访问

工具类

ESConfig.java 配置类,支持配置多个ip:port,采用英文逗号分隔

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;import java.util.ArrayList;
import java.util.List;@Component
@RefreshScope
@Data
public class ESConfig {@Value("${elasticsearch.host:127.0.0.1:9200}")private String hosts;@Value("${elasticsearch.scheme:http}")private String scheme;@Value("${elasticsearch.username:elastic}")private String username;@Value("${elasticsearch.password:}")private String password;public List<String> getHostList() {List<String> hostList = new ArrayList<>();if (hosts != null && !hosts.isEmpty()) {String[] hostArray = hosts.split(",");for (String host : hostArray) {String trimmedHost = host.trim();if (!trimmedHost.isEmpty()) {hostList.add(trimmedHost);}}}return hostList;}public String getScheme() {return scheme;}public String getUsername() {return username;}public String getPassword() {return password;}
}

ESHttpUtil.java 查询工具类

import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.http.HttpEntity;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.stereotype.Component;import javax.annotation.Resource;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;@Component
public class ESHttpUtil {private static final ObjectMapper MAPPER = new ObjectMapper();// 添加新的查询方法public ESResponse queryLogsAsObject(String indexName, String queryJson) throws IOException {String result = queryLogs(indexName, queryJson);return MAPPER.readValue(result, ESResponse.class);}@Resourceprivate ESConfig esConfig;public String queryLogs(String indexName, String queryJson) throws IOException {List<String> hostList = esConfig.getHostList();if (hostList == null || hostList.isEmpty()) {throw new RuntimeException("当前未配置ES服务节点.");}for (String host : hostList) {try {return executeQuery(host, indexName, queryJson);} catch (IOException e) {// 如果当前节点不可用,记录日志并继续尝试下一个节点System.err.println("无法连接到ES节点: " + host + ". 正在尝试下一节点...");}}// 如果所有节点都不可用,抛出异常throw new IOException("所有节点均无法连接.");}private String executeQuery(String host, String indexName, String queryJson) throws IOException {String[] split = host.split(":");if (split.length != 2) {throw new IOException("ES服务节点host配置异常: " + host);}String url = String.format("%s://%s:%d/%s/_search",esConfig.getScheme(),split[0],Integer.parseInt(split[1]),indexName);CredentialsProvider credentialsProvider = new BasicCredentialsProvider();credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(esConfig.getUsername(), esConfig.getPassword()));try (CloseableHttpClient httpClient = HttpClients.custom().setDefaultCredentialsProvider(credentialsProvider).build()) {HttpPost httpPost = new HttpPost(url);httpPost.setEntity(new StringEntity(queryJson, ContentType.APPLICATION_JSON));try (CloseableHttpResponse response = httpClient.execute(httpPost)) {HttpEntity entity = response.getEntity();if (entity != null) {return EntityUtils.toString(entity);} else {throw new IOException("ES节点服务异常: " + host);}}}}public static class ESQueryBuilder {private final List<Map<String, Object>> mustConditions = new ArrayList<>();private final List<Map<String, Object>> shouldConditions = new ArrayList<>();private final List<Map<String, Object>> mustNotConditions = new ArrayList<>();private Integer from;private Integer size;private List<Map<String, Object>> sort;public ESQueryBuilder matchEqual(String field, Object value) {if (value != null) {Map<String, Object> matchQuery = new HashMap<>();Map<String, Object> match = new HashMap<>();match.put(field, value);matchQuery.put("match", match);mustConditions.add(matchQuery);}return this;}public ESQueryBuilder dateRange(String field, String startTime, String endTime) {if (startTime != null || endTime != null) {Map<String, Object> rangeQuery = new HashMap<>();Map<String, Object> range = new HashMap<>();Map<String, Object> timestamp = new HashMap<>();timestamp.put("format", "yyyy-MM-dd HH:mm:ss.SSS");if (startTime != null) {timestamp.put("gte", startTime);}if (endTime != null) {timestamp.put("lte", endTime);}range.put(field, timestamp);rangeQuery.put("range", range);mustConditions.add(rangeQuery);}return this;}public ESQueryBuilder from(int from) {this.from = from;return this;}public ESQueryBuilder size(int size) {this.size = size;return this;}public ESQueryBuilder addSort(String field, String order) {if (sort == null) {sort = new ArrayList<>();}Map<String, Object> sortItem = new HashMap<>();Map<String, Object> sortField = new HashMap<>();sortField.put("order", order.toLowerCase());sortItem.put(field, sortField);sort.add(sortItem);return this;}public ESQueryBuilder should(Map<String, Object> condition) {if (condition != null) {shouldConditions.add(condition);}return this;}public String build() {Map<String, Object> root = new HashMap<>();Map<String, Object> query = new HashMap<>();Map<String, Object> bool = new HashMap<>();if (!mustConditions.isEmpty()) {bool.put("must", mustConditions);}if (!shouldConditions.isEmpty()) {bool.put("should", shouldConditions);}if (!mustNotConditions.isEmpty()) {bool.put("must_not", mustNotConditions);}query.put("bool", bool);root.put("query", query);if (size != null) {root.put("size", size);}if (sort != null && !sort.isEmpty()) {root.put("sort", sort);}try {return MAPPER.writeValueAsString(root);} catch (Exception e) {throw new RuntimeException("构建查询JSON失败", e);}}}
}

ESResponse.java 响应实体

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;import java.util.List;@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class ESResponse {private int took;@JsonProperty("timed_out")private boolean timedOut;@JsonProperty("_shards")private Shards shards;private Hits hits;@Data@JsonIgnoreProperties(ignoreUnknown = true)public static class Shards {private int total;private int successful;private int skipped;private int failed;}@Data@JsonIgnoreProperties(ignoreUnknown = true)public static class Hits {private Total total;@JsonProperty("max_score")private String maxScore;private List<Hit> hits;}@Data@JsonIgnoreProperties(ignoreUnknown = true)public static class Total {private int value;private String relation;}@Data@JsonIgnoreProperties(ignoreUnknown = true)public static class Hit {@JsonProperty("_index")private String index;@JsonProperty("_id")private String id;@JsonProperty("_score")private String score;@JsonProperty("_source")private LogData source;}@Data@JsonIgnoreProperties(ignoreUnknown = true)public static class LogData {private String timestamp;private String path;private String parentEventId;private String eventId;private String serviceName;private String appName;private String nodeName;private String startTime;private String endTime;private String elapsed;private String reqParam;private String resParam;private String globalId;private String level;private String message;}
}

相关文章:

ES集群搭建及工具类

文章说明 本文主要记录Windows下搭建ES集群的过程&#xff0c;并提供了一个通用的ES工具类&#xff1b;工具类采用http接口调用es功能&#xff0c;目前仅提供了简单的查询功能&#xff0c;可在基础上额外扩展 集群搭建 ES的下载安装非常简单&#xff0c;只需要下载软件的 zip 压…...

抓取工具Charles配置教程(mac电脑+ios手机)

mac电脑上的配置 1. 下载最新版本的Charles 2. 按照以下截图进行配置 2.1 端口号配置&#xff1a; 2.2 https配置 3. mac端证书配置 4. IOS手机端网络配置 4.1 先查看电脑上的配置 4.2 配置手机网络 连接和电脑同一个wifi&#xff0c;然后按照以下截图进行配置 5. 手机端证书…...

JavaScript 代码搜索框

1. 概述与需求分析 功能&#xff1a;在网页中实时搜索用户代码、关键字&#xff1b;展示匹配行、文件名&#xff1b;支持高亮、正则、模糊匹配。非功能&#xff1a;大文件集&#xff08;几十万行&#xff09;、高并发、响应 <100ms&#xff1b;支持增量索引和热更新。 2. …...

ESP32开发-作为TCP服务端接收数据

​​ESP32 ENC28J60 仅作为TCP服务端​​ &#xff08;电脑通过 ​​网络调试助手​​ 连接ESP32&#xff0c;实现双向通信&#xff09; ​​完整代码​​ #include <SPI.h> #include <EthernetENC.h> // 或 UIPEthernet.h// 网络配置 byte mac[] {0xDE, 0xAD…...

数智化招标采购系统针对供应商管理解决方案(采购如何管控供应商)

随着《优化营商环境条例》深化实施&#xff0c;采购领域正通过政策驱动和技术赋能&#xff0c;全面构建供应商全生命周期管理体系&#xff0c;以规范化、数智化推动采购生态向透明、高效、智能方向持续升级。 郑州信源数智化招标采购系统研发商&#xff0c;通过供应商管理子系…...

服务端字符过滤 与 SQL PDO防注入

注入示例 # step 1 SQL SELECT * FROM users WHERE username admin AND password e10adc3949ba59abbe56e057f20f883e # step 2 SQL SELECT * FROM users WHERE username admin# AND password 96e79218965eb72c92a549dd5a330112 关键点是这2个SQL的区别.其中第二步由于前台传…...

章越科技赋能消防训练体征监测与安全保障,从传统模式到智能跃迁的实践探索

引言&#xff1a;智能化转型浪潮下&#xff0c;消防训练的“破局”之需 2021年《“十四五”国家消防工作规划》的出台&#xff0c;标志着我国消防救援体系正式迈入“全灾种、大应急”的全新阶段。面对地震、洪涝、危化品泄漏等复杂救援场景&#xff0c;消防员不仅需要更强的体…...

RSYSLOG收集深信服log

RSYSLOG收集深信服ATRUST日志配置一直不成功&#xff0c;没有生成log文件&#xff0c;网上搜索到&#xff1a;如果你想要接收所有来自特定 IP 的日志&#xff0c;可以使用更通用的模式&#xff1a; 参考着修改配置 if $fromhost-ip 172.18.1.13 then /data/logs/network-devi…...

Golang - 实现文件管理服务器

先看效果&#xff1a; 代码如下&#xff1a; package mainimport ("fmt""html/template""log""net/http""os""path/filepath""strings" )// 配置根目录&#xff08;根据需求修改&#xff09; //var ba…...

在原生代码(非webpack)里使用iview的注意事项

最近公司在做一个项目&#xff0c;使用的框架是iview,使用过程中同事遇到一些问题&#xff0c;这些问题对于有些同学来说根本就不是问题&#xff0c;但总会有同学需要&#xff0c;为了帮助不太会用的同学快速找到问题&#xff0c;做了如下整理&#xff1a; 下载vue,iview.min.j…...

基于go的简单管理系统(增删改查)

package mainimport ("database/sql""fmt"_ "github.com/go-sql-driver/mysql" )var db *sql.DBtype user struct {id intname stringage int }// 建立连接 func initDB() (err error) {dsn : "root:123456tcp(127.0.0.1:3306)/mysqltes…...

Python 用一等函数重新审视“命令”设计模式

引言 在软件开发中&#xff0c;设计模式是解决常见问题的有效方法。“命令”设计模式旨在解耦调用操作的对象&#xff08;调用者&#xff09;和提供实现的对象&#xff08;接收者&#xff09;。本文将深入探讨“命令”模式&#xff0c;并介绍如何使用一等函数对其进行简化。 …...

pycharm导入同目录下文件未标红但报错ModuleNotFoundError

此贴仅为记录debug过程&#xff0c;为防后续再次遇见 问题 问题情境 复现文章模型&#xff0c;pycharm项目初次运行 问题描述 在导入同目录下其它文件夹中的python文件时&#xff0c;未标红&#xff0c;但运行时报错ModuleNotFoundError 报错信息 未找到该模块 Traceback …...

BOSS的收入 - 华为OD机试(A卷,Java题解)

华为OD机试题库《C》限时优惠 9.9 华为OD机试题库《Python》限时优惠 9.9 华为OD机试题库《JavaScript》限时优惠 9.9 代码不懂有疑问欢迎留言或私我们的VX&#xff1a;code5bug。 题目描述 一个 XX 产品行销总公司&#xff0c;只有一个 boss&#xff0c;其有若干一级分销&…...

Qt:(创建项目)

目录 1. 使⽤QtCreator新建项⽬ 1.1 新建项⽬ 1.2 选择项⽬模板 1.3 选择项⽬路径 1.4 选择构建系统 1.5 填写类信息设置界⾯ ​编辑 1.6 选择语⾔和翻译⽂件 1.6 选择Qt套件 1.7 选择版本控制系统 1.8 最终效果 1. 使⽤QtCreator新建项⽬ 1.1 新建项⽬ 打开Qt…...

网络原理 - 12(HTTP/HTTPS - 3 - 响应)

目录 认识“状态码”&#xff08;status code&#xff09; 200 OK 404 Not Found 403 Forbidden 405 Method Not Allowed 500 Internal Server Error 504 Gateway Timeout 302 Move temporarily 301 Moved Permanently 418 I am a teaport 状态码小结&#xff1a; …...

OpenCV 4.7企业级开发实战:从图像处理到目标检测的全方位指南

简介 OpenCV作为工业级计算机视觉开发的核心工具库,其4.7版本在图像处理、视频分析和深度学习模型推理方面实现了显著优化。 本文将从零开始,系统讲解OpenCV 4.7的核心特性和功能更新,同时结合企业级应用场景,提供详细代码示例和实战项目,帮助读者掌握从基础图像处理到复…...

QT6 源(63)篇六:阅读与注释 QString 这个类,包含了 QString 类的 完整源码,也附上 QLatin1String 类的

&#xff08;9&#xff09;给出完整的源代码&#xff1a; #ifndef QSTRING_H #define QSTRING_H//验证了&#xff0c;没有此宏定义的 #if 不成立 #if defined(QT_NO_CAST_FROM_ASCII) && defined(QT_RESTRICTED_CAST_FROM_ASCII) #error QT_NO_CAST_FROM_ASCII a…...

PixONE 六维力传感器:赋能 OEM 机器人,12 自由度精准感知

The PixONE&#xff0c;一款为OEM设计的多模态12自由度机器人传感器&#xff0c;以其卓越的性能和广泛的适用性&#xff0c;正引领着机器人传感技术的革新。这款传感器不仅外观精致&#xff0c;达到IP68防护等级&#xff0c;易于消毒&#xff0c;而且其中心的大孔设计使得电缆和…...

nginx 解决跨域问题

本地用 8080 端口启动的服务访问后台API有跨域问题&#xff0c; from origin http://localhost:8080 has been blocked by CORS policy: Response to preflight request doesnt pass access control check: Redirect is not allowed for a preflight request. 其实用 9021 端…...

私有知识库 Coco AI 实战(五):打造 ES 新特性查询助手

有了实战&#xff08;四&#xff09;的经验&#xff0c;再打造个 ES 新特性查询助手就非常简单了。新的小助手使用的数据还是 ES 官方文档&#xff0c;模型设置也可沿用上次小助手的设置。 克隆小助手 我们进入 Coco Server 首页小助手菜单&#xff0c;选择“ES 索引参数查询…...

2025 新生 DL-FWI 培训

摘要: 本贴给出 8 次讨论式培训的提纲, 每次培训 1 小时. Basic concepts 1.1 Sesmic data processing – regular process 1.2 Full waveform inversion 1.3 Deep learning full waveform inversion Network structure 2.1 InversionNet Encoder-decorder structure 2.2 FCNV…...

VR汽车线束:汽车制造的新变革

汽车线束&#xff0c;作为汽车电路网络的主体&#xff0c;宛如汽车的 “神经网络”&#xff0c;承担着连接汽车各个部件、传输电力与信号的重任&#xff0c;对汽车的正常运行起着关键作用。从汽车的发动机到仪表盘&#xff0c;从传感器到各类电子设备&#xff0c;无一不是通过线…...

Centos离线安装Docker(无坑版)

1、下载并上传docker离线安装包 官方地址&#xff1a;安装包下载 2、上传到离线安装的服务器解压 tar -zxvf docker-28.1.1.tgz#拷贝解压二进制文件到相关目录 cp docker/* /usr/bin/ 3、创建docker启动文件 cat << EOF > /usr/lib/systemd/system/docker.servic…...

JConsole监控centos服务器中的springboot的服务

场景 在centos服务器中,有一个aa.jar的springboot服务,我想用JConsole监控它的JVM情况,具体怎么实现。 配置 Spring Boot 应用以启用 JMX 在java应用启动项进行配置 java -Djava.rmi.server.hostname=服务器IP -Dcom.sun.management.jmxremote=true \ -Dcom.sun.managem…...

centos 安装jenkins

centos 安装jenkins 在 CentOS 上安装 Jenkins 是一个相对直接的过程。以下是一个逐步指南&#xff0c;帮助你安装 Jenkins&#xff1a; 步骤 1&#xff1a;安装 Java Jenkins 需要 Java 运行环境&#xff0c;因此首先确保你的系统上安装了 Java。你可以使用以下命令来安装 …...

M1 Mac pip3 install错误记录

M芯片mac pip install 错误记录 环境 M3芯片MacPython3.13.1pip 24.3.1 场景 安装 nacos-sdk-python 时安装失败 % pip3 install nacos-sdk-pythonerror: externally-managed-environment This environment is externally managed ╰─> To install Python packages sy…...

搭建基于 ChatGPT 的问答系统

对于开发者来说&#xff0c;如何能够基于 ChatGPT 搭建一个完整、全面的问答系统&#xff0c;是极具实战价值与实践意义的。 要搭建基于 ChatGPT 的完整问答系统&#xff0c;除去上一部分所讲述的如何构建 Prompt Engineering 外&#xff0c;还需 要完成多个额外的步骤。例如…...

「动态规划」线性DP:最长上升子序列(LIS)|编辑距离 / LeetCode 300|72(C++)

概述 DP&#xff0c;即动态规划是解决最优化问题的一类算法&#xff0c;我们要通过将原始问题分解成规模更小的、相似的子问题&#xff0c;通过求解这些易求解的子问题来计算原始问题。 线性DP是一类基本DP&#xff0c;我们来通过它感受DP算法的奥义。 最长上升子序列&#x…...

IP 地址和 MAC 地址是如何转换的

在计算机网络的世界里&#xff0c;IP 地址和 MAC 地址就像是网络设备的两个重要 “身份证”&#xff0c;各自承担着不同的职责。IP 地址基于网络层&#xff0c;用于在复杂的网络环境中定位设备&#xff1b;MAC 地址则是固化在网卡上的物理地址&#xff0c;是设备的硬件标识。那…...

[Unity]设置自动打包脚本

背景 我们经常会使用自动打包功能 文件名称: AutoBuild.csusing System.IO; using System.Linq; using UnityEditor; using UnityEngine;public class AutoBuilder {[MenuItem("Build/GetCurrentBuildTarget")]public static void GetCurrentBuildTarget(){Debug.L…...

使用Docker部署魔豆文库:本地化搭建私有文档管理系统

文章目录 前言1.关于Moredoc2.本地部署Moredoc3.Moredoc简单使用4. 安装内网穿透5.配置Moredoc公网地址6. 配置固定公网地址 前言 电脑中文件超多的小伙伴们&#xff0c;是不是每次打开机都感觉像是打开了潘多拉魔盒&#xff1f;那些杂乱无章的文档和文件夹简直让人头大如斗&a…...

数据结构---【二叉搜索树】

必须满足的条件&#xff1a;左子树中所有节点的值< 根节点的值 < 右子树中所有节点的值 任意节点的左右子树也是搜索二叉树&#xff0c;也要满足上面的条件 二叉搜索树与堆不同&#xff0c;不一定是完全二叉树&#xff0c;采用链式结构 搜索二叉树的中序遍历是升序 1、查…...

智能检索革命全景透视——基于《搜索引擎信息检索困境破解体系》深度拆解

以下为严格遵循您要求的完整解析报告&#xff0c;全文约52000字符&#xff0c;包含7章26个子节156个量化指标&#xff1a; 智能检索革命全景透视——基于《搜索引擎信息检索困境破解体系》深度拆解 第一章 行业格局解码&#xff08;2987字&#xff09; 1.1 用户画像三维透视…...

STM32printf重定向到串口含armcc和gcc两种方案

STM32串口重定向&#xff1a;MDK与GCC环境下需重写的函数差异 在嵌入式开发中&#xff0c;尤其是使用 STM32系列微控制器 的项目中&#xff0c;调试信息的输出是不可或缺的一部分。为了方便调试&#xff0c;开发者通常会选择将 printf 等标准输出函数通过 UART 串口发送到 PC …...

蓝桥杯 序列计数

序列计数 原题目链接 题目描述 小明想知道&#xff0c;满足以下条件的正整数序列的数量&#xff1a; 第一项为 n&#xff1b;第二项不超过 n&#xff1b;从第三项开始&#xff0c;每一项小于前两项的差的绝对值。 请计算&#xff0c;对于给定的 n&#xff0c;有多少种满足…...

CSS常用属性_(进阶)

目录 1.尺寸单位与颜色 &#xff08;1&#xff09;尺寸 &#xff08;2&#xff09;颜色 常用2种 &#xff08;3&#xff09;颜色属性值&#xff08;透明度&#xff09; 例如&#xff1a; 2.字体属性font 例如&#xff1a; **顺序 3.文本属性 ​编辑例如&#xff1a; …...

模拟频谱分析仪(Linux c++ Qt)

此Demo由三个小项目组成,分布是模拟的硬件采集频谱数据端,后台处理端以及qt前端,于Linux系统下进行开发,使用的软件为clion和QtCreator,编程语言为c,使用了linux下的boost库(1.72),多线程和TCP,UDP以及c的一些新特性,为本人自己想的练手的小项目. 1.项目架构 整体设计采集端不…...

从实列中学习linux shell5: 利用shell 脚本 检测硬盘空间容量,当使用量达到80%的时候 发送邮件

下面是用于检测硬盘空间并在使用量达到80%时发送邮件的Shell脚本 第一步 编写脚本 #!/bin/bash# 邮件配置 recipient"zhaoqingyou99qhzt.com" subject"磁盘空间警报" mail_cmd"/usr/bin/mail" # 根据实际邮件命令路径修改# 检查是否安装邮件工…...

NLP 分词技术学习

文章目录 分词1. 分词方法2. 分词工具3. 分词难点 分词 分词是将连续的中文字符串序列切分成有意义的词语序列的过程&#xff0c;是 NLP 的基础任务之一。需要掌握以下内容&#xff1a; 1. 分词方法 基于规则/词典的方法&#xff08;字符串匹配&#xff09;&#xff1a; 正向…...

大模型——使用 StarRocks 作为向量数据库

大模型——使用 StarRocks 作为向量数据库 本章节介绍了 StarRocks,这是一款高性能的分析数据库,并演示了如何将其用作向量数据库。内容涵盖了设置、文档加载、标记化、创建向量数据库实例以及构建一个能够检索的问答系统。 StarRocks StarRocks 是一个次世代的亚秒级 MPP…...

涨薪技术|0到1学会性能测试第44课-apachetop模块监控

前面的推文我们认识了apache目录结构与配置知识&#xff0c;今天我们继续来看下apache监控技术&#xff0c;究竟是怎么做性能监控???后续文章都会系统分享干货&#xff0c;带大家从0到1学会性能测试。 Apache监控技术 关于apache监控通常会有两种方法&#xff1a; 一是&…...

MySQL 基本查询(一)

文章目录 Create(insert)指定列的单行插入和全列插入多行全列插入和指定列的多行插入如果主键存在&#xff0c;要插入替换存在的值replace 基本select全列查询指定列查询where子句where子句案例语文成绩在 [80, 90] 分的同学及语文成绩数学成绩是 58 或者 59 或者 98 或者 99 分…...

Chrome 136 H265 WebRTC 支持 正式版本已包含

时间过的真快&#xff0c;去年8月份写过一篇文章介绍如何加参数方式启动Chrome H265 硬件解码器&#xff0c; 现在的136版本已经包含在内&#xff0c;至此WebRTC已经完整包含了H264和H265解码器&#xff0c;这个事情应该从2015年开始&#xff0c;Google强推VP9 AV1&#xff0c…...

涨薪技术|0到1学会性能测试第43课-apache status模块监控

前面的推文我们认识了apache目录结构与配置知识,今天我们继续来看下apache监控技术,究竟是怎么做性能监控的。后续文章都会系统分享干货,带大家从0到1学会性能测试。 Apache监控技术 关于apache监控通常会有两种方法: 一是:使用apache自带的status监控模块进行监控; 二是…...

一、Javaweb是什么?

1.1 客户端与服务端 客户端 &#xff1a;用于与用户进行交互&#xff0c;接受用户的输入或操作&#xff0c;且展示服务器端的数据以及向服务器传递数据。 例如&#xff1a;手机app&#xff0c;微信小程序、浏览器… 服务端 &#xff1a;与客户端进行交互&#xff0c;接受客户…...

研发效率破局之道阅读总结(4)个人效率

研发效率破局之道阅读总结(4)个人效率 Author: Once Day Date: 2025年4月30日 一位热衷于Linux学习和开发的菜鸟&#xff0c;试图谱写一场冒险之旅&#xff0c;也许终点只是一场白日梦… 漫漫长路&#xff0c;有人对你微笑过嘛… 全系列文章可参考专栏: 程序的艺术_Once-Day…...

word模板填充导出-(支持word导出、pdf导出)

word模板填充转pdf导出处理 关于word模板填充示例java根据word模板填充数据并导出-五官一体即忢 相关依赖插件【LibreOffice】 安装 LibreOffice&#xff1a;从LibreOffice 官方网站下载并安装适合 Windows 系统或者Linux系统的版本 启动 LibreOffice 服务&#xff1a;打开…...

【Kubernets知识】Secret组件更新大全

文章目录 Kubernetes Secret 更新机制详解及场景指南一、直接替换式更新&#xff08;全量覆盖&#xff09;操作命令特点适用场景风险提示 二、JSON Patch 精准更新操作命令特点适用场景示例流程 三、Strategic Merge Patch&#xff08;策略合并&#xff09;操作命令特点适用场景…...

《分词算法大揭秘:BPE、BBPE、WordPiece、ULM常见方法介绍》

分词算法是自然语言处理&#xff08;NLP&#xff09;中的一个重要预处理步骤&#xff0c;它将文本分割成更小的单元&#xff08;如单词、子词或字符&#xff09;。以下是几种常见的分词算法&#xff1a;Byte Pair Encoding (BPE)、Byte-level BPE (BBPE)、WordPiece 和 Unigram…...