5.6.3. 为自动化中心 PostgreSQL 数据库启用 hstore 扩展


数据库迁移脚本使用 hstore 字段来存储信息,因此在自动化中心 PostgreSQL 数据库中必须启用 hstore 扩展。

使用 Ansible Automation Platform 安装程序和受管 PostgreSQL 服务器时,此过程是自动的。

如果 PostgreSQL 数据库是外部的,则必须在安装前在自动化中心 PostgreSQL 数据库中手动启用 hstore 扩展。

如果在安装过程中没有启用 hstore 扩展,在数据库迁移过程中会出现一个失败。

流程

  1. 检查 PostgreSQL 服务器上是否有扩展(自动化 hub 数据库)。

    $ psql -d <automation hub database> -c "SELECT * FROM pg_available_extensions WHERE name='hstore'"
  2. 其中 < automation hub database> 的默认值为 automationhub

    带有 hstore 可用的输出示例

    name  | default_version | installed_version |comment
    ------+-----------------+-------------------+---------------------------------------------------
     hstore | 1.7           |                   | data type for storing sets of (key, value) pairs
    (1 row)

    带有 hstore 不可用的输出示例

     name | default_version | installed_version | comment
    ------+-----------------+-------------------+---------
    (0 rows)
  3. 在基于 RHEL 的服务器上,h store 扩展包含在 postgresql-contrib RPM 软件包中,该软件包不会在安装 PostgreSQL 服务器 RPM 软件包时自动安装。

    要安装 RPM 软件包,请使用以下命令:

    dnf install postgresql-contrib
  4. 使用以下命令将 hstore PostgreSQL 扩展加载到自动化中心数据库中:

    $ psql -d <automation hub database> -c "CREATE EXTENSION hstore;"

    在以下输出中,installed_version 字段列出了使用的 hstore 扩展,表示启用了 hstore

    name | default_version | installed_version | comment
    -----+-----------------+-------------------+------------------------------------------------------
    hstore  |     1.7      |       1.7         | data type for storing sets of (key, value) pairs
    (1 row)
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部