# Percona

> 支持 TDE 透明加密的 Percona Postgres 发行版

---

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

---

[Percona Postgres](https://www.percona.com/postgresql/software/postgresql-distribution) 是一个带有 [`pg_tde`](https://docs.percona.com/pg-tde/index.html)（透明数据加密）扩展的补丁 Postgres 内核。

Pigsty 从 v4.4.0 起将 Percona PostgreSQL 打包到私有前缀 `/usr/pgtde-$v`，v4.5.0 延续这一布局
（PostgreSQL 18 对应 `/usr/pgtde-18`）。`pgtde` 包别名会同时安装内核包
与 contrib 包，其中包含 `pg_tde`、PostGIS、pgvector、wal2json、pg_repack、
pgaudit、pg_stat_monitor 等常用组件。

- [Percona 透明数据加密（TDE）性能测试](https://andreas.scherbaum.la/post/2025-06-30_performance-test-for-percona-transparent-data-encryption-tde/)


------

## 快速开始

使用 Pigsty [**标准安装流程**](/docs/setup/install)，配合 [`pgtde`](https://github.com/pgsty/pigsty/blob/main/conf/pgtde.yml) 配置模板。

```bash
curl -fsSL https://repo.pigsty.io/get | bash; cd ~/pigsty;
./configure -c pgtde     # 使用 percona postgres 内核
./deploy.yml             # 部署 Pigsty 核心链路与 Percona PostgreSQL
```



------

## 配置

需要调整以下参数来部署 Percona 集群：

```yaml
pg-meta:
  hosts:
    10.10.10.10: { pg_seq: 1, pg_role: primary }
  vars:
    pg_mode: pgtde
    pg_cluster: pg-meta
    pg_users:
      - { name: dbuser_meta ,password: DBUser.Meta   ,pgbouncer: true ,roles: [dbrole_admin   ] ,comment: pigsty admin user }
      - { name: dbuser_view ,password: DBUser.Viewer ,pgbouncer: true ,roles: [dbrole_readonly] ,comment: read-only viewer  }
    pg_databases:
      - name: meta
        baseline: cmdb.sql
        comment: pigsty tde database
        schemas: [pigsty]
        extensions: [ vector, postgis, pg_tde ,pgaudit, { name: pg_stat_monitor, schema: monitor } ]
    pg_hba_rules:
      - { user: dbuser_view , db: all ,addr: infra ,auth: pwd ,title: 'allow grafana dashboard access cmdb from infra nodes' }
    pg_crontab: [ '00 01 * * * /pg/bin/pg-backup full' ] # 每天凌晨 1 点进行全量备份

    # Percona PostgreSQL TDE 内核设置
    pg_packages: [ pgtde, pgsql-common ]
    pg_libs: 'pg_tde, pgaudit, pg_stat_statements, pg_stat_monitor, auto_explain'
```

`pgtde` 软件包由 Pigsty 的 `pgsql` 仓库模块提供，此模板不再依赖旧的
`percona` 仓库模块。


------

## 可用扩展

Percona Postgres 内核共有 **73** 个可用扩展，去除 PG Contrib 自带扩展之后，还有以下额外扩展：

| 扩展名                                                                 | 版本号     | 说明                                                                                                                                                                                                                                                        |
|:--------------------------------------------------------------------|:--------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [address_standardizer](https://pigsty.cc/ext/e/address_standardizer)                 | `3.5.7` | Used to parse an address into constituent elements. Generally used to support geocoding address normalization step.                                                                                                                                       |
| [address_standardizer_data_us](https://pigsty.cc/ext/e/address_standardizer_data_us) | `3.5.7` | Address Standardizer US dataset example                                                                                                                                                                                                                   |
| [pg_repack](https://pigsty.cc/ext/e/pg_repack)                                       | `1.5.3` | Reorganize tables in PostgreSQL databases with minimal locks                                                                                                                                                                                              |
| [pg_stat_monitor](https://pigsty.cc/ext/e/pg_stat_monitor)                           | `2.3.2` | The pg_stat_monitor is a PostgreSQL Query Performance Monitoring tool, based on PostgreSQL contrib module pg_stat_statements. pg_stat_monitor provides aggregated statistics, client information, plan details including plan, and histogram information. |
| [pg_tde](https://pigsty.cc/ext/e/pg_tde)                                             | `2.2.1` | pg_tde access method                                                                                                                                                                                                                                      |
| [pgaudit](https://pigsty.cc/ext/e/pgaudit)                                           | `18.0`  | provides auditing functionality                                                                                                                                                                                                                           |
| [postgis](https://pigsty.cc/ext/e/postgis)                                           | `3.5.7` | PostGIS geometry and geography spatial types and functions                                                                                                                                                                                                |
| [postgis_raster](https://pigsty.cc/ext/e/postgis_raster)                             | `3.5.7` | PostGIS raster types and functions                                                                                                                                                                                                                        |
| [postgis_sfcgal](https://pigsty.cc/ext/e/postgis_sfcgal)                             | `3.5.7` | PostGIS SFCGAL functions                                                                                                                                                                                                                                  |
| [postgis_tiger_geocoder](https://pigsty.cc/ext/e/postgis_tiger_geocoder)             | `3.5.7` | PostGIS tiger geocoder and reverse geocoder                                                                                                                                                                                                               |
| [postgis_topology](https://pigsty.cc/ext/e/postgis_topology)                         | `3.5.7` | PostGIS topology spatial types and functions                                                                                                                                                                                                              |
| [set_user](https://pigsty.cc/ext/e/set_user)                                         | `4.2.0` | similar to SET ROLE but with added logging                                                                                                                                                                                                                |
| [vector](https://pigsty.cc/ext/e/vector)                                             | `0.8.3` | vector data type and ivfflat and hnsw access methods                                                                                                                                                                                                      |
{.full-width}

------

## 关键特性

- **透明数据加密**：使用 pg_tde 扩展提供静态数据加密
- **PostgreSQL 18 兼容**：基于 Percona PostgreSQL 18 包集
- **企业级扩展**：包含 pgaudit、pg_stat_monitor 等企业级功能
- **完整生态**：支持 pgvector、PostGIS 等流行扩展

> **注意**：目前处于稳定阶段 - 在生产使用前请彻底评估。
