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

PostgreSQL升级:使用pg_upgrade进行大版本(16.3)升级(17.0)

1.pg_upgrade工具介绍

pg_upgrade 会创建新的系统表,并以重用旧的数据文件的方式进行升级。

pg_upgrade 的参数选项如下:

 -b bindir,--old-bindir=bindir:旧的 PostgreSQL 可执行文件目录;

 -B bindir,--new-bindir=bindir:新的 PostgreSQL 可执行文件目录;

 -c,--check:只检查升级兼容性,不更改任何数据

 -d configdir,--old-datadir=configdir:旧版本的数据目录

 -D configdir,--new-datadir=configdir:新版本的数据目录

 -j,--jobs=njobs:要同时使用的进程或线程数

 -k,--link:硬链接方式升级

 -o options,--old-options options:直接传送给旧 postgres 命令的选项,多个选

项可以追加在后面

 -O options,--new-options options:直接传送给新 postgres 命令的选项,多个

选项可以追加在后面

 -p port,--old-port=port:旧版本的端口号

 -P port,--new-port=port:新版本的端口号

 -r,--retain:即使在成功完成后也保留 SQL 和日志文件

在升级之前应该运行 pg_upgrade -c 检查新旧版本的兼容性,把每一项不兼容的问题都解决了才可以顺利升级。使用 pg_upgrade -c 只会检查新旧版本的兼容性,不会运行真正的升级程序,不会修改数据文件,并且在命令结束时,会输出一份检查结果的报告,还会对需要手动调整的项做出简要的描述。

pg_upgrade 有普通模式和 link 模式两种升级模式。在普通模式下,会把旧版本的数据拷贝到新版本中,所以如果使用普通升级模式,要确保有足够的磁盘空间存储新旧两份数据;

link 模式下,只是在新版本的数据目录中建立了旧版本数据文件的硬链接,可以有效减少磁盘占用的空间。

(本文将采用普通升级模式进行升级)

2.版本信息

升级前    

升级后

Postgresql 16.3

Postgresql 17.0

3.升级准备

安装依赖:源环境已安装

yum install libicu-devel.x86_64 python3 python3-devel

备份数据:

pg_dumpall -p 5432 > /tmp/backup.sql

4.安装新版pg数据库

上传安装包至/soft目录

tar -xvf postgresql-17.0.tar.gz  

1编译安装

mkdir -p /usr/local/pg17 

chown postgres:postgres /usr/local/pg17

cd postgresql-17.0

./configure --prefix=/usr/local/pg17

make

make install

2切换postgres用户并建新版pg数据目录

su postgres

cd /data

mkdir pg17

3初始化新版本pg

/usr/local/pg17/bin/initdb -D /data/pg17 

4修改配置文件,端口改为5433

[postgres@postgres pg17]$ vi postgresql.conf

port = 5433  

(5)启动数据库服务

[postgres@postgres pg17]$     /usr/local/pg17/bin/pg_ctl -D /data/pg17 -l logfile start

waiting for server to start.... done

server started

[postgres@postgres pg17]$ ps -ef|grep postgres

root      20202  10588  0 10:07 pts/0    00:00:00 su - postgres

postgres  20203  20202  0 10:07 pts/0    00:00:00 -bash

postgres  20322      1  0 10:10 ?        00:00:00 /usr/local/pg17/bin/postgres -D /data/pg17

postgres  20323  20322  0 10:10 ?        00:00:00 postgres: checkpointer

postgres  20324  20322  0 10:10 ?        00:00:00 postgres: background writer

postgres  20326  20322  0 10:10 ?        00:00:00 postgres: walwriter

postgres  20327  20322  0 10:10 ?        00:00:00 postgres: autovacuum launcher

postgres  20328  20322  0 10:10 ?        00:00:00 postgres: logical replication launcher

postgres  20329  20203  0 10:10 pts/0    00:00:00 ps -ef

postgres  20330  20203  0 10:10 pts/0    00:00:00 grep --color=auto postgres

5.停止旧版本pg数据库服务

Oct 03 09:53:53 postgres postgresql[10694]: Starting PostgreSQL: ok

[root@postgres ~]# systemctl stop postgresql

[root@postgres ~]# systemctl status postgresql

● postgresql.service - SYSV: PostgreSQL RDBMS

   Loaded: loaded (/etc/rc.d/init.d/postgresql; bad; vendor preset: disabled)

   Active: failed (Result: exit-code) since Thu 2024-10-03 10:05:25 CST; 2s ago

     Docs: man:systemd-sysv-generator(8)

  Process: 19461 ExecStop=/etc/rc.d/init.d/postgresql stop (code=exited, status=1/FAILURE)

  Process: 10694 ExecStart=/etc/rc.d/init.d/postgresql start (code=exited, status=0/SUCCESS)

Oct 03 09:53:53 postgres systemd[1]: Started SYSV: PostgreSQL RDBMS.

Oct 03 09:53:53 postgres postgresql[10694]: Starting PostgreSQL: ok

Oct 03 10:05:25 postgres systemd[1]: Stopping SYSV: PostgreSQL RDBMS...

Oct 03 10:05:25 postgres su[19463]: (to postgres) root on none

Oct 03 10:05:25 postgres postgresql[19461]: Stopping PostgreSQL: pg_ctl: PID file "/data/pg16/postmaster.p...xist

Oct 03 10:05:25 postgres postgresql[19461]: Is server running?

Oct 03 10:05:25 postgres systemd[1]: postgresql.service: control process exited, code=exited status=1

Oct 03 10:05:25 postgres systemd[1]: Stopped SYSV: PostgreSQL RDBMS.

Oct 03 10:05:25 postgres systemd[1]: Unit postgresql.service entered failed state.

Oct 03 10:05:25 postgres systemd[1]: postgresql.service failed.

Hint: Some lines were ellipsized, use -l to show in full.

[root@postgres ~]# systemctl disable postgresql

postgresql.service is not a native service, redirecting to /sbin/chkconfig.

Executing /sbin/chkconfig postgresql off

6.检查新旧版本兼容性

pg_upgrade -b /usr/local/pg16/bin -B /usr/local/pg17/bin -d /data/pg16/ -D /data/pg17/ -k -c

[postgres@postgres ~]$ pg_upgrade -b /usr/local/pg16/bin -B /usr/local/pg17/bin -d /data/pg16/ -D /data/pg17/ -k -c

报错1:

check for "/usr/local/pg17/bin/postgres" failed: incorrect version: found "postgres (PostgreSQL) 17.0", expected "postgres (PostgreSQL) 16.3"

Failure, exiting

[postgres@postgres ~]$ which pg_upgrade

/usr/local/pg16/bin/pg_upgrade

如果看到此错误,则可能是由于运行旧版本 (16) 而不是新版本 (17) 附带的 pg_upgrade 二进制文件造成的。使用版本 17 的 pg_upgrade 二进制文件的绝对路径来运行正确的二进制文件。

报错2:

[postgres@postgres ~]$ /usr/local/pg17/bin/pg_upgrade -b /usr/local/pg16/bin -B /usr/local/pg17/bin -d /data/pg16/ -D /data/pg17/ -k -c

There seems to be a postmaster servicing the new cluster.

Please shutdown that postmaster and try again.

Failure, exiting

[postgres@postgres ~]$

源集群没有完全关闭,关闭后再次进行检查。

报错3:

[postgres@postgres ~]$ /usr/local/pg17/bin/pg_ctl -D /data/pg17 -l logfile stop

waiting for server to shut down.... done

server stopped

[postgres@postgres ~]$

[postgres@postgres ~]$

[postgres@postgres ~]$

[postgres@postgres ~]$ /usr/local/pg17/bin/pg_upgrade -b /usr/local/pg16/bin -B /usr/local/pg17/bin -d /data/pg16/ -D /data/pg17/ -k -c

Performing Consistency Checks

-----------------------------

Checking cluster versions                                     ok

Checking database user is the install user                    ok

Checking database connection settings                         ok

Checking for prepared transactions                            ok

Checking for contrib/isn with bigint-passing mismatch         ok

Checking data type usage                                      ok

Checking for presence of required libraries                   fatal

Your installation references loadable libraries that are missing from the

new installation.  You can add these libraries to the new installation,

or remove the functions using them from the old installation.  A list of

problem libraries is in the file:

    /data/pg17/pg_upgrade_output.d/20241003T102958.773/loadable_libraries.txt

Failure, exiting

[postgres@postgres ~]$

[postgres@postgres pg16]$ more /data/pg17/pg_upgrade_output.d/20241003T102958.773/loadable_libraries.txt

could not load library "$libdir/pg_stat_statements": ERROR:  could not access file "$libdir/pg_stat_statements":

No such file or directory

In database: postgres

[postgres@postgres pg16]$

是因为新库pg17未安装pg_stat_statements、auto_explain等源库已经安装的插件。在pg17环境进行相关插件编译安装,可参考博主其他博文。

启动数据库:

[postgres@postgres pg17]$ /usr/local/pg17/bin/pg_ctl -D /data/pg17 -l logfile start

waiting for server to start.... done

server started

[postgres@postgres pg17]$

再次检查兼容性:

[postgres@postgres ~]$ /usr/local/pg17/bin/pg_upgrade -b /usr/local/pg16/bin -B /usr/local/pg17/bin -d /data/pg16/ -D /data/pg17/ -k -c

Performing Consistency Checks

-----------------------------

Checking cluster versions                                     ok

Checking database user is the install user                    ok

Checking database connection settings                         ok

Checking for prepared transactions                            ok

Checking for contrib/isn with bigint-passing mismatch         ok

Checking data type usage                                      ok

Checking for presence of required libraries                   ok

Checking database user is the install user                    ok

Checking for prepared transactions                            ok

Checking for new cluster tablespace directories               ok

*Clusters are compatible*

[postgres@postgres ~]$

看到以上提示表明检查通过。

7.进行正式升级

/usr/local/pg17/bin/pg_upgrade -b /usr/local/pg16/bin -B /usr/local/pg17/bin -d /data/pg16/ -D /data/pg17/

[postgres@postgres ~]$ /usr/local/pg17/bin/pg_upgrade -b /usr/local/pg16/bin -B /usr/local/pg17/bin -d /data/pg16/ -D /data/pg17/

Performing Consistency Checks

-----------------------------

Checking cluster versions                                     ok

Checking database user is the install user                    ok

Checking database connection settings                         ok

Checking for prepared transactions                            ok

Checking for contrib/isn with bigint-passing mismatch         ok

Checking data type usage                                      ok

Creating dump of global objects                               ok

Creating dump of database schemas                             

                                                              ok

Checking for presence of required libraries                   ok

Checking database user is the install user                    ok

Checking for prepared transactions                            ok

Checking for new cluster tablespace directories               ok

If pg_upgrade fails after this point, you must re-initdb the

new cluster before continuing.

Performing Upgrade

------------------

Setting locale and encoding for new cluster                   ok

Analyzing all rows in the new cluster                         ok

Freezing all rows in the new cluster                          ok

Deleting files from new pg_xact                               ok

Copying old pg_xact to new server                             ok

Setting oldest XID for new cluster                            ok

Setting next transaction ID and epoch for new cluster         ok

Deleting files from new pg_multixact/offsets                  ok

Copying old pg_multixact/offsets to new server                ok

Deleting files from new pg_multixact/members                  ok

Copying old pg_multixact/members to new server                ok

Setting next multixact ID and offset for new cluster          ok

Resetting WAL archives                                        ok

Setting frozenxid and minmxid counters in new cluster         ok

Restoring global objects in the new cluster                   ok

Restoring database schemas in the new cluster                 

                                                              ok

Copying user relation files                                   

                                                              ok

Setting next OID for new cluster                              ok

Sync data directory to disk                                   ok

Creating script to delete old cluster                         ok

Checking for extension updates                                notice

Your installation contains extensions that should be updated

with the ALTER EXTENSION command.  The file

    update_extensions.sql

when executed by psql by the database superuser will update

these extensions.

Upgrade Complete

----------------

Optimizer statistics are not transferred by pg_upgrade.

Once you start the new server, consider running:

    /usr/local/pg17/bin/vacuumdb --all --analyze-in-stages

Running this script will delete the old cluster's data files:

    ./delete_old_cluster.sh

[postgres@postgres ~]$

看到 Upgrade Complete 说明升级已经顺利完成。

8.更新统计信息

        pg_upgrade 会创建新的系统表,并重用旧的数据进行升级,统计信息并不会随升级过程迁移,所以在启用新版本之前,应该首先重新收集统计信息,避免没有统计信息导致错误的查询计划。我们可以手动运行 vacuum 命令,如下:

        vacuumdb --all --analyze-in-stages -h 127.0.0.1 -p xxx

启动新版本pg服务:

 /usr/local/pg17/bin/pg_ctl -D /data/pg17 -l logfile start

 [postgres@postgres pg17]$  /usr/local/pg17/bin/pg_ctl -D /data/pg17 -l logfile start

waiting for server to start.... done

server started

[postgres@postgres pg17]$

更新统计信息:

vacuumdb --all --analyze-in-stages -h 127.0.0.1 -p 5433

[postgres@postgres pg17]$ vacuumdb --all --analyze-in-stages -h 127.0.0.1 -p 5433

vacuumdb: processing database "postgres": Generating minimal optimizer statistics (1 target)

vacuumdb: processing database "template1": Generating minimal optimizer statistics (1 target)

vacuumdb: processing database "postgres": Generating medium optimizer statistics (10 targets)

vacuumdb: processing database "template1": Generating medium optimizer statistics (10 targets)

vacuumdb: processing database "postgres": Generating default (full) optimizer statistics

vacuumdb: processing database "template1": Generating default (full) optimizer statistics

[postgres@postgres pg17]$

9.测试数据库

修改环境变量:

PATH=$PATH:$HOME/.local/bin:$HOME/bin:/usr/local/pg17/bin

export PATH

PGDATA=/data/pg17

export PGDATA

export LANG=en_US.UTF-8

修改端口5433为原来端口:

修改完重启数据库生效。

登录测试:

[postgres@postgres pg17]$ psql

psql (16.3, server 17.0)

WARNING: psql major version 16, server major version 17.

         Some psql features might not work.

Type "help" for help.

postgres=#

检查扩展:

postgres=# SELECT pg_stat_statements_reset();

ERROR:  pg_stat_statements must be loaded via "shared_preload_libraries"

postgres=# CREATE EXTENSION PG_STAT_STATEMENTS;

ERROR:  extension "pg_stat_statements" already exists

postgres=#

发现是参数文件问题:

修改新库配置文件和源库一致:

shared_preload_libraries ='auto_explain,pg_stat_statements'

#以下pg_stat_statements相关配置

track_io_timing = on

track_activity_query_size = 2048

pg_stat_statements.max = 10000

pg_stat_statements.track = all

pg_stat_statements.track_utility = off

pg_stat_statements.save = on

##auto_explain####

auto_explain.log_min_duration = '100ms' # 或其他时间阈值,例如'sec', 'min'

auto_explain.log_analyze = on # 输出实际的执行统计信息

auto_explain.log_verbose = on # 输出详细的计划信息

auto_explain.log_timing = on # 输出查询的执行时间

auto_explain.log_nested_statements = off # 默认情况下不记录嵌套的解释计划,可根据需要开启

重启数据库后查看:

postgres=# show shared_preload_libraries;

    shared_preload_libraries     

---------------------------------

 auto_explain,pg_stat_statements

(1 row)

postgres=# select name,setting from pg_settings where name like 'auto_explain%';

                 name                  | setting

---------------------------------------+---------

 auto_explain.log_analyze              | on

 auto_explain.log_buffers              | off

 auto_explain.log_format               | text

 auto_explain.log_level                | log

 auto_explain.log_min_duration         | 100

 auto_explain.log_nested_statements    | off

 auto_explain.log_parameter_max_length | -1

 auto_explain.log_settings             | off

 auto_explain.log_timing               | on

 auto_explain.log_triggers             | off

 auto_explain.log_verbose              | on

 auto_explain.log_wal                  | off

 auto_explain.sample_rate              | 1

(13 rows)

postgres=#

至此,整个16.3升级17.0完成。

10.新库确认没问题后删除旧库

[postgres@postgres ~]$ ./delete_old_cluster.sh

[postgres@postgres ~]$ ll

total 16

-rwx------. 1 postgres postgres   31 Oct  3 10:55 delete_old_cluster.sh

-rw-------. 1 postgres postgres 1741 Jun 27 07:08 logfile

-rw-rw-r--. 1 postgres postgres   19 Jul  7 08:43 test_t1.txt

-rw-------. 1 postgres postgres   63 Oct  3 10:55 update_extensions.sql

[postgres@postgres ~]$ more delete_old_cluster.sh

#!/bin/sh

rm -rf '/data/pg16'

[postgres@postgres ~]$ cd /data

[postgres@postgres data]$ ll

total 4

drwx------. 20 postgres postgres 4096 Oct  3 11:00 pg17

[postgres@postgres data]$

相关文章:

PostgreSQL升级:使用pg_upgrade进行大版本(16.3)升级(17.0)

1.pg_upgrade工具介绍 pg_upgrade 会创建新的系统表,并以重用旧的数据文件的方式进行升级。 pg_upgrade 的参数选项如下: -b bindir,--old-bindirbindir:旧的 PostgreSQL 可执行文件目录; -B bindir,--new-…...

userdel命令:删除指定Linux用户

一、命令简介 ​userdel​ 命令用于删除 Linux 系统中的用户账号。当您不再需要某个用户账号时,可以使用 userdel​ 命令将其从系统中删除。 ‍ 二、命令参数 userdel [选项] 用户名一些常用的选项包括: -r, --remove: 删除用户的家目录及邮件目录。…...

QT系统学习篇(1)

一、什么是Qt、Qt的优势 QT是一个跨平台的C图形用户界面库,目前包括Qt Creator、Qt Designer等等快速开发工具。支持所有Linux/Unix系统,还支持windows平台。Qt很容易扩展,并且允许真正的组件编程。(军工企业项目开发基本离不开Q…...

每日一刷——9.26——ACM训练题——Fibonacci Again

题目描述&#xff1a; There are another kind of Fibonacci numbers: F(0) 7, F(1) 11, F(n) F(n-1) F(n-2) (n>2). Input Input consists of a sequence of lines, each containing an integer n. (n < 1,000,000). Output Print the word "yes" if 3 d…...

代码随想录 | Day28 | 回溯算法:组合组合总和III

代码随想录 | Day28 | 回溯算法&#xff1a;组合&&组合总和III 关于这个章节&#xff0c;大家最好是对递归函数的理解要比较到位&#xff0c;听着b站视频课可能呢才舒服点&#xff0c;可以先去搜一搜关于递归函数的讲解&#xff0c;理解&#xff0c;再开始这个章节会比…...

【重学 MySQL】四十五、数据库的创建、修改与删除

【重学 MySQL】四十五、数据库的创建、修改与删除 一条数据存储的过程数据输入数据验证数据处理数据存储数据持久化反馈与日志注意事项 标识符命名规则基本规则长度限制保留字与特殊字符命名建议示例 MySQL 中的数据类型创建数据库创建数据库时指定字符集和排序规则 查看数据库…...

STM32驱动直流电机

stm32通过PWM控制直流电机的方向和速度。 小直流电机需要几百毫安的电流&#xff0c;单片机只能提供几毫安的电流。电机内线圈转动时切割磁感线以及电机内转子线圈的电感效应都会产生反电动势&#xff0c;损坏芯片。 电机驱动芯片能够作为STM32驱动电机的帮手。 SLEEP暂停工作…...

【C++】二叉搜索树+变身 = AVL树

&#x1f680;个人主页&#xff1a;小羊 &#x1f680;所属专栏&#xff1a;C 很荣幸您能阅读我的文章&#xff0c;诚请评论指点&#xff0c;欢迎欢迎 ~ 目录 前言一、AVL树二、AVL树的实现2.1 平衡因子2.2 旋转处理2.2.1 左单旋&#xff1a;插入新节点后单纯的右边高2.2.2 …...

Flutter String 按 ,。分割

在 Flutter 中&#xff0c;如果你想将一个字符串按特定的字符&#xff08;例如中文逗号 &#xff0c; 和英文句号 .&#xff09;进行分割&#xff0c;可以使用 Dart 语言的字符串处理功能。具体来说&#xff0c;你可以使用 split 方法&#xff0c;并传入一个正则表达式来匹配这…...

Redis: 集群高可用之MOVED转向和ASK转向解决方案

MOVED转向 1 ) 问题描述 在客户端操作Redis集群的时候 MOVED转向 或 MOVED错误是经常遇到的一类问题我们先连入集群&#xff1a;$ /usr/local/redis/bin/redis-cli -a 123456 -h 192.168.10.101 -p 6371之前在Redis中存储过一些数据&#xff0c;比如下面的情况&#xff0c;当输…...

idea插件市场安装没反应

https://plugins.jetbrains.com/idea重启后还是不行那就...

数据结构之排序(5)

摘要&#xff1a;本文主要讲各种排序算法&#xff0c;注意它们的时间复杂度 概念 将各元素按关键字递增或递减排序顺序重新排列 评价指标 稳定性: 关键字相同的元素经过排序后相对顺序是否会改变 时间复杂度、空间复杂度 分类 内部排序——数据都在内存中 外部排序——…...

R包的安装、加载以及如何查看帮助文档

0x01 如何安装R包 一、通过R 内置函数安装&#xff08;常用&#xff09; 1.安装CRAN的R包 install.packages()是一个用于安装 R 包的重要函数。 语法&#xff1a;install.packages(pkgs, repos getOption("repos"),...) 其中&#xff1a; pkgs&#xff1a;要安…...

【YOLO学习】YOLOv3详解

文章目录 1. 网络结构1.1 结构介绍1.2 改进 2. 训练与测试过程3. 总结 1. 网络结构 1.1 结构介绍 1. 与 YOLOv2 不同的是&#xff0c;YOLOv3 在 Darknet-19 里加入了 ResNet 残差连接&#xff0c;改进之后的模型叫 Darknet-53。在 ImageNet上 实验发现 Darknet-53 相对于 ResN…...

JDK1.0主要特性

JDK 1.0&#xff0c;也被称为Java 1&#xff0c;是Java编程语言的第一个正式版本&#xff0c;由Sun Microsystems公司在1996年发布。JDK 1.0的发布标志着Java作为一种编程语言和平台的正式诞生&#xff0c;它带来了许多创新的概念和特性&#xff0c;对后来的软件开发产生了深远…...

CSS基础-盒子模型(三)

9、CSS盒子模型 9.1 CSS常用长度单位 1、px&#xff1a;像素&#xff1b; 2、em&#xff1a;相对元素font-size的倍数&#xff1b; 3、rem&#xff1a;相对根字体的大小&#xff0c;html标签即是根&#xff1b; 4、%&#xff1a;相对于父元素进行计算。 注意&#xff1a;CSS样…...

深度学习中的损失函数详解

深度学习中的损失函数详解 文章目录 深度学习中的损失函数详解损失函数的基础概念常见的损失函数类型及应用场景回归问题的损失函数分类问题的损失函数自定义损失函数 如何选择合适的损失函数&#xff1f;损失函数在深度学习中的应用 在深度学习的世界中&#xff0c;损失函数&a…...

系统架构设计师-下午案例题(2022年下半年)

1.试题-(共25分):阅读以下关于软件架构设计与评估的叙述在答题纸上回答问题1和问题2。 【说明】某电子商务公司拟升级其会员与促销管理系统&#xff0c;向用户提供个性化服务&#xff0c;提高用户的粘性。在项目立项之初&#xff0c;公司领导层一致认为本次升级的主要目标是提…...

高级图片编辑器Photopea

什么是 Photopea &#xff1f; Photopea 是一款免费的在线工具&#xff0c;用于编辑光栅和矢量图形&#xff0c;支持PSD、AI 和 Sketch文件。 功能上&#xff0c;Photopea 和 老苏之前介绍的 miniPaint 比较像 文章传送门&#xff1a;在线图片编辑器miniPaint 支持的格式 复杂…...

详解zookeeper四字命令

ZooKeeper 的四字命令&#xff08;Four-Letter Words, 4LW&#xff09;是一组简单的管理和监控命令&#xff0c;方便运维人员快速获取 ZooKeeper 集群和节点的运行状态。这些命令通常用于健康检查、性能监控、节点配置查看等操作。通过这些命令&#xff0c;可以轻松获取关于 Zo…...

ubuntu搭建nfs服务centos挂载访问

在Ubuntu上设置NFS服务器 在Ubuntu上&#xff0c;你可以使用apt包管理器来安装NFS服务器。打开终端并运行&#xff1a; sudo apt update sudo apt install nfs-kernel-server创建共享目录 创建一个目录用于共享&#xff0c;例如/shared&#xff1a; sudo mkdir /shared sud…...

第一篇:Agent2Agent (A2A) 协议——协作式人工智能的黎明

AI 领域的快速发展正在催生一个新时代&#xff0c;智能代理&#xff08;agents&#xff09;不再是孤立的个体&#xff0c;而是能够像一个数字团队一样协作。然而&#xff0c;当前 AI 生态系统的碎片化阻碍了这一愿景的实现&#xff0c;导致了“AI 巴别塔问题”——不同代理之间…...

C# 类和继承(抽象类)

抽象类 抽象类是指设计为被继承的类。抽象类只能被用作其他类的基类。 不能创建抽象类的实例。抽象类使用abstract修饰符声明。 抽象类可以包含抽象成员或普通的非抽象成员。抽象类的成员可以是抽象成员和普通带 实现的成员的任意组合。抽象类自己可以派生自另一个抽象类。例…...

ElasticSearch搜索引擎之倒排索引及其底层算法

文章目录 一、搜索引擎1、什么是搜索引擎?2、搜索引擎的分类3、常用的搜索引擎4、搜索引擎的特点二、倒排索引1、简介2、为什么倒排索引不用B+树1.创建时间长,文件大。2.其次,树深,IO次数可怕。3.索引可能会失效。4.精准度差。三. 倒排索引四、算法1、Term Index的算法2、 …...

【HTML-16】深入理解HTML中的块元素与行内元素

HTML元素根据其显示特性可以分为两大类&#xff1a;块元素(Block-level Elements)和行内元素(Inline Elements)。理解这两者的区别对于构建良好的网页布局至关重要。本文将全面解析这两种元素的特性、区别以及实际应用场景。 1. 块元素(Block-level Elements) 1.1 基本特性 …...

C# SqlSugar:依赖注入与仓储模式实践

C# SqlSugar&#xff1a;依赖注入与仓储模式实践 在 C# 的应用开发中&#xff0c;数据库操作是必不可少的环节。为了让数据访问层更加简洁、高效且易于维护&#xff0c;许多开发者会选择成熟的 ORM&#xff08;对象关系映射&#xff09;框架&#xff0c;SqlSugar 就是其中备受…...

【OSG学习笔记】Day 16: 骨骼动画与蒙皮(osgAnimation)

骨骼动画基础 骨骼动画是 3D 计算机图形中常用的技术&#xff0c;它通过以下两个主要组件实现角色动画。 骨骼系统 (Skeleton)&#xff1a;由层级结构的骨头组成&#xff0c;类似于人体骨骼蒙皮 (Mesh Skinning)&#xff1a;将模型网格顶点绑定到骨骼上&#xff0c;使骨骼移动…...

vue3+vite项目中使用.env文件环境变量方法

vue3vite项目中使用.env文件环境变量方法 .env文件作用命名规则常用的配置项示例使用方法注意事项在vite.config.js文件中读取环境变量方法 .env文件作用 .env 文件用于定义环境变量&#xff0c;这些变量可以在项目中通过 import.meta.env 进行访问。Vite 会自动加载这些环境变…...

Java线上CPU飙高问题排查全指南

一、引言 在Java应用的线上运行环境中&#xff0c;CPU飙高是一个常见且棘手的性能问题。当系统出现CPU飙高时&#xff0c;通常会导致应用响应缓慢&#xff0c;甚至服务不可用&#xff0c;严重影响用户体验和业务运行。因此&#xff0c;掌握一套科学有效的CPU飙高问题排查方法&…...

Aspose.PDF 限制绕过方案:Java 字节码技术实战分享(仅供学习)

Aspose.PDF 限制绕过方案&#xff1a;Java 字节码技术实战分享&#xff08;仅供学习&#xff09; 一、Aspose.PDF 简介二、说明&#xff08;⚠️仅供学习与研究使用&#xff09;三、技术流程总览四、准备工作1. 下载 Jar 包2. Maven 项目依赖配置 五、字节码修改实现代码&#…...