Strategy ONE

MicroStrategy 资料库升级指南和故障排除

存储库升级简介

为了确保 MicroStrategy 套件的持续安全性和稳定性,MicroStrategy Repository 在 2021 Update 10 中将 PostgreSQL 升级到 14.7 版本。

本次升级:

  • 提供针对旧版本 PostgreSQL 中已知安全漏洞的解决方案

  • 防止用户遭遇产品故障

  • 使用户能够利用最新 PostgreSQL 版本的附加功能和增强的性能

此升级工作流程仅涵盖 MicroStrategy 本地安装的 PostgreSQL,而不涵盖远程存储库。

升级包含两部分:

  • PostgreSQL 服务器二进制文件更新

  • 数据迁移

升级不会改变任何底层 PostgreSQL 文件夹结构,因此任何使用 PostgreSQL 的组件都不会受到影响。

您可以使用多种实用程序/工具来备份开箱即用的 MicroStrategy 存储库。

  1. MicroStrategy 存储库管理工具

  2. 原生 PostgreSQL 备份和恢复实用程序

    pg_dump, pg_dumpall

  3. MicroStrategy 品牌 PostgreSQL 备份和恢复实用程序

    mstr_pg_dump, mstr_pg_dumpall

MicroStrategy Repository 中的数据库

对于 Windows 和 Linux 上全新安装的环境,开箱即用的 MicroStrategy 资料库中安装了以下数据库:

Database Name Windows 快速安装 Windows 自定义安装 Linux 相应的 MicroStrategy 组件
advdw_wh ü     用于 MicroStrategy 教程项目
mstr_collab ü ü ü MicroStrategy Collaboration Server
mstr_library ü ü ü MicroStrategy Library 服务器
operationaldm_wh ü     用于 MicroStrategy 教程项目
platform_analytics_wh ü ü ü 平台分析项目
poc_metadata ü     教程元数据
tutorial_wh ü     教程仓库

对于 Linux 安装和 Windows 自定义安装,只有所选组件对应的仓库才会安装在 MicroStrategy Repository 中。例如,如果您没有安装 Platform Analytics 组件,那么 platform_analytics_wh 不在 MicroStrategy 存储库中。

MicroStrategy 存储库管理工具

MicroStrategy Repository Administration 工具为 MicroStrategy 用户提供了一个命令行界面,用于根据数据库中的信息备份、恢复和清理数据库 DBAdminConfig.yaml

有关 MicroStrategy Repository Administration 工具的更多信息,请参阅存储库管理。

MicroStrategy Repository Administration 工具的备份操作基于 DBAdminConfig.yaml。要备份 MicroStrategy Repository 中的所有数据库,请将数据库名称添加到 DBAdminConfig.yaml。仅列出数据库名称 DBAdminConfig.yaml 均由此工具备份。

默认情况下,此工具使用 mstr 数据库用户及其加密密码访问数据库。您可以在 DBAdminConfig.yaml。如果密码被修改,该工具可能无法按预期运行。

原生 PostgreSQL 备份和恢复实用程序

本机 PostgreSQL 备份和恢复实用程序可用于备份和恢复 MicroStrategy Repository。它与 MicroStrategy Repository 一起开箱即用。

  • pg_dump 转储单个数据库。

    示例:

    复制
    # To dump a database called mydb into an SQL-script file:
    pg_dump mydb > db.sql
  • pg_dumpall 备份给定集群中的所有数据库,并保留集群范围的数据,例如角色和表空间定义。

    示例:

    复制
    # To dump all databases
    pg_dumpall > db.out
  • 要恢复,请使用 psqlpg_restore

    示例:

    复制
    # To reload pg_dump file into a (freshly created) database named newdb
    psql -d newdb -f db.sql

    # To restore pg_dumpall file db.out
    psql -f db.out postgres

由于备份选项的转储参数有很多,您可以根据自己的需要选择使用它们。

有关参数列表以及使用示例,请参阅 pg_dumppg_dumpall, 和 pg_restore

视窗

默认路径: C:\Program Files (x86)\Common Files\MicroStrategy\Repository\pgsql\bin

示例:

复制
 #dump mstr_collab
 pg_dump -d mstr_collab -Umstr > mstr_collab.sql
 
 #dump the whole postgres cluster
 pg_dumpall -Umstr > postgres.sql

Linux

默认路径: /opt/mstr/MicroStrategy/install/Repository/postgres11/bin

在 Linux 上运行实用程序之前,您必须:

  • 来源 setenv.sh 文件下 /opt/mstr/MicroStrategy/install/Repository/bin

    如果不这样做会导致以下错误:

    加载共享库时出错:libpq.so.5:无法打开共享对象文件:没有这样的文件或目录。

  • 声明 Unix 域套接字使用 /tmp 路径,因为原生 PostgreSQL back 实用程序使用 /var/run/postgresql/ 默认路径。

    如果没有声明路径,则会出现以下错误:

    pg_dump:[archiver(db)] 与数据库“mstr”的连接失败:无法连接到服务器:没有这样的文件或目录。服务器是否在本地运行并接受 Unix 域套接字“/var/run/postgresql/.s.PGSQL.5432”上的连接?

示例:

复制
#source setenv.sh
source /opt/mstr/MicroStrategy/install/Repository/bin/setenv.sh

#declare unix-domain socket and use pg_dump to dump metadata
cd /opt/mstr/MicroStrategy/install/Repository/postgres11/bin
./pg_dump -h /tmp -d poc_metadata -Umstr > md.dump

#dump the whole postgres cluster
./pg_dumpall -h /tmp -Umstr > postgres.dump

MicroStrategy 品牌 PostgreSQL 备份和恢复实用程序

MicroStrategy 还在 Linux 上提供了“品牌”备份和恢复实用程序。该实用程序基于本机 PostgreSQL 备份和恢复实用程序构建。你不需要来源 setenv.sh 并使用此工具声明Unix域套接字。

由于此实用程序是基于本机 PostgreSQL 备份/恢复实用程序构建的,因此也可以使用与本机 PostgreSQL 备份/恢复实用程序一起使用的参数。

默认路径: /opt/mstr/MicroStrategy/install/Repository/bin

示例:

复制
#dump metadata
cd /opt/mstr/MicroStrategy/install/Repository/bin
./mstr_pg_dump -d poc_metadata -Umstr > md.dump

#dump the whole postgres cluster
./mstr_pg_dumpall -Umstr > postgres.dump

通过平台安装程序升级 MicroStrategy 存储库

Linux

  1. 启动安装程序并选择升级将您本地的 MicroStrategy 版本升级到 2021 Update 10。

  2. 如果MicroStrategy 平台分析在之前的安装中被选中,它将自动被选中选择组件。确认要升级的组件,然后单击下一个

  3. 如果自上次安装以来 MicroStrategy Repository 的连接信息发生了变化,系统将提示您提供数据库登录用户名、密码和端口。填写字段并点击下一个

  4. 系统会提示您在继续之前备份存储库。回顾以上部分有关备份和恢复存储库的信息。要继续升级,您必须确认您已通过输入以下命令备份了存储库升级。单击 Next(下一步)。

  5. 安装程序检查系统上是否有足够的可用磁盘空间。如果没有,则会列出缺少的要求并中止升级。

  6. 如果有足够的磁盘空间,则存储库以及其他 MicroStrategy 组件的升级过程将继续。但是,如果存储库升级失败,则整个升级将中止并出现以下屏幕。

    单击链接以获取有关如何分析和排除根本原因的详细步骤。问题解决后,重新运行安装以完成升级。

查看 install.loglogs 文件夹(例如: /var/log/MicroStrategy/) 查看其中是否包含下面显示的 PostgreSQL 升级日志。如果包含,则升级成功

PostgreSQL升级日志示例:

复制
12 Apr 2023, 07:29:41 AM:INFO: Configuring pg_hba.conf file completed
12 Apr 2023, 07:29:49 AM:INFO: Successfully stopped MicroStrategy Repository Administration.
12 Apr 2023, 07:29:49 AM:INFO: Successfully stopped PostgreSQL.
12 Apr 2023, 07:29:49 AM:INFO: Backing up PostgreSQL bin files.
12 Apr 2023, 07:29:49 AM:INFO: Backing up pgdata files.
12 Apr 2023, 07:29:49 AM:INFO: Backing up Repository Administration Tool files.
12 Apr 2023, 07:29:49 AM:INFO: MicroStrategy Repository bin files and pgdata backup completed.
12 Apr 2023, 07:29:49 AM:INFO: Extracting new postgres binary files.
12 Apr 2023, 07:29:50 AM:INFO: Installing Repository files...
12 Apr 2023, 07:29:50 AM:INFO: Copying fileset RepositoryLinuxRepositoryInstallPath files...
12 Apr 2023, 07:29:56 AM:INFO: Initializing PostgreSQL
12 Apr 2023, 07:29:57 AM:INFO: Configuring postgresql.conf file.
12 Apr 2023, 07:29:57 AM:FINE: Using port 54302 temporarily for PostgreSQL upgrade.
12 Apr 2023, 07:29:57 AM:INFO: Configuring postgresql.conf file completed
12 Apr 2023, 07:29:57 AM:INFO: Checking postgres upgrade compatibility.
12 Apr 2023, 07:29:58 AM:INFO: Upgrade compatibility check has been passed.
12 Apr 2023, 07:29:58 AM:INFO: Starting PostgreSQL upgrade.
12 Apr 2023, 07:30:04 AM:INFO: PostgreSQL upgrade completed.
12 Apr 2023, 07:30:04 AM:INFO: Restoring old cluster's configuration files.
12 Apr 2023, 07:30:04 AM:INFO: Restoring pg_hba.conf file.
12 Apr 2023, 07:30:04 AM:INFO: Restoring pg_hba.conf file completed.
12 Apr 2023, 07:30:04 AM:INFO: Restoring postgresql.conf file.
12 Apr 2023, 07:30:04 AM:INFO: Restoring postgresql.conf file completed.
12 Apr 2023, 07:30:04 AM:INFO: Checking MicroStrategy Repository status
12 Apr 2023, 07:30:05 AM:INFO: Started PostgreSQL.
12 Apr 2023, 07:30:05 AM:INFO: Cleaning up files under Repository. 

视窗

  1. 启动安装程序将您本地的 MicroStrategy 版本升级到 2021 Update 10。

  2. 如果MicroStrategy 存储库在之前的安装中被选中,它将自动被选中选择组件。确认要升级的组件,然后单击下一个

  3. 如果自上次安装以来 MicroStrategy Repository 的连接信息发生了变化,系统将提示您提供数据库登录用户名、密码和端口。填写字段并点击下一个

  4. 系统会提示您在继续之前备份存储库。回顾以上部分有关备份和恢复存储库的信息。要继续升级,您必须确认您已通过输入以下命令备份了存储库升级。单击 Next(下一步)。

  5. 安装程序检查系统上是否有足够的可用磁盘空间。如果没有,则列出空间要求并中止升级。

  6. 如果有足够的磁盘空间,则存储库以及其他 MicroStrategy 组件的升级过程将继续。但是,如果存储库升级失败,则整个升级将中止并出现以下屏幕。

    单击链接以获取有关如何分析和排除根本原因的详细步骤。问题解决后,重新运行安装以完成升级。

查看 install.log 在 MicroStrategy 安装文件夹中(例如: C:\Program Files (x86)\Common Files\MicroStrategy) 查看其中是否包含下面显示的 PostgreSQL 升级日志。如果包含,则升级成功

PostgreSQL升级日志示例:

复制
Performing Consistency Checks

-----------------------------
Checking cluster versions                                   ok
Checking database user is the install user                  ok
Checking database connection settings                       ok
Checking for prepared transactions                          ok
Checking for reg* data types in user tables                 ok
Checking for contrib/isn with bigint-passing mismatch       ok
Checking for tables WITH OIDS                               ok
Checking for invalid "sql_identifier" user columns          ok
Creating dump of global objects                             ok
Creating dump of database schemas
                                                            ok
Checking for presence of required libraries                 ok
Checking database user is the install user                  ok
Checking for prepared transactions                          ok

If pg_upgrade fails after this point, you must re-initdb the
new cluster before continuing.

Performing Upgrade
------------------
Analyzing all rows in the new cluster                       ok
Freezing all rows in the new cluster                        ok
Deleting files from new pg_xact                             ok
Copying old pg_xact to new server                           ok
Setting next transaction ID and epoch for new cluster       ok
Deleting files from new pg_multixact/offsets                ok
Copying old pg_multixact/offsets to new server              ok
Deleting files from new pg_multixact/members                ok
Copying old pg_multixact/members to new server              ok
Setting next multixact ID and offset for new cluster        ok
Resetting WAL archives                                      ok
Setting frozenxid and minmxid counters in new cluster       ok
Restoring global objects in the new cluster                 ok
Restoring database schemas in the new cluster
                                                            ok
Adding ".old" suffix to old global/pg_control               ok

If you want to start the old cluster, you will need to remove
the ".old" suffix from C:/Program Files (x86)/Common Files/MicroStrategy/Repository/pgsql/PGDATA/global/pg_control.old.
Because "link" mode was used, the old cluster cannot be safely
started once the new cluster has been started.

Linking user relation files
                                                            ok
Setting next OID for new cluster                            ok
Sync data directory to disk                                 ok
Creating script to analyze new cluster                      ok
Creating script to delete old cluster                       ok

Upgrade Complete
----------------
Optimizer statistics are not transferred by pg_upgrade so,
once you start the new server, consider running:
    analyze_new_cluster.bat

Running this script will delete the old cluster's data files:
    delete_old_cluster.bat

PostgreSQL 升级失败故障排除

如果 PostgreSQL 升级失败,请检查 install.log 找到根本原因。

PostgreSQL 升级的一些典型失败场景包括:

磁盘空间不足

升级存储库需要额外的磁盘空间来备份、PostgreSQL 二进制文件以及迁移数据库。

安装程序检查系统上是否有足够的可用磁盘空间。如果没有,升级过程将中止并出现以下警告:

由于该机器没有足够的磁盘空间,因此无法继续升级。

密码不匹配

MicroStrategy 安装程序需要使用执行初始 PostgreSQL 安装的超级用户连接旧的 PostgreSQL 存储库。如果密码已更改且在升级期间未正确提供,则升级过程可能会失败。

您必须提供正确的超级用户密码才能连接到旧的 PostgreSQL 数据库。

访问权限问题

执行升级的用户可能没有访问升级所需的某些文件或目录的必要权限。

运行 MicroStrategy 安装和存储库升级的正确用户是超级用户。

错误的配置设置

在升级过程中,可能需要更新 PostgreSQL 的配置设置。如果设置不正确,升级过程可能会失败。

记录一条错误消息,表明配置文件无效,因为它包含无效设置。您必须更正无效的配置并重新运行安装。

数据损坏

如果迁移的数据出现错误或问题,则升级过程中可能会发生数据损坏。

记录一条错误消息,表明数据库的数据文件已损坏。您必须通过从备份恢复数据并再次运行安装来修复数据错误。

故障转移场景和恢复

如果 PostgreSQL 数据文件在升级过程中中断,您可能需要从开始升级之前所做的备份中恢复数据库。

  • 如果使用 MicroStrategy Repository Administration 工具完成了备份,则必须使用相同的工具来恢复它们。按照以下步骤操作存储库管理执行恢复。

  • 如果使用本机 PostgreSQL 备份实用程序完成备份,MicroStrategy 建议使用本机 PostgreSQL 恢复实用程序来执行恢复。

视窗

默认路径: C:\Program Files (x86)\Common Files\MicroStrategy\Repository\pgsql\bin

示例:

复制
# To restore platform_analytics_wh from dump file with creating same database name
pg_restore -d postgres -Umstr --clean --create platform_analytics_wh.dump

# To restore mstr_collab to the new created database from dump file
psql -Umstr -d mstr_collab < mstr_collab.sql

# To restore pg_dumpall file all_dbs.out
psql -Umstr -f all_dbs.out postgres

Linux

默认路径: /opt/mstr/MicroStrategy/install/Repository/bin

在 Linux 上运行恢复实用程序之前,您必须:

  • 来源 setenv.sh 文件下 /opt/mstr/MicroStrategy/install/Repository/bin

    如果不这样做会导致以下错误:

    加载共享库时出错:libpq.so.5:无法打开共享对象文件:没有这样的文件或目录。

  • 声明 Unix 域套接字使用 /tmp 路径,因为原生 PostgreSQL back 实用程序使用 /var/run/postgresql/ 默认路径。

    如果没有声明路径,则会出现以下错误:

    pg_dump:[archiver(db)] 与数据库“mstr”的连接失败:无法连接到服务器:没有这样的文件或目录。服务器是否在本地运行并接受 Unix 域套接字“/var/run/postgresql/.s.PGSQL.5432”上的连接?

示例:

复制
# To restore database platform_analytics_wh
cd /opt/mstr/MicroStrategy/install/Repository/bin
./mstr_pg_restore -d platform_analytics_wh -Umstr < platform_analytics_wh.dump