PolarDB
PolarDB for PostgreSQL,带有 aurora 风格的 RAC
PolarDB 是一个由阿里云开发并开源的 aurora RAC 风格"云原生"数据库系统。
当前仓库中的最新版本 v15.15.5.0 与 PostgreSQL 15 兼容,在所有 Pigsty 支持的操作系统上都可用。
快速开始
curl -fsSL https://repo.pigsty.io/get | bash; cd ~/pigsty;
./configure -c polar # 使用 polar(PolarDB)模板
./install.yml # 运行部署剧本配置
需要调整以下参数来部署 PolarDB 集群:
pg-meta:
hosts:
10.10.10.10: { pg_seq: 1, pg_role: primary }
vars:
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 for meta database }
pg_databases:
- {name: meta ,baseline: cmdb.sql ,comment: pigsty meta database ,schemas: [pigsty]}
pg_hba_rules:
- {user: dbuser_view , db: all ,addr: infra ,auth: pwd ,title: 'allow grafana dashboard access cmdb from infra nodes'}
node_crontab: [ '00 01 * * * postgres /pg/bin/pg-backup full' ] # 每天凌晨 1 点进行全量备份
# PolarDB 临时设置
pg_version: 15 # PolarDB PG 基于 PG 15
pg_mode: polar # PolarDB PG 兼容模式
pg_packages: [ polardb, pgsql-common ] # 用 PolarDB 内核替换 PG 内核
pg_exporter_exclude_database: 'template0,template1,postgres,polardb_admin'
pg_default_roles: # PolarDB 要求 replicator 为超级用户
- { name: dbrole_readonly ,login: false ,comment: role for global read-only access }
- { name: dbrole_offline ,login: false ,comment: role for restricted read-only access }
- { name: dbrole_readwrite ,login: false ,roles: [dbrole_readonly] ,comment: role for global read-write access }
- { name: dbrole_admin ,login: false ,roles: [pg_monitor, dbrole_readwrite] ,comment: role for object creation }
- { name: postgres ,superuser: true ,comment: system superuser }
- { name: replicator ,superuser: true ,replication: true ,roles: [pg_monitor, dbrole_readonly] ,comment: system replicator } # <- 复制需要超级用户权限
- { name: dbuser_dba ,superuser: true ,roles: [dbrole_admin] ,pgbouncer: true ,pool_mode: session, pool_connlimit: 16 ,comment: pgsql admin user }
- { name: dbuser_monitor ,roles: [pg_monitor] ,pgbouncer: true ,parameters: {log_min_duration_statement: 1000 } ,pool_mode: session ,pool_connlimit: 8 ,comment: pgsql monitor user }PolarDB for PostgreSQL 本质上等价于 PostgreSQL 15,任何与 PostgreSQL 线协议兼容的客户端工具都可以访问 PolarDB 集群。
扩展
PGSQL 模块的大多数扩展(非纯 SQL)不能直接在 PolarDB 内核上使用。如果您需要使用它们,您需要为新内核从源代码重新编译和安装。
这是 PolarDB 内核提供的扩展列表:
| name | Version | comment |
|---|---|---|
| adminpack | 2.1 | administrative functions for PostgreSQL |
| amcheck | 1.3 | functions for verifying relation integrity |
| autoinc | 1.0 | functions for autoincrementing fields |
| bloom | 1.0 | bloom access method - signature file based index |
| bool_plperl | 1.0 | transform between bool and plperl |
| bool_plperlu | 1.0 | transform between bool and plperlu |
| btree_gin | 1.3 | support for indexing common datatypes in GIN |
| btree_gist | 1.7 | support for indexing common datatypes in GiST |
| citext | 1.6 | data type for case-insensitive character strings |
| cube | 1.5 | data type for multidimensional cubes |
| dblink | 1.2 | connect to other PostgreSQL databases from within a database |
| dict_int | 1.0 | text search dictionary template for integers |
| dict_xsyn | 1.0 | text search dictionary template for extended synonym processing |
| earthdistance | 1.1 | calculate great-circle distances on the surface of the Earth |
| file_fdw | 1.0 | foreign-data wrapper for flat file access |
| fuzzystrmatch | 1.1 | determine similarities and distance between strings |
| hll | 2.18 | type for storing hyperloglog data |
| hstore | 1.8 | data type for storing sets of (key, value) pairs |
| hstore_plperl | 1.0 | transform between hstore and plperl |
| hstore_plperlu | 1.0 | transform between hstore and plperlu |
| hstore_plpython3u | 1.0 | transform between hstore and plpython3u |
| hypopg | 1.3.1 | Hypothetical indexes for PostgreSQL |
| insert_username | 1.0 | functions for tracking who changed a table |
| intagg | 1.1 | integer aggregator and enumerator (obsolete) |
| intarray | 1.5 | functions, operators, and index support for 1-D arrays of integers |
| isn | 1.2 | data types for international product numbering standards |
| jsonb_plperl | 1.0 | transform between jsonb and plperl |
| jsonb_plperlu | 1.0 | transform between jsonb and plperlu |
| jsonb_plpython3u | 1.0 | transform between jsonb and plpython3u |
| lo | 1.1 | Large Object maintenance |
| log_fdw | 1.4 | foreign-data wrapper for Postgres log file access |
| ltree | 1.2 | data type for hierarchical tree-like structures |
| ltree_plpython3u | 1.0 | transform between ltree and plpython3u |
| moddatetime | 1.0 | functions for tracking last modification time |
| old_snapshot | 1.0 | utilities in support of old_snapshot_threshold |
| pageinspect | 1.11 | inspect the contents of database pages at a low level |
| pase | 0.0.1 | ant ai similarity search |
| pg_bigm | 1.2 | text similarity measurement and index searching based on bigrams |
| pg_buffercache | 1.4 | examine the shared buffer cache |
| pg_freespacemap | 1.2 | examine the free space map (FSM) |
| pg_jieba | 1.1.0 | a parser for full-text search of Chinese |
| pg_prewarm | 1.2 | prewarm relation data |
| pg_repack | 1.5.1-1 | Reorganize tables in PostgreSQL databases with minimal locks |
| pg_stat_statements | 1.10 | track planning and execution statistics of all SQL statements executed |
| pg_surgery | 1.0 | extension to perform surgery on a damaged relation |
| pg_trgm | 1.6 | text similarity measurement and index searching based on trigrams |
| pg_visibility | 1.2 | examine the visibility map (VM) and page-level visibility info |
| pg_walinspect | 1.0 | functions to inspect contents of PostgreSQL Write-Ahead Log |
| pgcrypto | 1.3 | cryptographic functions |
| pgrowlocks | 1.2 | show row-level locking information |
| pgstattuple | 1.5 | show tuple-level statistics |
| plperl | 1.0 | PL/Perl procedural language |
| plperlu | 1.0 | PL/PerlU untrusted procedural language |
| plpgsql | 1.0 | PL/pgSQL procedural language |
| plpython3u | 1.0 | PL/Python3U untrusted procedural language |
| pltcl | 1.0 | PL/Tcl procedural language |
| pltclu | 1.0 | PL/TclU untrusted procedural language |
| polar_audit | 1.0 | provides auditing functionality |
| polar_feature_utils | 1.0 | PolarDB feature utilization |
| polar_io_stat | 1.0 | polar io stat in multi dimension |
| polar_login_history | 1.0 | record user login information |
| polar_masking | 1.0.0 | provides data masking for polardb |
| polar_monitor | 1.0 | monitor functions for PolarDB |
| polar_monitor_preload | 1.0 | examine the polardb information |
| polar_parameter_manager | 1.1 | Extension to select parameters for manger. |
| polar_password_policy | 1.0 | create password policies and check user passwords based on the policies |
| polar_proxy_utils | 1.0 | Extension to provide operations about proxy. |
| polar_resource_manager | 1.0 | a background process that forcibly frees user session process memory |
| polar_smgrperf | 1.0 | smgr perf test extension |
| polar_sql_mapping | 1.0 | Record error sqls and mapping them to correct one |
| polar_stat_env | 1.0 | env stat functions for PolarDB |
| polar_vfs | 1.0 | polar virtual file system for different storage |
| polar_worker | 1.0 | polar_worker |
| postgres_fdw | 1.1 | foreign-data wrapper for remote PostgreSQL servers |
| refint | 1.0 | functions for implementing referential integrity (obsolete) |
| roaringbitmap | 0.5 | support for Roaring Bitmaps |
| seg | 1.4 | data type for representing line segments or floating-point intervals |
| sslinfo | 1.2 | information about SSL certificates |
| tablefunc | 1.0 | functions that manipulate whole tables, including crosstab |
| tcn | 1.0 | Triggered change notifications |
| tsm_system_rows | 1.0 | TABLESAMPLE method which accepts number of rows as a limit |
| tsm_system_time | 1.0 | TABLESAMPLE method which accepts time in milliseconds as a limit |
| unaccent | 1.1 | text search dictionary that removes accents |
| uuid-ossp | 1.1 | generate universally unique identifiers (UUIDs) |
| vector | 0.6.2 | vector data type and ivfflat and hnsw access methods |
| xml2 | 1.1 | XPath querying and XSLT |
PolarDB for Oracle
还有 PolarDB 的第二个分支,即 PolarDB for Oracle,它不是开源的。
Pigsty Pro 支持将 PolarDB for Oracle 作为 RDS 运行。