From 1faa9f5466dfc804a55bee94d4879e71c74ea019 Mon Sep 17 00:00:00 2001 From: Steven Niu Date: Thu, 9 Apr 2026 16:31:32 +0800 Subject: [PATCH 1/2] support redis_fdw and add missing content in overview part of ecosystem --- CN/modules/ROOT/nav.adoc | 1 + .../ecosystem_overview.adoc | 12 +- .../ecosystem_components/redis_fdw.adoc | 110 ++++++++++++++++++ EN/modules/ROOT/nav.adoc | 1 + .../ecosystem_overview.adoc | 12 +- .../ecosystem_components/redis_fdw.adoc | 108 +++++++++++++++++ 6 files changed, 236 insertions(+), 8 deletions(-) create mode 100644 CN/modules/ROOT/pages/master/ecosystem_components/redis_fdw.adoc create mode 100644 EN/modules/ROOT/pages/master/ecosystem_components/redis_fdw.adoc diff --git a/CN/modules/ROOT/nav.adoc b/CN/modules/ROOT/nav.adoc index ea53307..d93018d 100644 --- a/CN/modules/ROOT/nav.adoc +++ b/CN/modules/ROOT/nav.adoc @@ -58,6 +58,7 @@ *** xref:master/ecosystem_components/pg_curl.adoc[pg_curl] *** xref:master/ecosystem_components/pg_textsearch.adoc[pg_textsearch] *** xref:master/ecosystem_components/pg_hint_plan.adoc[pg_hint_plan] +*** xref:master/ecosystem_components/redis_fdw.adoc[redis_fdw] * 监控运维 ** xref:master/getting-started/daily_monitoring.adoc[日常监控] ** xref:master/getting-started/daily_maintenance.adoc[日常维护] diff --git a/CN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc b/CN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc index d17d3e9..ecf722e 100644 --- a/CN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc +++ b/CN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc @@ -21,11 +21,15 @@ IvorySQL 作为一款兼容 Oracle 且基于 PostgreSQL 的高级开源数据库 | 8 | xref:master/ecosystem_components/pgaudit.adoc[pgaudit] | 18.0 | 提供细粒度的审计功能,记录数据库操作日志,便于安全审计和合规性检查 | 数据库安全审计、合规性检查、审计报告生成 | 9 | xref:master/ecosystem_components/pgrouting.adoc[pgrouting] | 3.8.0 | 提供地理空间数据的路由计算功能,支持多种算法和数据格式 | 地理空间分析、路径规划、物流优化 | 10 | xref:master/ecosystem_components/system_stats.adoc[system_stats] | 3.2 | 提供用于访问系统级统计信息的函数 | 系统监控 -| 11 | xref:master/ecosystem_components/pg_ai_query.adoc[pg_ai_query] | 0.1.1 | AI驱动的自然语言转SQL扩展,支持多种大语言模型 | AI辅助查询、自然语言数据库交互 +| 11 | xref:master/ecosystem_components/wal2json.adoc[wal2json] | 2.6 | 用于 PostgreSQL 逻辑解码的输出插件,为每个事务生成一个JSON对象 | 变更数据捕获(CDC)、实时数据同步、事件驱动微服务、缓存刷新及跨库数据同步等 | 12 | xref:master/ecosystem_components/pg_stat_monitor.adoc[pg_stat_monitor] | 2.3.1 | 收集性能统计数据,并通过统一视图和直方图形式直观展示查询性能指标。 | 性能监控 -| 13 | xref:master/ecosystem_components/pg_partman.adoc[pg_partman] | 5.2 | 辅助管理原生分区表,自动创建、维护、清理分区子表 | 海量数据存储管理 -| 14 | xref:master/ecosystem_components/pg_curl.adoc[pg_curl] | 2.4 | 基于 libcurl 的网络传输扩展,支持 HTTP/HTTPS、FTP、SMTP、IMAP 等二十余种协议,可在 SQL 中完成各类网络数据传输操作 | REST API 集成、邮件发送、文件传输、外部系统通知 -| 15 | xref:master/ecosystem_components/pg_hint_plan.adoc[pg_hint_plan] | PG18 | 通过SQL注释中的hints控制执行计划,在不修改SQL逻辑的情况下优化查询性能 | 查询性能优化、执行计划调优、数据库性能分析 +| 13 | xref:master/ecosystem_components/pg_ai_query.adoc[pg_ai_query] | 0.1.1 | AI驱动的自然语言转SQL扩展,支持多种大语言模型 | AI辅助查询、自然语言数据库交互 +| 14 | xref:master/ecosystem_components/pg_partman.adoc[pg_partman] | 5.2 | 辅助管理原生分区表,自动创建、维护、清理分区子表 | 海量数据存储管理 +| 15 | xref:master/ecosystem_components/pgbouncer.adoc[pgbouncer] | x.x | | +| 16 | xref:master/ecosystem_components/pg_curl.adoc[pg_curl] | 2.4 | 基于 libcurl 的网络传输扩展,支持 HTTP/HTTPS、FTP、SMTP、IMAP 等二十余种协议,可在 SQL 中完成各类网络数据传输操作 | REST API 集成、邮件发送、文件传输、外部系统通知 +| 17 | xref:master/ecosystem_components/pg_textsearch.adoc[pg_textsearch] | 0.6.1 | 提供全文检索能力,支持文本分词、索引构建与高效全文查询 | 文档检索与内容搜索 +| 18 | xref:master/ecosystem_components/pg_hint_plan.adoc[pg_hint_plan] | PG18 | 通过SQL注释中的hints控制执行计划,在不修改SQL逻辑的情况下优化查询性能 | 查询性能优化、执行计划调优、数据库性能分析 +| 19 | xref:master/ecosystem_components/redis_fdw.adoc[redis_fdw] | PG18 | 将 Redis 数据映射为 PostgreSQL 外部表,支持通过标准 SELECT/INSERT/UPDATE/DELETE 语句读写 Redis | 统一 SQL 查询、轻量级数据同步、透明化缓存读写及跨库数据分析 |==== 这些插件均经过 IvorySQL 团队的测试和适配,确保在 IvorySQL 环境下稳定运行。用户可以根据业务需求选择合适的插件,进一步提升数据库系统的能力和灵活性。 diff --git a/CN/modules/ROOT/pages/master/ecosystem_components/redis_fdw.adoc b/CN/modules/ROOT/pages/master/ecosystem_components/redis_fdw.adoc new file mode 100644 index 0000000..d6014e4 --- /dev/null +++ b/CN/modules/ROOT/pages/master/ecosystem_components/redis_fdw.adoc @@ -0,0 +1,110 @@ + +:sectnums: +:sectnumlevels: 5 + += redis_fdw + +== 概述 +redis_fdw 实现PostgreSQL与Redis键值数据库的连接,支持SELECT、INSERT、UPDATE、DELETE等操作,适用于PostgreSQL 10+及Redis 6.0左右版本,可处理哈希、列表等多种数据类型。在 PostgreSQL 和 Oracle 兼容模式下均可正常工作。 + +== 安装 + +[TIP] +源码安装环境为 Ubuntu 24.04(x86_64),环境中已经安装了IvorySQL5及以上版本,安装路径为/usr/ivory-5。 + +=== 源码安装 + +[literal] +---- +# 安装 Hiredis 库 +wget https://github.com/redis/hiredis/archive/refs/tags/v1.3.0.tar.gz +tar xzvf v1.3.0.tar.gz +cd hiredis-1.3.0 +make +sudo make install +sudo ldconfig + +# 安装本地 Redis 服务 +sudo apt update +sudo apt install -y redis-server + +# 本地Redis服务默认开启,127.0.0.1:6379 + +# 使用 redis-cli 命令 创建一个管理员用户:(临时创建的用户重启 Redis 会丢失) +# 用户:highgo,密码:Admin@123,启用,全键全命令 +ACL SETUSER highgo on >Admin@123 ~* +@all + +# 下载 redis_fdw 源码包 +git clone https://github.com/pg-redis-fdw/redis_fdw.git -b REL_18_STABLE +cd redis_fdw + +# 编译安装 redis_fdw 插件 +make PG_CONFIG=/usr/ivory-5/bin/pg_config +sudo make install PG_CONFIG=/usr/ivory-5/bin/pg_config + +---- + +[TIP] +如果出现找不到xlocale.h的错误,需要手动修改 /usr/ivory-5/include/postgresql/server/pg_config.h +删除或者注释掉 #define HAVE_XLOCALE_H 1 这一行 + +=== 创建Extension + +[literal] +---- +postgres=# create extension redis_fdw; +CREATE EXTENSION +---- + +== 使用 + +[literal] +---- +// 创建外部服务器 +// Create a foreign server with appropriate configuration +postgres=# CREATE SERVER redis_server +postgres-# FOREIGN DATA WRAPPER redis_fdw +postgres-# OPTIONS ( address '127.0.0.1', port '6379'); +CREATE SERVER +---- + +[literal] +---- +// 创建用户映射 +// User mapping +postgres=# CREATE USER MAPPING FOR highgo +postgres-# SERVER redis_server +postgres-# OPTIONS (password 'Admin@123'); +CREATE USER MAPPING +---- + +[literal] +---- +// 创建一个简单表 +postgres=# CREATE FOREIGN TABLE redis_db0 ( +postgres(# key text, +postgres(# val text +postgres(# ) +postgres-# SERVER redis_server +postgres-# OPTIONS ( +postgres(# database '0' +postgres(# ); +CREATE FOREIGN TABLE +---- + +[literal] +---- +// 插入数据 +postgres=# insert into redis_db0 values('k2', 'v2'); +INSERT 0 1 +---- + +[literal] +---- +// 读取数据 +postgres=# select * from redis_db0; + key | val +-----+----- + k2 | v2 +(1 row) +---- \ No newline at end of file diff --git a/EN/modules/ROOT/nav.adoc b/EN/modules/ROOT/nav.adoc index bdd76bd..3281b1f 100644 --- a/EN/modules/ROOT/nav.adoc +++ b/EN/modules/ROOT/nav.adoc @@ -58,6 +58,7 @@ *** xref:master/ecosystem_components/pg_curl.adoc[pg_curl] *** xref:master/ecosystem_components/pg_textsearch.adoc[pg_textsearch] *** xref:master/ecosystem_components/pg_hint_plan.adoc[pg_hint_plan] +*** xref:master/ecosystem_components/redis_fdw.adoc[redis_fdw] * Monitor and O&M ** xref:master/getting-started/daily_monitoring.adoc[Monitoring] ** xref:master/getting-started/daily_maintenance.adoc[Maintenance] diff --git a/EN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc b/EN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc index d2fb461..a5b2ba3 100644 --- a/EN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc +++ b/EN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc @@ -22,11 +22,15 @@ IvorySQL, as an advanced open-source database compatible with Oracle and based o |*8*| xref:master/ecosystem_components/pgaudit.adoc[pgaudit] | 18.0 | Provides fine-grained auditing, recording database operation logs to support security auditing and compliance checks | Database security auditing, compliance checks, audit report generation |*9*| xref:master/ecosystem_components/pgrouting.adoc[pgrouting] | 3.8.0 | Provides routing computation for geospatial data, supporting multiple algorithms and data formats | Geospatial analysis, route planning, logistics optimization |*10*| xref:master/ecosystem_components/system_stats.adoc[system_stats] | 3.2 | Provide functions for accessing system-level statistics. | system monitor -|*11*| xref:master/ecosystem_components/pg_ai_query.adoc[pg_ai_query] | 0.1.1 | AI-driven natural language to SQL extension supporting multiple LLMs | AI-assisted querying, natural language database interaction +|*11*| xref:master/ecosystem_components/wal2json.adoc[wal2json] | 2.6 | converts database Write-Ahead Log (WAL) changes into structured JSON format | it is primarily used for change data capture (CDC), real-time data replication, event-driven microservices, cache invalidation, and cross-database synchronization |*12*| xref:master/ecosystem_components/pg_stat_monitor.adoc[pg_stat_monitor] | 2.3.1 | Collects performance statistics and provides query performance insights in a single view and graphically in histogram. | Performance monitoring -|*13*| xref:master/ecosystem_components/pg_partman.adoc[pg_partman] | 5.2 | Automates the creation, maintenance, and cleanup of native partition subtables. | Large-Scale Data Storage Management -|*14*| xref:master/ecosystem_components/pg_curl.adoc[pg_curl] | 2.4 | A libcurl-based network transfer extension supporting HTTP/HTTPS, FTP, SMTP, IMAP, and 20+ other protocols, enabling network data transfer operations directly in SQL | REST API integration, email sending, file transfer, external system notifications -|*15*| xref:master/ecosystem_components/pg_hint_plan.adoc[pg_hint_plan] | PG18 | Controls execution plans via SQL comment hints, optimizing query performance without modifying SQL logic | Query performance optimization, execution plan tuning, database performance analysis +|*13*| xref:master/ecosystem_components/pg_ai_query.adoc[pg_ai_query] | 0.1.1 | AI-driven natural language to SQL extension supporting multiple LLMs | AI-assisted querying, natural language database interaction +|*14*| xref:master/ecosystem_components/pg_partman.adoc[pg_partman] | 5.2 | Automates the creation, maintenance, and cleanup of native partition subtables. | Large-Scale Data Storage Management +|*15*| xref:master/ecosystem_components/pgbouncer.adoc[pgbouncer] | x.x | +|*16*| xref:master/ecosystem_components/pg_curl.adoc[pg_curl] | 2.4 | A libcurl-based network transfer extension supporting HTTP/HTTPS, FTP, SMTP, IMAP, and 20+ other protocols, enabling network data transfer operations directly in SQL | REST API integration, email sending, file transfer, external system notifications +|*17*| xref:master/ecosystem_components/pg_textsearch.adoc[pg_textsearch] | 0.6.1 | enhances PostgreSQL with full-text search capabilities, enabling fast text indexing, tokenization, and efficient full-text querying | document and content retrieval +|*18*| xref:master/ecosystem_components/pg_hint_plan.adoc[pg_hint_plan] | PG18 | Controls execution plans via SQL comment hints, optimizing query performance without modifying SQL logic | Query performance optimization, execution plan tuning, database performance analysis +|*19*| xref:master/ecosystem_components/redis_fdw.adoc[redis_fdw] | PG18 | connects PostgreSQL with Redis, supporting standard SQL operations including SELECT, INSERT, UPDATE, and DELETE | unified SQL querying, lightweight data synchronization, transparent cache access, and cross-database data analysis |==== These plugins have all been tested and adapted by the IvorySQL team to ensure stable operation in the IvorySQL environment. Users can select appropriate plugins based on business needs to further enhance the capabilities and flexibility of the database system. diff --git a/EN/modules/ROOT/pages/master/ecosystem_components/redis_fdw.adoc b/EN/modules/ROOT/pages/master/ecosystem_components/redis_fdw.adoc new file mode 100644 index 0000000..e7f6deb --- /dev/null +++ b/EN/modules/ROOT/pages/master/ecosystem_components/redis_fdw.adoc @@ -0,0 +1,108 @@ + +:sectnums: +:sectnumlevels: 5 + += redis_fdw + +== Overview +redis_fdw enables the connection between PostgreSQL and the Redis key-value database, supporting operations such as SELECT, INSERT, UPDATE, and DELETE. It is compatible with PostgreSQL 10+ and Redis versions around 6.0, and can handle various data types including hashes and lists. It works in both PostgreSQL and Oracle compatibility modes.. + +== Installation + +[TIP] +The source code installation environment is Ubuntu 24.04 (x86_64), in which IvorySQL 5 or a later version has been installed. The installation path is /usr/ivory-5. + +=== Source Code Installation + +[literal] +---- +# Install Hiredis lib +wget https://github.com/redis/hiredis/archive/refs/tags/v1.3.0.tar.gz +tar xzvf v1.3.0.tar.gz +cd hiredis-1.3.0 +make +sudo make install +sudo ldconfig + +# Install local Redis server +sudo apt update +sudo apt install -y redis-server + +# Local Redis server is running on 127.0.0.1:6379 + +# Create an administrator user using the redis-cli command: +# (Temporarily created users will be lost after Redis restarts.) +# User: highgo, password: Admin@123 +ACL SETUSER highgo on >Admin@123 ~* +@all + +# Download source code of redis_fdw +git clone https://github.com/pg-redis-fdw/redis_fdw.git -b REL_18_STABLE +cd redis_fdw + +# Compile and install redis_fdw extension +make PG_CONFIG=/usr/ivory-5/bin/pg_config +sudo make install PG_CONFIG=/usr/ivory-5/bin/pg_config + +---- + +[TIP] +If there is error "xlocale.h: No such file or directory" during compilation, user should remove the line of "#define HAVE_XLOCALE_H 1" from file /usr/ivory-5/include/postgresql/server/pg_config.h. + +=== Create extension + +[literal] +---- +postgres=# create extension redis_fdw; +CREATE EXTENSION +---- + +== Usage + +[literal] +---- +// Create a foreign server with appropriate configuration +postgres=# CREATE SERVER redis_server +postgres-# FOREIGN DATA WRAPPER redis_fdw +postgres-# OPTIONS ( address '127.0.0.1', port '6379'); +CREATE SERVER +---- + +[literal] +---- +// User mapping +postgres=# CREATE USER MAPPING FOR highgo +postgres-# SERVER redis_server +postgres-# OPTIONS (password 'Admin@123'); +CREATE USER MAPPING +---- + +[literal] +---- +// Create a simple table +postgres=# CREATE FOREIGN TABLE redis_db0 ( +postgres(# key text, +postgres(# val text +postgres(# ) +postgres-# SERVER redis_server +postgres-# OPTIONS ( +postgres(# database '0' +postgres(# ); +CREATE FOREIGN TABLE +---- + +[literal] +---- +// Insert data +postgres=# insert into redis_db0 values('k2', 'v2'); +INSERT 0 1 +---- + +[literal] +---- +// Read the data +postgres=# select * from redis_db0; + key | val +-----+----- + k2 | v2 +(1 row) +---- \ No newline at end of file From d9f67ba57b7051624d04b6192b4632458fd91129 Mon Sep 17 00:00:00 2001 From: Steven Niu Date: Thu, 9 Apr 2026 16:38:40 +0800 Subject: [PATCH 2/2] add missing separator --- .../pages/master/ecosystem_components/ecosystem_overview.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc b/EN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc index a5b2ba3..a1c3d7c 100644 --- a/EN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc +++ b/EN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc @@ -26,7 +26,7 @@ IvorySQL, as an advanced open-source database compatible with Oracle and based o |*12*| xref:master/ecosystem_components/pg_stat_monitor.adoc[pg_stat_monitor] | 2.3.1 | Collects performance statistics and provides query performance insights in a single view and graphically in histogram. | Performance monitoring |*13*| xref:master/ecosystem_components/pg_ai_query.adoc[pg_ai_query] | 0.1.1 | AI-driven natural language to SQL extension supporting multiple LLMs | AI-assisted querying, natural language database interaction |*14*| xref:master/ecosystem_components/pg_partman.adoc[pg_partman] | 5.2 | Automates the creation, maintenance, and cleanup of native partition subtables. | Large-Scale Data Storage Management -|*15*| xref:master/ecosystem_components/pgbouncer.adoc[pgbouncer] | x.x | +|*15*| xref:master/ecosystem_components/pgbouncer.adoc[pgbouncer] | x.x | | |*16*| xref:master/ecosystem_components/pg_curl.adoc[pg_curl] | 2.4 | A libcurl-based network transfer extension supporting HTTP/HTTPS, FTP, SMTP, IMAP, and 20+ other protocols, enabling network data transfer operations directly in SQL | REST API integration, email sending, file transfer, external system notifications |*17*| xref:master/ecosystem_components/pg_textsearch.adoc[pg_textsearch] | 0.6.1 | enhances PostgreSQL with full-text search capabilities, enabling fast text indexing, tokenization, and efficient full-text querying | document and content retrieval |*18*| xref:master/ecosystem_components/pg_hint_plan.adoc[pg_hint_plan] | PG18 | Controls execution plans via SQL comment hints, optimizing query performance without modifying SQL logic | Query performance optimization, execution plan tuning, database performance analysis