PostgreSQL
- 更新时间2026-07-09
- 阅读时长10分钟
PostgreSQL是仪表板主机服务、测试监视器服务和动态表单字段服务所必需的。
通用要求
配置服务使用PostgreSQL服务器之前,请确保:
- 已配置的PostgreSQL服务器。为获得最佳性能和安全性,建议将PostgreSQL实例专用于SystemLink,而不是与其他应用程序共享。
- PostgreSQL服务器的主机名。
- 至少一个数据库用户的凭证。
- PostgreSQL管理员权限,用于创建数据库和用户。
- 用于安全连接的TLS证书。(推荐)
初次启动时,对于某些升级场景,每个服务都会创建所需的模式和表格。设置完成后,可撤销用户的创建权限。下表列出了正常运行所需的最低权限:
| 位置 | 权限 |
|---|---|
| 数据库 | CONNECT(连接) |
| 服务模式 | 创建,使用 |
| 模式中的表格 | 选择、插入、更新、删除 |
将仪表板主机服务数据存储至外部PostgreSQL服务器
创建数据库和用户,确保用户拥有数据库的创建权限。默认数据库名称为grafana。
如果使用Helm管理密钥,请将数据库凭证添加到systemlink-secrets.yaml:
dashboardhost:
secrets:
database:
host: "<postgresql-hostname>:<port>"
user: "systemlink"
password: "<database-password>"在systemlink-values.yaml中,确保启用了默认的dashboardhost.grafana.extraSecretMounts和dashboardhost.grafana.extraConfigmapMounts配置:
dashboardhost:
grafana:
extraSecretMounts:
- name: *dashboardhostdbSecret
secretName: *dashboardhostdbSecret
defaultMode: 0440
mountPath: "/etc/secrets/dashboardhost"
readOnly: true
extraConfigmapMounts:
- name: *postgresCertificateConfigMap
mountPath: "/etc/ssl/certs/dashboardhost/"
subPath: *postgresCertificateFileName
configMap: *postgresCertificateConfigMap
readOnly: true将测试监视器服务数据存储至外部PostgreSQL服务器
创建数据库和用户,确保用户拥有数据库的创建权限。
以后对测试监视器服务图的更新可能需要修改schema和表。要执行这些修改,测试监视器服务图必须作为模式和表格的所有者。除了处理日常操作的用户之外,您还可以指定具有更高权限的单独用户来执行数据库迁移。
可使用连接字符串(推荐)或单个连接参数配置PostgreSQL连接。
使用连接字符串(推荐):- 将凭证添加到systemlink-secrets.yaml:
testmonitorservice: secrets: database: connectionString: "Host=<postgresql-hostname>;Database=<database-name>;Username=<database-user>;Password=<database-password>;SslMode=Require" migrationConnectionString: "Host=<postgresql-hostname>;Database=<database-name>;Username=<migration-user>;Password=<migration-password>;SslMode=Require" - 然后在systemlink-values.yaml中配置连接:
testmonitorservice: database: connectionString: secretName: "testmonitorservicedb-connection" connectionStringKey: "connection-string" migrationConnectionStringKey: "migration-connection-string" tls: enabled: true existingConfigMap: *postgresCertificateConfigMap certificateSubPath: *postgresCertificateFileName
使用单个连接参数:
- 或者单独指定连接参数。将凭证添加到systemlink-secrets.yaml:
testmonitorservice: secrets: database: connectionPassword: "<database-password>" migrationConnectionPassword: "<migration-password>" - 然后在systemlink-values.yaml中配置连接。默认数据库名称为nisystemlink,默认用户名为nisystemlink:
testmonitorservice: database: connectionInfo: host: "<postgresql-hostname>" port: "5432" dbName: "nisystemlink" user: "nisystemlink" migrationUser: "<migration-user>" secretName: "testmonitorservicedb-connection" passwordKey: "password" migrationPasswordKey: "migration-password" tls: enabled: true existingConfigMap: *postgresCertificateConfigMap certificateSubPath: *postgresCertificateFileName
将动态表单字段服务数据存储至外部PostgreSQL服务器
创建数据库和用户,确保用户拥有数据库的创建权限。
以后对动态表单字段服务图的更新可能需要修改schema和表。要执行这些修改,动态表单字段服务图必须作为schema和表的所有者。除了处理日常操作的用户之外,您还可以指定具有更高权限的单独用户来执行数据库迁移。
可使用连接字符串(推荐)或单个连接参数配置PostgreSQL连接。
使用创建字符串(推荐):
- 将凭证添加到systemlink-secrets.yaml:
dynamicformfields: secrets: database: connectionString: "Host=<postgresql-hostname>;Database=<database-name>;Username=<database-user>;Password=<database-password>;SslMode=Require" migrationConnectionString: "Host=<postgresql-hostname>;Database=<database-name>;Username=<migration-user>;Password=<migration-password>;SslMode=Require" - 然后在systemlink-values.yaml中配置连接:
dynamicformfields: database: connectionString: secretName: "dynamicformfields-db-connection" connectionStringKey: "connection-string" migrationConnectionStringKey: "migration-connection-string" tls: enabled: true existingConfigMap: *postgresCertificateConfigMap certificateSubPath: *postgresCertificateFileName
或者单独指定连接参数:
- 将凭证添加到systemlink-secrets.yaml:
dynamicformfields: secrets: database: connectionPassword: "<database-password>" migrationConnectionPassword: "<migration-password>" - 然后在systemlink-values.yaml中配置连接。默认数据库名称为nisystemlink,默认用户名为nisystemlink:
dynamicformfields: database: connectionInfo: host: "<postgresql-hostname>" port: "5432" dbName: "nisystemlink" user: "nisystemlink" migrationUser: "<migration-user>" secretName: "dynamicformfields-db-connection" passwordKey: "password" migrationPasswordKey: "migration-password" tls: enabled: true existingConfigMap: *postgresCertificateConfigMap certificateSubPath: *postgresCertificateFileName"
相关内容
- SystemLink环境架构
SystemLink Enterprise是一种具有面向服务架构的应用程序。架构由Kubernetes托管的微服务组成。SystemLink Enterprise具有可扩展性、容错性和高可用性。下表总结了SystemLink Enterprise架构的主要组成部分。
- Azure AKS中的SystemLink Enterprise
Azure Kubernetes服务(AKS)是一种受管的Kubernetes服务,简化了在Azure上运行Kubernetes的过程,无需安装和操作自己的Kubernetes控制平面。
- 必需的密钥
密钥是用于存储敏感信息的Kubernetes对象。
- SystemLink Enterprise与外部依赖项之间的兼容性
- 安装验证
测试SystemLink Enterprise是否安装正确。