# Pigsty v4.1.0

> 大小版本更新支持，Agent-Native CLI，默认防火墙安全策略收紧

---

LLMS 索引： [llms.txt](/zh/llms.txt)

---

**v4\.1\.0 · 2026-02-12**
- [查看发布](https://github.com/pgsty/pigsty/releases/tag/v4.1.0)
- [源码 · tar\.gz](https://github.com/pgsty/pigsty/archive/refs/tags/v4.1.0.tar.gz)
- [源码 · zip](https://github.com/pgsty/pigsty/archive/refs/tags/v4.1.0.zip)
- [pgsty\/pigsty](https://github.com/pgsty/pigsty)

```bash
curl https://pigsty.cc/get | bash -s v4.1.0
```

**72 个提交**，252 文件变更，+5,744 / -5,015 行（`v4.0.0..v4.1.0`，2026-02-02 ~ 2026-02-13）

## 亮点特性

- 新增 7 个扩展，总计 **451** 个扩展支持。
- `pig` 从传统脚本接口升级为 **Agent-Native CLI**（`1.0.0 -> 1.1.0`），支持主动暴露上下文并提供 JSON/YAML 输出。
- `pig` 新增 PostgreSQL / OS **大小版本更新** 统一能力（覆盖 major/minor 升级流程）。
- `pg_exporter` 升级到 **v1.2.0**（`1.1.2 -> 1.2.0`），并修复 PG17/18 指标链路与单位换算。
- 防火墙默认安全策略更新：`node_firewall_mode` 默认改为 `zone`，`node_firewall_public_port` 默认从 `[22,80,443,5432]` 收敛为 `[22,80,443]`。
- PostgreSQL 小版本更新：18.2、17.8、16.12、15.16、14.21。
- EL 默认小版本更新到 `EL 9.7 / EL 10.1`，Debian 默认小版本更新到 `12.13 / 13.3`。
- 集中修复 PGSQL / PGCAT Grafana 看板可用性：`$dsn` 动态数据源、schema 级跳转、Age 指标、链接映射与语义一致性。
- 新增 Mattermost 一键应用模板，支持数据库、目录、门户与可选 PGFS/JuiceFS 方案。
- 重构 `infra-rm` 卸载逻辑，新增 `deregister` 分段清理能力，可回收 Victoria target、Grafana datasource、Vector 日志配置。
- 优化 PostgreSQL 默认 autovacuum 阈值，减少小表高频 vacuum/analyze。
- 修复 FD 上限链路：新增 `fs.nr_open=8M` 并统一 `LimitNOFILE=8M`，避免 systemd/setrlimit 导致服务启动失败。
- 调整 Vibe 默认体验：Jupyter 默认关闭，Claude Code 改由 npm 包统一安装管理。

## 版本更新

- Pigsty 版本：`v4.0.0 -> v4.1.0`
- `pig` CLI：`1.0.0 -> 1.1.0`（Agent-Native + 大小版本更新支持）
- `pg_exporter`：`1.1.2 -> 1.2.0`
- 默认 EL 小版本：`9.6/10.0 -> 9.7/10.1`
- 默认 Debian 小版本：`12.12/13.1 -> 12.13/13.3`

## 扩展更新
- [RPM Changelog 2026-02-12](https://pigsty.cc/docs/repo/pgsql/rpm/#2026-02-12)
- [DEB Changelog 2026-02-12](https://pigsty.cc/docs/repo/pgsql/deb/#2026-02-12)
- timescaledb `2.24.0 -> 2.25.0`
- pg_search `0.21.4 -> 0.21.7`
- pgmq `1.9.0 -> 1.10.0`
- pg_textsearch `0.4.0 -> 0.5.0`
- pljs `1.0.4 -> 1.0.5`
- pg_track_optimizer `0.9.1`（新增）
- nominatim_fdw `1.1.0`（新增）
- pg_utl_smtp `1.0.0`（新增）
- pg_strict `1.0.2`（新增）
- pgmb `1.0.0`（新增）
- pg_pwhash（新增支持）
- informix_fdw（新增支持）

## INFRA 组件版本

[Infra Changelog 2026-02-12](https://pigsty.cc/docs/repo/infra/log/#2026-02-12)

| 软件包                 | 版本      | 软件包               | 版本       |
|---------------------|---------|-------------------|----------|
| victoria-metrics    | 1.135.0 | victoria-logs     | 1.45.0   |
| vector              | 0.53.0  | grafana           | 12.3.2   |
| alertmanager        | 0.31.1  | etcd              | 3.6.7    |
| duckdb              | 1.4.4   | pg_exporter       | 1.2.0    |
| pig                 | 1.1.0   | claude            | 2.1.37   |
| opencode            | 1.1.59  | uv                | 0.10.0   |
| code-server         | 4.108.2 | caddy             | 2.10.2   |
| hugo                | 0.155.2 | cloudflared       | 2026.2.0 |
| headscale           | 0.28.0  |                   |          |

## API 变化

- `io_method` / `io_workers` 模板生效条件从 `pg_version >= 17` 更正为 `pg_version >= 18`。
- `idle_replication_slot_timeout` / `initdb --no-data-checksums` 的 PG18 守卫条件修正。
- `maintenance_io_concurrency` 生效范围放宽至 `PG13+`。
- `autovacuum_vacuum_threshold`：`oltp/crit/tiny` 从 50 提升到 500，`olap` 提升到 1000。
- `autovacuum_analyze_threshold`：`oltp/crit/tiny` 从 50 提升到 250，`olap` 提升到 500。
- `checkpoint_completion_target` 默认从 `0.90` 提升到 `0.95`。
- Node tuned 模板新增 `fs.nr_open=8388608`，并统一 `fs.file-max / fs.nr_open / LimitNOFILE` 层级关系。
- postgres、patroni、minio 的 systemd `LimitNOFILE` 从 `16777216` 调整为 `8388608`。
- `node_sysctl_params` 默认加入 `fs.nr_open: 8388608`。
- `node_firewall_mode` 默认值从 `none` 调整为 `zone`：默认启用防火墙，内网信任，公网仅开放 `node_firewall_public_port`；如需完全自管防火墙请设为 `none`。
- `node_firewall_public_port` 默认值从 `[22,80,443,5432]` 调整为 `[22,80,443]`，数据库端口 `5432` 需要按需显式添加。注意防火墙规则为“只增不删”，存量节点若已放行 `5432` 需手工移除；单机体验模板（如 `meta` / `vibe`）会显式覆盖并保留 `5432` 以便远程使用。
- `bin/validate` 新增 `pg_databases[*].parameters` 与 `pg_hba_rules[*].order` 校验支持，并修复 HBA 错误未正确返回失败的问题。
- `infra-rm.yml` 新增 `deregister`、`config`、`env` 等分段标签。
- Vibe 默认 `jupyter_enabled=false`，`npm_packages` 默认加入 `@anthropic-ai/claude-code`、`happy-coder`，并新增 `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`。
- PgBouncer 参数别名收敛：`pool_size_reserve -> pool_reserve`，`pool_max_db_conn -> pool_connlimit`。

## 兼容性修复（去重归并）

- 注：同一问题的重复回补（反复引入后再次修复）仅计一次，以下按问题域归并。
- 修复 Redis `replicaof` 判空逻辑与 systemd 停止行为。
- 修复 `pg_migration` 脚本 schema/table/sequence 全限定、标识符 quoting 与日志格式字符串安全问题。
- 修复 pgsql role handler 重启对象与变量使用错误。
- 修复 blackbox 配置文件名清理项与 pgAdmin pgpass 文件格式。
- `pg_exporter` 启动改为非阻断，避免 exporter 启动失败拖慢主流程。
- VIP 地址解析逻辑简化，未显式 CIDR 时默认掩码 `24`。
- MinIO 健康检查重试从 `3` 提升到 `5`。
- 节点主机名设置改用 hostname 模块，替代 shell 调用。
- 修复 `app/electric` 与 `app/pg_exporter` 的 `.env` 格式为标准 `KEY=VALUE`。
- 修复 `pigsty.yml` 的 `pg_crontab` 语法错误。
- 更新 ETCD 文档，明确默认 TLS 与可选 mTLS 的语义差异。
- 修复 `repo-add` 参数传递、Debian 中国镜像组件兼容性、`bin/psql.py` 的 Python3 兼容性。
- 加固 redis exporter 凭据文件权限，减少敏感信息暴露风险。
- `pgsql-user.yml` 隐藏用户凭据日志输出并对敏感步骤启用 `no_log`。
- 修复 `pg_monitor` 注册 Victoria target 的 gate 条件。
- `pg_remove` 备份清理改为集群级目录，避免误删其他集群备份。

## 提交清单（v4.0.0..v4.1.0，共 72，2026-02-02 ~ 2026-02-13）

```text
7410de401 v4.1.0 release
fa31213ce conf(node): default firewall to zone with single-node 5432 override
bb8382c58 update default extension list to 451
770d01959 hide user credential in pgsql-user playbook
7219a896c pg_monitor: fix victoria registration gate conditions
084c98432 remove one cluster in backup dir during pg_remove
7005617f1 pgsql: drop legacy pgbouncer pool parameter aliases
f8165a886 docs(roles): fix typos and align juice role documentation
06a589218 chore(meta): normalize platform versions for current lint schema
e0a208248 fix(roles): harden redis exporter file permissions
fd0469881 terraform/vagrant: parameterize aliyun region/zone, fix vagrant scripts
74c59aabe grafana: fix dashboard links, descriptions, and overrides
443e58724 conf: clean legacy params and fix template references
536c4b39d adjust grafana dashboard dead links
f3b9866ce grafana(pgsql): fix panel typos and title consistency
bcb69be11 grafana(pgsql): fix drilldown links and variable mappings
1ce4374a1 grafana: fill pglog panel titles and normalize wording
2d127f9f4 grafana: fix minio traffic metrics and pigsty dashboard links
9d3ca0118 grafana: align victoria instance dashboards with query scope
55bc61622 grafana: fix infra dashboard copy, links, and table semantics
607b75535 grafana(node): fix panel drilldown links and clean dashboard metadata
1321de532 grafana(redis): fix dashboard links and blocked-clients panel semantics
91e0c8437 fix(grafana): correct Redis alert drill-down dashboard links
0fde78c02 fix(tooling): improve Python3 compatibility and enforce vagrant scale lower bound
fa3454a52 fix(bootstrap): use Debian-compatible components for CN apt mirror
36c95c749 fix(cli): restore repo-add execution and HBA validation failure propagation
797385929 add macbook local vagrant image override
f9c928e32 fix(grafana): restore reverted dashboard bugfixes
c11af8b6a Bump version to v4.1.0
307a236ba update extension list
f17024807 override el9/u24 vagrant box for convient testing
c2ada1283 terraform: bump Aliyun Debian images to 12.13/13.3
25bd8210f fix(node): add daemon_reload to systemd tasks for keepalived, chronyd, and cron
6f2576fd0 fix(node): set default fs.nr_open via node_sysctl_params
43a71245e add pg_bgwriter_buffers_backend for pg 17-
da832a47b fix(monitor): keep checkpointer metrics for checkpoint stats
90434ca8a fix(monitor): add pg_bgwriter fallback for checkpointer metrics
e2d75e787 fix(monitor): use pg_checkpointer metrics for checkpoint stats
a0b7474f8 fix grafana dashboard metrics and lengend
27ddacbc6 vagrant: refresh box selector and OS shortcuts
26e108788 fix(monitor): correct unit for time metrics scaled by pg_exporter
ee90044b5 fix(pgsql): correct min_parallel scan size params in oltp/crit templates
d439464b2 pgsql: fix pg_version guards for PG18-only settings
26320f120 docs: recommend RockyLinux 10.1
1e9b9f33a terraform: bump Aliyun Rocky images to 9.7/10.1
d6e9c7122 monitor: optimize table/index bloat estimators
42d45d32e fix(grafana): align panel semantics across node/infra/redis
3972d2c45 fix(grafana/pgsql): align dashboard semantics for query monitoring
cb52375ac bump checkpoint_completion_target from 0.90 to 0.95
13115a95d fix legend in pgsql-persist checkpoint panel
102cd2edb fix(pg_migration): make template logging format-safe
c402f0e6d fix: correct io_method/io_workers version guard from PG17 to PG18
3bf676546 vibe: disable jupyter by default and install claude-code via npm_packages
613c4efa9 fix: set fs.nr_open in tuned profiles and reduce LimitNOFILE to 8M
07e499d4d new app conf template matter most
4cc68ed61 Refine infra removal playbook
7cfb98f69 fix: app docker .env file format
9b36b1875 Fix config templates and validation
318d85e6e Simplify VIP parsing and make pg_exporter non-blocking
571cd9e70 Use hostname module for nodename
de98f073c Fix blackbox config filename and pgpass format
4bff01100 Fix redis replicaof guard and systemd stop
38445b68d minio: increase health check retries
c99854969 docs(etcd): clarify TLS vs mTLS
41229124a fix pgsql roles typo
e575d17c6 fix pg_migration scripts to use fully qualified identifiers
ec4207202 fix pgsql-schema broken links
a237e6c99 tune autovacuum threshold to reduce small table vacuum frequency
e80754760 fix pgcat-database links to pgcat-table https://github.com/pgsty/pigsty/issues/690
0060f5346 fix pgsql-database / pgsql-databases age metric fix https://github.com/pgsty/pigsty/issues/695
43cdf72bc fix pigsty.yml typo
0d9db7b08 fix: update datasource to $dsn - fix https://github.com/pgsty/pigsty/issues/692#issuecomment-3835461620
```

## 致谢

- 感谢 [@l2dy](https://github.com/l2dy) 为本项目提出诸多改进意见与 Issue。

## 校验和

```bash
8bc75e8df0e3830931f2ddab71b89630  pigsty-v4.1.0.tgz
da10de99d819421630f430d01bc9de62  pigsty-pkg-v4.1.0.d12.aarch64.tgz
e1f2ed2da0d6b8c360f9fa2faaa7e175  pigsty-pkg-v4.1.0.d12.x86_64.tgz
382bb38a81c138b1b3e7c194211c2138  pigsty-pkg-v4.1.0.d13.aarch64.tgz
13ceaa728901cc4202687f03d25f1479  pigsty-pkg-v4.1.0.d13.x86_64.tgz
92d061de4d495d05d42f91e4283e7502  pigsty-pkg-v4.1.0.el10.aarch64.tgz
be629ea91adf86bbd7e1c59b659d0069  pigsty-pkg-v4.1.0.el10.x86_64.tgz
c14be706119ba33dd06c71dda6c02298  pigsty-pkg-v4.1.0.el8.aarch64.tgz
0c8b6952ffc00e3b169896129ea39184  pigsty-pkg-v4.1.0.el8.x86_64.tgz
cfcc63b9ecc525165674f58f9365aa19  pigsty-pkg-v4.1.0.el9.aarch64.tgz
34f733080bfa9c8515d1573c35f3e870  pigsty-pkg-v4.1.0.el9.x86_64.tgz
ad52ce9bf25e4d834e55873b3f9ada51  pigsty-pkg-v4.1.0.u22.aarch64.tgz
300b2185c61a03ea7733248e526f3342  pigsty-pkg-v4.1.0.u22.x86_64.tgz
2e561e6ae9abb14796872059d2f694a8  pigsty-pkg-v4.1.0.u24.aarch64.tgz
c462bb4cb2359e771ffcad006888fbd4  pigsty-pkg-v4.1.0.u24.x86_64.tgz
```

## 信息来源

- [GitHub Release](https://github.com/pgsty/pigsty/releases/tag/v4.1.0)
- [Pigsty v4.1 发布文章](https://pigsty.cc/blog/pigsty/v4.1/)
- [历史 About / 发布注记](https://pigsty.cc/docs/about/release/#v410)
- [源码对比：`v4.0.0...v4.1.0`](https://github.com/pgsty/pigsty/compare/v4.0.0...v4.1.0)
