当前位置: 首页 > 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…...

JavaSec-RCE

简介 RCE(Remote Code Execution)&#xff0c;可以分为:命令注入(Command Injection)、代码注入(Code Injection) 代码注入 1.漏洞场景&#xff1a;Groovy代码注入 Groovy是一种基于JVM的动态语言&#xff0c;语法简洁&#xff0c;支持闭包、动态类型和Java互操作性&#xff0c…...

基于FPGA的PID算法学习———实现PID比例控制算法

基于FPGA的PID算法学习 前言一、PID算法分析二、PID仿真分析1. PID代码2.PI代码3.P代码4.顶层5.测试文件6.仿真波形 总结 前言 学习内容&#xff1a;参考网站&#xff1a; PID算法控制 PID即&#xff1a;Proportional&#xff08;比例&#xff09;、Integral&#xff08;积分&…...

API网关Kong的鉴权与限流:高并发场景下的核心实践

&#x1f525;「炎码工坊」技术弹药已装填&#xff01; 点击关注 → 解锁工业级干货【工具实测|项目避坑|源码燃烧指南】 引言 在微服务架构中&#xff0c;API网关承担着流量调度、安全防护和协议转换的核心职责。作为云原生时代的代表性网关&#xff0c;Kong凭借其插件化架构…...

多元隐函数 偏导公式

我们来推导隐函数 z z ( x , y ) z z(x, y) zz(x,y) 的偏导公式&#xff0c;给定一个隐函数关系&#xff1a; F ( x , y , z ( x , y ) ) 0 F(x, y, z(x, y)) 0 F(x,y,z(x,y))0 &#x1f9e0; 目标&#xff1a; 求 ∂ z ∂ x \frac{\partial z}{\partial x} ∂x∂z​、 …...

门静脉高压——表现

一、门静脉高压表现 00:01 1. 门静脉构成 00:13 组成结构&#xff1a;由肠系膜上静脉和脾静脉汇合构成&#xff0c;是肝脏血液供应的主要来源。淤血后果&#xff1a;门静脉淤血会同时导致脾静脉和肠系膜上静脉淤血&#xff0c;引发后续系列症状。 2. 脾大和脾功能亢进 00:46 …...

【java面试】微服务篇

【java面试】微服务篇 一、总体框架二、Springcloud&#xff08;一&#xff09;Springcloud五大组件&#xff08;二&#xff09;服务注册和发现1、Eureka2、Nacos &#xff08;三&#xff09;负载均衡1、Ribbon负载均衡流程2、Ribbon负载均衡策略3、自定义负载均衡策略4、总结 …...

云原生安全实战:API网关Envoy的鉴权与限流详解

&#x1f525;「炎码工坊」技术弹药已装填&#xff01; 点击关注 → 解锁工业级干货【工具实测|项目避坑|源码燃烧指南】 一、基础概念 1. API网关 作为微服务架构的统一入口&#xff0c;负责路由转发、安全控制、流量管理等核心功能。 2. Envoy 由Lyft开源的高性能云原生…...

深入解析光敏传感技术:嵌入式仿真平台如何重塑电子工程教学

一、光敏传感技术的物理本质与系统级实现挑战 光敏电阻作为经典的光电传感器件&#xff0c;其工作原理根植于半导体材料的光电导效应。当入射光子能量超过材料带隙宽度时&#xff0c;价带电子受激发跃迁至导带&#xff0c;形成电子-空穴对&#xff0c;导致材料电导率显著提升。…...

前端工具库lodash与lodash-es区别详解

lodash 和 lodash-es 是同一工具库的两个不同版本&#xff0c;核心功能完全一致&#xff0c;主要区别在于模块化格式和优化方式&#xff0c;适合不同的开发环境。以下是详细对比&#xff1a; 1. 模块化格式 lodash 使用 CommonJS 模块格式&#xff08;require/module.exports&a…...

嵌入式面试常问问题

以下内容面向嵌入式/系统方向的初学者与面试备考者,全面梳理了以下几大板块,并在每个板块末尾列出常见的面试问答思路,帮助你既能夯实基础,又能应对面试挑战。 一、TCP/IP 协议 1.1 TCP/IP 五层模型概述 链路层(Link Layer) 包括网卡驱动、以太网、Wi‑Fi、PPP 等。负责…...