agens
AgensGraph 内核模板,提供属性图模型与 Cypher 查询能力
agens 配置模板使用 AgensGraph 数据库内核替代原生 PostgreSQL,提供属性图模型与 Cypher 查询能力。
完整教程请参考:AgensGraph 内核使用说明
配置概览
- 配置名称:
agens - 节点数量: 单节点
- 配置说明:AgensGraph(PG16)图数据库内核配置
- 适用系统:
el8,el9,el10,d12,d13,u22,u24 - 适用架构:
x86_64,aarch64 - 相关配置:
meta、pgsql
启用方式:
./configure -c agens [-i <primary_ip>]
配置内容
源文件地址:pigsty/conf/agens.yml
---
#==============================================================#
# File : agens.yml
# Desc : 1-node AgensGraph (Graph DB) template
# Ctime : 2026-02-26
# Mtime : 2026-02-26
# Docs : https://pigsty.io/docs/conf/agens
# License : Apache-2.0 @ https://pigsty.io/docs/about/license/
# Copyright : 2018-2026 Ruohang Feng / Vonng (rh@vonng.com)
#==============================================================#
# This is the config template for AgensGraph Kernel,
# Which is a PostgreSQL 16 fork with graph capabilities.
# tutorial: https://pigsty.io/docs/pgsql/kernel/agensgraph
#
# Usage:
# curl https://repo.pigsty.io/get | bash
# ./configure -c agens
# ./deploy.yml
all:
children:
infra: { hosts: { 10.10.10.10: { infra_seq: 1 }} ,vars: { repo_enabled: false }}
etcd: { hosts: { 10.10.10.10: { etcd_seq: 1 }} ,vars: { etcd_cluster: etcd }}
#minio: { hosts: { 10.10.10.10: { minio_seq: 1 }} ,vars: { minio_cluster: minio }}
#----------------------------------------------#
# AgensGraph Database Cluster
#----------------------------------------------#
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: # https://pigsty.io/docs/pgsql/config/hba
- { user: all ,db: all ,addr: intra ,auth: pwd ,title: 'everyone intranet access with password' ,order: 800 }
pg_crontab: # https://pigsty.io/docs/pgsql/admin/crontab
- '00 01 * * * /pg/bin/pg-backup full'
# AgensGraph Ad Hoc Settings
pg_mode: agens # AgensGraph compatible mode
pg_packages: [ agensgraph, pgsql-common ] # install AgensGraph kernel package + common utils
vars:
#----------------------------------------------#
# INFRA : https://pigsty.io/docs/infra/param
#----------------------------------------------#
version: v4.2.0 # pigsty version string
admin_ip: 10.10.10.10 # admin node ip address
region: default # upstream mirror region: default,china,europe
infra_portal: # infra services exposed via portal
home : { domain: i.pigsty } # default domain name
#----------------------------------------------#
# NODE : https://pigsty.io/docs/node/param
#----------------------------------------------#
nodename_overwrite: false # do not overwrite node hostname on single node mode
node_repo_modules: node,infra,pgsql # add these repos directly to the singleton node
node_tune: oltp # node tuning specs: oltp,olap,tiny,crit
#----------------------------------------------#
# PGSQL : https://pigsty.io/docs/pgsql/param
#----------------------------------------------#
pg_version: 16 # AgensGraph kernel is compatible with postgres 16
pg_conf: oltp.yml # pgsql tuning specs: {oltp,olap,tiny,crit}.yml
#----------------------------------------------#
# PASSWORD : https://pigsty.io/docs/setup/security/
#----------------------------------------------#
grafana_admin_password: pigsty
grafana_view_password: DBUser.Viewer
pg_admin_password: DBUser.DBA
pg_monitor_password: DBUser.Monitor
pg_replication_password: DBUser.Replicator
patroni_password: Patroni.API
haproxy_admin_password: pigsty
minio_secret_key: S3User.MinIO
etcd_root_password: Etcd.Root
...
配置解读
agens 模板在 pg-meta 集群中启用 pg_mode: agens,并使用 agensgraph 内核包替换标准 PostgreSQL 内核。
关键特性:
- 属性图模型能力(Vertex / Edge)
- 支持 Cypher 查询语法,可与 SQL 混合使用
- 兼容 PostgreSQL 生态与常规运维方式
- 默认基于 PostgreSQL 16 兼容内核
适用场景:
- 图关系分析与路径查询
- 社交关系、风控关联、知识图谱等图数据场景
- 需要在 PostgreSQL 体系中引入图查询能力
注意事项:
- AgensGraph 当前模板固定使用
pg_version: 16 - 默认模板为单节点快速启用,生产场景建议按需扩展高可用拓扑
- 图模型与 Cypher 语义请结合 AgensGraph 官方文档进行设计