别再到处找教程了!Linux服务器上保姆级搭建YApi接口管理平台(含Node.js 12.13.0 + MongoDB 7.0.14配置)

news2026/4/30 2:27:50
企业级YApi私有化部署实战从零构建高可用接口管理平台在数字化转型浪潮中API已成为企业系统互联的核心纽带。根据Postman 2023年度报告超过82%的中大型企业正在使用专门的API管理工具来提升开发协作效率。YApi作为国产开源API管理平台的佼佼者以其友好的可视化界面、完善的权限管理和本地化部署优势正成为越来越多技术团队的基础设施选择。本文将带您完成一次工业级的YApi私有化部署不仅涵盖标准安装流程更会深入解决企业环境中常见的网络隔离、版本锁定和进程守护等实际问题。我们采用的方案具有以下特点版本精准控制锁定Node.js 12.13.0 MongoDB 7.0.14组合避免版本兼容性问题全内网适配所有依赖包均可离线部署适合安全要求严格的金融、政务等场景生产级加固包含数据库权限隔离、进程守护和故障自恢复机制避坑指南汇总了数十家企业部署实践中遇到的典型问题解决方案1. 企业级环境准备构建合规的基础运行环境1.1 系统资源规划建议在开始前建议按照以下标准规划服务器资源资源类型最低配置推荐配置备注CPU2核4核MongoDB对多核利用较好内存4GB8GB建议分配2GB给MongoDB存储50GB100GB需考虑API文档附件存储需求操作系统CentOS 7.4RHEL 8需已安装基础开发工具链网络带宽10Mbps100Mbps跨团队协作时需求较高企业实践提示在金融等行业建议将MongoDB部署在独立服务器实现数据库与应用分离架构。1.2 离线资源包准备在内网环境中需要提前下载以下组件到管理机# 下载组件清单在外网执行 wget https://registry.npmmirror.com/binary.html?pathnode/v12.13.0/node-v12.13.0-linux-x64.tar.xz wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-7.0.14.tgz wget https://github.com/YMFE/yapi/archive/refs/tags/v1.10.2.tar.gz -O yapi.tar.gz wget https://github.com/Unitech/pm2/archive/refs/tags/5.4.2.tar.gz -O pm2.tar.gz将下载的压缩包通过安全方式传输到目标服务器/opt/packages目录并验证完整性# 校验文件完整性 md5sum node-v12.13.0-linux-x64.tar.xz md5sum mongodb-linux-x86_64-rhel70-7.0.14.tgz2. 精准版本运行时安装2.1 Node.js 12.13.0定制化安装企业环境中推荐使用隔离式安装避免影响现有服务# 创建隔离环境 mkdir -p /opt/yapi-runtime tar -xJf node-v12.13.0-linux-x64.tar.xz -C /opt/yapi-runtime mv /opt/yapi-runtime/node-v12.13.0-linux-x64 /opt/yapi-runtime/nodejs # 配置企业级环境变量 cat EOF /etc/profile.d/yapi.sh export YAPI_HOME/opt/yapi-runtime export PATH\$YAPI_HOME/nodejs/bin:\$PATH EOF # 立即生效 source /etc/profile.d/yapi.sh验证安装时常见问题处理# 可能出现的问题1GLIBC版本过低 node: /lib64/libm.so.6: version GLIBC_2.27 not found (required by node) # 解决方案使用兼容构建版或升级系统 wget https://registry.npmmirror.com/binary.html?pathnode/v12.13.0/node-v12.13.0-linux-x64-musl.tar.xz # 可能出现的问题2动态链接库缺失 error while loading shared libraries: libatomic.so.1: cannot open shared object file # 解决方案 yum install -y libatomic2.2 MongoDB 7.0.14安全部署生产环境MongoDB需要特别关注安全配置# 解压安装 tar -zxvf mongodb-linux-x86_64-rhel70-7.0.14.tgz -C /opt/yapi-runtime mv /opt/yapi-runtime/mongodb-linux-x86_64-rhel70-7.0.14 /opt/yapi-runtime/mongodb # 创建数据目录建议使用独立存储 mkdir -p /data/mongodb/{data,logs} chown -R mongodb:mongodb /data/mongodb配置生产级mongodb.conf# /opt/yapi-runtime/mongodb/mongodb.conf systemLog: destination: file path: /data/mongodb/logs/mongod.log logAppend: true storage: dbPath: /data/mongodb/data journal: enabled: true wiredTiger: engineConfig: cacheSizeGB: 1 processManagement: fork: true pidFilePath: /var/run/mongodb/mongod.pid net: bindIp: 127.0.0.1 port: 27017 security: authorization: enabled keyFile: /opt/yapi-runtime/mongodb/keyfile初始化密钥文件并启动# 生成密钥文件 openssl rand -base64 756 /opt/yapi-runtime/mongodb/keyfile chmod 400 /opt/yapi-runtime/mongodb/keyfile # 首次启动无认证模式 /opt/yapi-runtime/mongodb/bin/mongod -f /opt/yapi-runtime/mongodb/mongodb.conf # 创建管理员账户 mongo --host 127.0.0.1 --port 27017 EOF use admin db.createUser({ user: yapiAdmin, pwd: ComplexPwd2023, roles: [ { role: userAdminAnyDatabase, db: admin } ] }) EOF # 重启启用认证 pkill mongod /opt/yapi-runtime/mongodb/bin/mongod -f /opt/yapi-runtime/mongodb/mongodb.conf3. YApi生产环境部署3.1 解压与配置tar -zxvf yapi.tar.gz -C /opt mv /opt/yapi-1.10.2 /opt/yapi # 重要目录结构说明 /opt/yapi ├── vendors # 核心代码 ├── config.json # 主配置文件 └── log # 日志目录生产环境推荐配置模板{ port: 3000, adminAccount: apiadmincompany.com, db: { servername: 127.0.0.1, DATABASE: yapi_prod, port: 27017, user: yapiAdmin, pass: ComplexPwd2023, authSource: admin }, mail: { enable: true, host: smtp.exmail.qq.com, port: 465, from: noreplycompany.com, auth: { user: noreplycompany.com, pass: EmailPassword123 } }, ldapLogin: { enable: true, server: ldap://ldap.company.com, baseDn: outech,dccompany,dccom, bindPassword: LdapBindPass123 } }3.2 数据库初始化cd /opt/yapi/vendors npm install --production --registryhttps://registry.npmmirror.com # 初始化数据库 npm run install-server # 预期成功输出 yapi-vendor1.10.2 install-server /opt/yapi/vendors node server/install.js log: mongodb load success... 初始化管理员账号成功账号名apiadmincompany.com密码InitPwd123常见初始化问题处理# 问题1MongoDB认证失败 MongoError: Authentication failed. # 解决确认authSource参数是否正确检查用户权限 mongo -u yapiAdmin -p ComplexPwd2023 --authenticationDatabase admin db.grantRolesToUser(yapiAdmin, [{role:readWrite, db:yapi_prod}]) # 问题2npm安装超时 npm ERR! network timeout at: https://registry.npmjs.org/... # 解决使用国内镜像或离线安装 npm config set registry https://registry.npmmirror.com4. 生产级进程管理与优化4.1 PM2高级配置# 安装PM2 npm install -g pm25.4.2 --registryhttps://registry.npmmirror.com # 创建PM2生态系统文件 cat EOF /opt/yapi/ecosystem.config.js module.exports { apps: [{ name: yapi, script: ./vendors/server/app.js, instances: 2, autorestart: true, watch: false, max_memory_restart: 1G, env: { NODE_ENV: production, PORT: 3000 }, error_file: /opt/yapi/logs/pm2-error.log, out_file: /opt/yapi/logs/pm2-out.log, log_date_format: YYYY-MM-DD HH:mm:ss }] }; EOF启动与管理命令# 启动集群 pm2 start /opt/yapi/ecosystem.config.js # 设置开机自启 pm2 startup pm2 save # 常用监控命令 pm2 monit # 实时监控 pm2 logs # 日志查看 pm2 reload yapi # 优雅重启4.2 Nginx反向代理配置建议通过Nginx提供HTTPS接入server { listen 443 ssl; server_name api-manage.company.com; ssl_certificate /etc/nginx/ssl/api-manage.crt; ssl_certificate_key /etc/nginx/ssl/api-manage.key; location / { proxy_pass http://127.0.0.1:3000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 重要WebSocket配置 proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection upgrade; } access_log /var/log/nginx/yapi-access.log main; error_log /var/log/nginx/yapi-error.log warn; }4.3 定期维护方案建议创建维护脚本/opt/yapi/maintenance.sh#!/bin/bash # 数据库备份 mongodump -u yapiAdmin -p ComplexPwd2023 --authenticationDatabase admin \ --db yapi_prod --gzip --archive/backup/yapi-$(date %Y%m%d).gz # 日志轮转 logrotate -f /etc/logrotate.d/yapi # 存储清理 find /opt/yapi/logs -name *.log -mtime 30 -exec rm -f {} \;设置cron定时任务0 2 * * * /opt/yapi/maintenance.sh /dev/null 215. 企业级功能扩展5.1 LDAP集成配置在config.json中完善LDAP配置ldapLogin: { enable: true, server: ldap://ldap.company.com:389, baseDn: outech,dccompany,dccom, bindPassword: LdapBindPass123, searchDn: cnadmin,dccompany,dccom, searchStandard: mail, emailPostfix: company.com, usernameField: sAMAccountName }5.2 自定义插件开发示例插件目录结构/opt/yapi/plugins └── statistics ├── package.json ├── index.js └── templates └── statistics.html插件开发示例// index.js module.exports function (server) { server.route({ method: GET, path: /api/statistics, handler: function (req, res) { const db server.mongo.db; db.collection(project).countDocuments({}, (err, count) { return res.json({ projectCount: count, visitCount: 0 }); }); } }); };在config.json中激活插件plugins: [ { name: statistics, options: {} } ]6. 安全加固措施6.1 网络层防护# 防火墙规则示例 iptables -A INPUT -p tcp --dport 3000 -s 10.0.0.0/8 -j ACCEPT iptables -A INPUT -p tcp --dport 3000 -j DROP # 定期漏洞扫描 yum install -y openscap-scanner oscap xccdf eval --profile stig --results scan-results.xml \ --report scan-report.html /usr/share/xml/scap/ssg/content/ssg-centos7-ds.xml6.2 应用层安全推荐的安全配置密码策略强制8位以上复杂度启用定期更换提醒失败锁定机制会话管理session: { secret: ComplexSecretKey2023, cookie: { maxAge: 86400000, httpOnly: true, secure: true } }API访问控制项目级别的IP白名单敏感操作二次验证详细的访问日志记录6.3 数据安全MongoDB加密方案# 创建加密密钥文件 openssl rand -base64 32 /opt/yapi-runtime/mongodb/encryption-key # 修改mongodb.conf security: enableEncryption: true encryptionKeyFile: /opt/yapi-runtime/mongodb/encryption-key encryptionCipherMode: AES256-CBC7. 高可用架构设计对于关键业务系统建议采用以下架构----------------- | Nginx LB | ---------------- | -------------------------------- | | -------------------- -------------------- | YApi Instance 1 | | YApi Instance 2 | | - PM2 Cluster | | - PM2 Cluster | -------------------- -------------------- | | -------------------------------- | ---------------- | MongoDB Replica | | - Primary | | - Secondary | | - Arbiter | -----------------实现步骤MongoDB副本集配置// 在primary节点执行 rs.initiate({ _id: yapiRepl, members: [ { _id: 0, host: db1.company.com:27017 }, { _id: 1, host: db2.company.com:27017 }, { _id: 2, host: db3.company.com:27017, arbiterOnly: true } ] })多节点YApi配置db: { servername: db1.company.com,db2.company.com,db3.company.com, DATABASE: yapi_prod, port: 27017, user: yapiAdmin, pass: ComplexPwd2023, authSource: admin, replicaSet: yapiRepl }负载均衡配置upstream yapi_servers { server 10.0.1.101:3000; server 10.0.1.102:3000; keepalive 32; } server { location / { proxy_pass http://yapi_servers; health_check interval10 fails3 passes2; } }8. 监控与告警体系8.1 基础监控配置PM2监控集成# 安装监控模块 pm2 install pm2-monit # 自定义指标采集 cat EOF /opt/yapi/metrics.js module.exports { fetch: function() { return { db_connections: getDbConnectionsCount(), api_requests: getApiRequestCount() }; } }; EOF8.2 Prometheus监控集成暴露metrics接口// 在YApi中添加metrics端点 const promClient require(prom-client); const collectDefaultMetrics promClient.collectDefaultMetrics; collectDefaultMetrics({ timeout: 5000 }); server.route({ method: GET, path: /metrics, handler: async (req, res) { res.type(text/plain); return promClient.register.metrics(); } });8.3 告警规则示例# alert.rules.yml groups: - name: yapi.rules rules: - alert: HighErrorRate expr: rate(yapi_http_errors_total[5m]) 0.1 for: 10m labels: severity: critical annotations: summary: High error rate on YApi instance description: Error rate is {{ $value }} for YApi - alert: DatabaseDown expr: up{jobmongodb} 0 for: 5m labels: severity: critical annotations: summary: MongoDB instance down description: Database has been down for more than 5 minutes9. 升级与迁移策略9.1 版本升级方案测试环境验证# 创建测试副本 mongodump -u yapiAdmin -p ComplexPwd2023 --authenticationDatabase admin \ --db yapi_prod --out /tmp/yapi-test # 恢复测试数据 mongorestore -u yapiAdmin -p ComplexPwd2023 --authenticationDatabase admin \ --db yapi_test /tmp/yapi-test/yapi_prod滚动升级步骤# 1. 停止PM2进程 pm2 stop yapi # 2. 备份当前版本 tar -czvf /backup/yapi-$(date %Y%m%d).tar.gz /opt/yapi # 3. 安装新版本 unzip yapi-new.zip -d /opt/yapi-new # 4. 迁移配置 cp /opt/yapi/config.json /opt/yapi-new/ # 5. 切换软链接 rm -f /opt/yapi-current ln -s /opt/yapi-new /opt/yapi-current # 6. 启动验证 cd /opt/yapi-current pm2 start ecosystem.config.js9.2 数据迁移方案跨版本数据库迁移流程graph TD A[源环境备份] -- B[校验备份完整性] B -- C[目标环境预检查] C -- D[停止写入服务] D -- E[最终一致性备份] E -- F[数据恢复] F -- G[权限重建] G -- H[服务验证]具体操作命令# 全量备份带oplog mongodump --host source.db.com --port 27017 -u admin -p password \ --authenticationDatabase admin --oplog --gzip --archive/backup/yapi-full.bson.gz # 增量备份 mongodump --host source.db.com --port 27017 -u admin -p password \ --authenticationDatabase admin --oplog --gzip --archive/backup/yapi-incr.bson.gz \ --query{ lastModified: { $gt: { $date: 2023-07-01T00:00:00Z } } } # 目标环境恢复 mongorestore --host target.db.com --port 27017 -u admin -p password \ --authenticationDatabase admin --oplogReplay --gzip --archive/backup/yapi-full.bson.gz10. 故障排查手册10.1 常见问题速查表故障现象可能原因解决方案无法连接MongoDB认证失败/网络不通检查keyFile和防火墙规则PM2进程频繁重启内存泄漏/OOM调整max_memory_restart参数上传附件失败存储权限不足检查Nginx上传大小限制LDAP登录超时网络延迟/证书问题配置合理的timeout参数接口返回502错误Node进程崩溃检查PM2日志和系统负载10.2 诊断工具集# 检查Node.js堆内存使用 pm2 monit # MongoDB性能分析 mongotop -u yapiAdmin -p ComplexPwd2023 --authenticationDatabase admin 30 mongostat --host 127.0.0.1:27017 -u yapiAdmin -p ComplexPwd2023 --authenticationDatabase admin # 网络连接检查 ss -tulnp | grep -E 3000|27017 tcpdump -i eth0 port 27017 -w mongodb.pcap # 性能追踪 node --inspect /opt/yapi/vendors/server/app.js10.3 日志分析技巧关键日志位置PM2日志/opt/yapi/logs/pm2-*.log应用日志/opt/yapi/logs/yapi-*.logMongoDB日志/data/mongodb/logs/mongod.log常见错误模式分析# 查找高频错误 grep -oP ERROR.* /opt/yapi/logs/yapi-*.log | sort | uniq -c | sort -nr # 追踪慢查询 grep slow query /data/mongodb/logs/mongod.log | awk -F ms {print $1$2} | sort -nr11. 性能优化指南11.1 数据库优化索引策略// 为高频查询字段创建索引 db.interface.createIndex({ project_id: 1, method: 1, path: 1 }); db.project.createIndex({ group_id: 1, name: 1 });查询优化// 使用投影减少返回字段 db.interface.find( { project_id: 123 }, { _id: 1, title: 1, method: 1, path: 1 } ).explain(executionStats);分片配置超大规模部署# 启用分片 sh.enableSharding(yapi_prod) sh.shardCollection(yapi_prod.interface, { project_id: hashed })11.2 应用层优化Node.js性能调优# 启动参数优化 NODE_ENVproduction \ node --max-old-space-size2048 \ --optimize-for-size \ --gc-interval100 \ server/app.js缓存配置建议redis: { host: 127.0.0.1, port: 6379, password: RedisPass123, ttl: 3600, enable: true }11.3 前端优化静态资源处理location /static { alias /opt/yapi/vendors/public; gzip on; gzip_types text/plain text/css application/json application/javascript; expires 365d; add_header Cache-Control public; }12. 扩展开发实践12.1 插件开发规范推荐的项目结构yapi-plugin- ├── README.md ├── package.json ├── server.js # 服务端逻辑 ├── client.js # 客户端逻辑 ├── static # 静态资源 │ ├── index.html │ └── assets └── test # 测试用例典型插件示例消息通知插件// server.js module.exports function (server) { const mongoose require(mongoose); const Schema new mongoose.Schema({ projectId: Number, eventType: String, notifyUsers: Array, createdAt: { type: Date, default: Date.now } }); server.model(Notification, Schema); server.route({ method: POST, path: /api/notify, handler: async (req, res) { const notification new server.models.Notification(req.payload); await notification.save(); return { success: true }; } }); };12.2 自定义主题开发覆盖默认主题/* /opt/yapi/plugins/custom-theme/static/custom.css */ :root { --primary-color: #1890ff; --hover-color: #40a9ff; } .layout-header { background: var(--primary-color); } .ant-btn-primary { background: var(--primary-color); border-color: var(--primary-color); } .ant-btn-primary:hover { background: var(--hover-color); border-color: var(--hover-color); }注册主题插件{ name: custom-theme, options: { cssPath: /static/custom.css } }13. 容器化部署方案13.1 Docker Compose部署推荐配置# docker-compose.yml version: 3 services: yapi: image: yapipro/yapi:latest ports: - 3000:3000 environment: - NODE_ENVproduction - DB_SERVERmongodb - DB_PORT27017 - DB_NAMEyapi_prod depends_on: - mongodb volumes: - ./config.json:/yapi/config.json - ./logs:/yapi/log mongodb: image: mongo:7.0.14 ports: - 27017:27017 environment: - MONGO_INITDB_ROOT_USERNAMEroot - MONGO_INITDB_ROOT_PASSWORDexample volumes: - ./mongo-data:/data/db - ./mongo-config:/data/configdb启动命令docker-compose up -d docker-compose exec yapi node server/install.js13.2 Kubernetes部署示例Deployment# yapi-deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: name: yapi spec: replicas: 3 selector: matchLabels: app: yapi template: metadata: labels: app: yapi spec: containers: - name: yapi image: yapipro/yapi:1.10.2 ports: - containerPort: 3000 env: - name: DB_SERVER value: mongodb-svc - name: DB_PORT value: 27017 volumeMounts: - mountPath: /yapi/config.json name: config subPath: config.json volumes: - name: config configMap: name: yapi-config --- # mongodb-statefulset.yaml apiVersion: apps/v1 kind: StatefulSet metadata: name: mongodb spec: serviceName: mongodb-svc replicas: 3 selector: matchLabels: app: mongodb template: metadata: labels: app: mongodb spec: containers: - name: mongodb image: mongo:7.0.14 ports: - containerPort: 27017 command: - mongod - --replSet - yapiRepl - --bind_ip_all14. 备份与恢复体系14.1 全量备份方案#!/bin/bash # 全量备份脚本 BACKUP_DIR/backup/yapi-$(date %Y%m%d) mkdir -p $BACKUP_DIR # MongoDB备份 mongodump -u yapiAdmin -p ComplexPwd2023 --authenticationDatabase admin \ --db yapi_prod --gzip --archive$BACKUP_DIR/mongodb.gz # 应用备份 tar -czvf $BACKUP_DIR/yapi.tar.gz /opt/yapi # 上传到远程存储 rclone copy $BACKUP_DIR remote:backups/yapi # 清理旧备份 find /backup -type d -mtime 30 -exec rm -rf {} \;14.2 增量备份实现#!/bin/bash # 增量备份脚本 LAST_BACKUP$(ls -td /backup/* | head -1) TIMESTAMP_FILE$LAST_BACKUP/last_timestamp if [ -f $TIMESTAMP_FILE ]; then LAST_TIMESTAMP$(cat $TIMESTAMP_FILE) CURRENT_TIMESTAMP$(date %Y-%m-%dT%H:%M:%S) # MongoDB增量备份 mongodump -u yapiAdmin -p ComplexPwd2023 --authenticationDatabase admin \ --db yapi_prod --gzip --archive/backup/incr/mongodb-$(date %Y%m%d).gz \ --query{ lastModified: { $gt: { $date: $LAST_TIMESTAMP } } } # 记录新时间戳 echo $CURRENT_TIMESTAMP $TIMESTAMP_FILE fi14.3 灾难恢复演练恢复测试流程准备恢复环境# 创建干净的Linux服务器 # 安装基础依赖Node.js、MongoDB等数据恢复# 恢复MongoDB mongorestore -u yapiAdmin -p ComplexPwd2023 --authenticationDatabase admin \ --db yapi_prod --gzip --archive/backup/mongodb.gz # 恢复应用 tar -xzvf /backup/yapi.tar.gz -C /服务验证# 启动服务 cd /opt/yapi pm2 start ecosystem.config.js # 功能测试 curl -I http://localhost:3000/api/project/list15. 最佳实践总结在企业实际部署中我们总结了以下黄金法则环境隔离原则开发、测试、生产环境严格分离使用不同的数据库实例和认证信息配置独立的管理员账户最小权限控制// MongoDB角色定义示例 db.createRole({ role: yapi_readwrite, privileges: [ { resource: { db: yapi_prod, collection: }, actions: [find,insert,update] } ], roles: [] })变更管理流程变更申请 - 影响评估 - 测试验证 - 备份准备 - 实施变更 - 监控观察 - 结果确认文档自动化# 结合Swagger自动同步 npm install yapi-plugin-import-swagger --save团队协作规范项目分组与权限矩阵接口变更通知机制版本历史追溯策略在大型金融项目实践中我们采用分级部署方案核心业务系统使用独立集群每个业务线有专属的YApi实例通过统一入口网关实现单点登录和权限集成。数据库层面采用三节点副本集每日全量备份binlog增量备份确保数据万无一失。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2481942.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

SpringBoot-17-MyBatis动态SQL标签之常用标签

文章目录 1 代码1.1 实体User.java1.2 接口UserMapper.java1.3 映射UserMapper.xml1.3.1 标签if1.3.2 标签if和where1.3.3 标签choose和when和otherwise1.4 UserController.java2 常用动态SQL标签2.1 标签set2.1.1 UserMapper.java2.1.2 UserMapper.xml2.1.3 UserController.ja…

wordpress后台更新后 前端没变化的解决方法

使用siteground主机的wordpress网站,会出现更新了网站内容和修改了php模板文件、js文件、css文件、图片文件后,网站没有变化的情况。 不熟悉siteground主机的新手,遇到这个问题,就很抓狂,明明是哪都没操作错误&#x…

网络编程(Modbus进阶)

思维导图 Modbus RTU(先学一点理论) 概念 Modbus RTU 是工业自动化领域 最广泛应用的串行通信协议,由 Modicon 公司(现施耐德电气)于 1979 年推出。它以 高效率、强健性、易实现的特点成为工业控制系统的通信标准。 包…

UE5 学习系列(二)用户操作界面及介绍

这篇博客是 UE5 学习系列博客的第二篇,在第一篇的基础上展开这篇内容。博客参考的 B 站视频资料和第一篇的链接如下: 【Note】:如果你已经完成安装等操作,可以只执行第一篇博客中 2. 新建一个空白游戏项目 章节操作,重…

IDEA运行Tomcat出现乱码问题解决汇总

最近正值期末周,有很多同学在写期末Java web作业时,运行tomcat出现乱码问题,经过多次解决与研究,我做了如下整理: 原因: IDEA本身编码与tomcat的编码与Windows编码不同导致,Windows 系统控制台…

利用最小二乘法找圆心和半径

#include <iostream> #include <vector> #include <cmath> #include <Eigen/Dense> // 需安装Eigen库用于矩阵运算 // 定义点结构 struct Point { double x, y; Point(double x_, double y_) : x(x_), y(y_) {} }; // 最小二乘法求圆心和半径 …

使用docker在3台服务器上搭建基于redis 6.x的一主两从三台均是哨兵模式

一、环境及版本说明 如果服务器已经安装了docker,则忽略此步骤,如果没有安装,则可以按照一下方式安装: 1. 在线安装(有互联网环境): 请看我这篇文章 传送阵>> 点我查看 2. 离线安装(内网环境):请看我这篇文章 传送阵>> 点我查看 说明&#xff1a;假设每台服务器已…

XML Group端口详解

在XML数据映射过程中&#xff0c;经常需要对数据进行分组聚合操作。例如&#xff0c;当处理包含多个物料明细的XML文件时&#xff0c;可能需要将相同物料号的明细归为一组&#xff0c;或对相同物料号的数量进行求和计算。传统实现方式通常需要编写脚本代码&#xff0c;增加了开…

LBE-LEX系列工业语音播放器|预警播报器|喇叭蜂鸣器的上位机配置操作说明

LBE-LEX系列工业语音播放器|预警播报器|喇叭蜂鸣器专为工业环境精心打造&#xff0c;完美适配AGV和无人叉车。同时&#xff0c;集成以太网与语音合成技术&#xff0c;为各类高级系统&#xff08;如MES、调度系统、库位管理、立库等&#xff09;提供高效便捷的语音交互体验。 L…

(LeetCode 每日一题) 3442. 奇偶频次间的最大差值 I (哈希、字符串)

题目&#xff1a;3442. 奇偶频次间的最大差值 I 思路 &#xff1a;哈希&#xff0c;时间复杂度0(n)。 用哈希表来记录每个字符串中字符的分布情况&#xff0c;哈希表这里用数组即可实现。 C版本&#xff1a; class Solution { public:int maxDifference(string s) {int a[26]…

【大模型RAG】拍照搜题技术架构速览:三层管道、两级检索、兜底大模型

摘要 拍照搜题系统采用“三层管道&#xff08;多模态 OCR → 语义检索 → 答案渲染&#xff09;、两级检索&#xff08;倒排 BM25 向量 HNSW&#xff09;并以大语言模型兜底”的整体框架&#xff1a; 多模态 OCR 层 将题目图片经过超分、去噪、倾斜校正后&#xff0c;分别用…

【Axure高保真原型】引导弹窗

今天和大家中分享引导弹窗的原型模板&#xff0c;载入页面后&#xff0c;会显示引导弹窗&#xff0c;适用于引导用户使用页面&#xff0c;点击完成后&#xff0c;会显示下一个引导弹窗&#xff0c;直至最后一个引导弹窗完成后进入首页。具体效果可以点击下方视频观看或打开下方…

接口测试中缓存处理策略

在接口测试中&#xff0c;缓存处理策略是一个关键环节&#xff0c;直接影响测试结果的准确性和可靠性。合理的缓存处理策略能够确保测试环境的一致性&#xff0c;避免因缓存数据导致的测试偏差。以下是接口测试中常见的缓存处理策略及其详细说明&#xff1a; 一、缓存处理的核…

龙虎榜——20250610

上证指数放量收阴线&#xff0c;个股多数下跌&#xff0c;盘中受消息影响大幅波动。 深证指数放量收阴线形成顶分型&#xff0c;指数短线有调整的需求&#xff0c;大概需要一两天。 2025年6月10日龙虎榜行业方向分析 1. 金融科技 代表标的&#xff1a;御银股份、雄帝科技 驱动…

观成科技:隐蔽隧道工具Ligolo-ng加密流量分析

1.工具介绍 Ligolo-ng是一款由go编写的高效隧道工具&#xff0c;该工具基于TUN接口实现其功能&#xff0c;利用反向TCP/TLS连接建立一条隐蔽的通信信道&#xff0c;支持使用Let’s Encrypt自动生成证书。Ligolo-ng的通信隐蔽性体现在其支持多种连接方式&#xff0c;适应复杂网…

铭豹扩展坞 USB转网口 突然无法识别解决方法

当 USB 转网口扩展坞在一台笔记本上无法识别,但在其他电脑上正常工作时,问题通常出在笔记本自身或其与扩展坞的兼容性上。以下是系统化的定位思路和排查步骤,帮助你快速找到故障原因: 背景: 一个M-pard(铭豹)扩展坞的网卡突然无法识别了,扩展出来的三个USB接口正常。…

未来机器人的大脑:如何用神经网络模拟器实现更智能的决策?

编辑&#xff1a;陈萍萍的公主一点人工一点智能 未来机器人的大脑&#xff1a;如何用神经网络模拟器实现更智能的决策&#xff1f;RWM通过双自回归机制有效解决了复合误差、部分可观测性和随机动力学等关键挑战&#xff0c;在不依赖领域特定归纳偏见的条件下实现了卓越的预测准…

Linux应用开发之网络套接字编程(实例篇)

服务端与客户端单连接 服务端代码 #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <arpa/inet.h> #include <pthread.h> …

华为云AI开发平台ModelArts

华为云ModelArts&#xff1a;重塑AI开发流程的“智能引擎”与“创新加速器”&#xff01; 在人工智能浪潮席卷全球的2025年&#xff0c;企业拥抱AI的意愿空前高涨&#xff0c;但技术门槛高、流程复杂、资源投入巨大的现实&#xff0c;却让许多创新构想止步于实验室。数据科学家…

深度学习在微纳光子学中的应用

深度学习在微纳光子学中的主要应用方向 深度学习与微纳光子学的结合主要集中在以下几个方向&#xff1a; 逆向设计 通过神经网络快速预测微纳结构的光学响应&#xff0c;替代传统耗时的数值模拟方法。例如设计超表面、光子晶体等结构。 特征提取与优化 从复杂的光学数据中自…