Edge for Private Cloud v4.18.05
Apigee 开发者服务门户(或简称为门户)的 4.18.05 版本不允许您更新之前基于 tar 的门户版本。您只能将基于 RPM 的门户版本直接更新到 4.18.05。
不过,您可以将基于 tar 的门户版本转换为基于 4.18.05 RPM 的门户实例。在此过程中,您需要将现有门户的 MySQL/MariaDB 迁移到 Postgres 数据库。转换后,您的门户仍是基于 RPM 的门户。
您可以将许多先前版本的基于 tar 的门户迁移到基于 RPM 的门户,包括 4.16.09 和 4.17.01 版本,而不仅仅是 4.17.05 版本。唯一的要求是门户运行 Drupal 7 或更高版本。如需查看您的 Drupal 版本,请在 Drupal 菜单中依次选择报告 > 状态报告。Drupal 的版本会显示在输出的第一行中。
从基于 tar 的门户迁移到基于 RPM 的门户的简要步骤如下:
- 在新节点上安装基于 RPM 的 4.18.05 版本的门户。
- 在基于 RPM 的门户上创建新的 Postgres 数据库。
- 从基于 tar 的门户迁移门户数据库。
- 将所有附属文件从基于 tar 的门户复制到基于 RPM 的门户。
- 更新 DNS 条目,使其指向新的基于 RPM 的门户。
请注意,基于 RPM 的门户版本默认使用端口 8079,而基于 tar 的版本使用端口 80。请确保在 DNS 条目中使用正确的端口号。如需了解如何使用其他端口,请参阅设置门户使用的 HTTP 端口。
转换后的新默认安装目录
更新现在使用 Nginx/Postgres 的安装后,根目录从以下位置更改:
/opt/apigee/apigee-drupal
更改为:
/opt/apigee/apigee-drupal/wwwroot
门户转换过程
如需将门户转换为基于 RPM 的安装,请执行以下操作:
- 在与基于 tar 的门户不同的节点上安装基于 RPM 的 4.18.05 版门户。
- 在基于 RPM 的门户上,创建一个新的 Postgres 数据库。稍后,您需要将数据库从基于 tar 的门户迁移到此新数据库:
- 登录 psql:
psql -h localhost -p 5432 -U apigee
输入您的 Postgres 密码,该密码由门户配置文件中的 PG_PWD 属性定义。
- 创建新的 Postgres 数据库:
CREATE DATABASE newportaldb;
- 退出 psql:
\q
- 登录 psql:
-
在基于 tar 的门户上,移除不再使用的旧模块:
cd /var/www/html
drush sql-query --db-prefix "DELETE from {system} where name = 'apigee_account' AND type = 'module';"drush sql-query --db-prefix "DELETE from {system} where name = 'apigee_checklist' AND type = 'module';"drush sql-query --db-prefix "DELETE from {system} where name = 'apigee_sso_ui' AND type = 'module';" - 在基于 tar 的门户上,安装并配置 Migrator Drupal 模块:
-
cd /tmp
-
wget https://ftp.drupal.org/files/projects/dbtng_migrator-7.x-1.4.tar.gz
-
gunzip /tmp/dbtng_migrator-7.x-1.4.tar.gz
-
tar -xvf /tmp/dbtng_migrator-7.x-1.4.tar --directory /var/www/html/sites/all/modules
- 以管理员身份登录门户。
- 在 Drupal 菜单中选择模块。
- 启用 DBTNG Migrator 模块。
- 保存配置。
-
- 在基于 tar 的门户上,修改
/var/www/html/sites/default/settings.php以添加指向基于 RPM 的门户上新创建的数据库的第二个数据库配置。当前数据库配置名为“default”。将新配置命名为“custom”,如以下示例所示:$databases = array ( 'default' => array ( 'default' => array ( 'database' => 'devportal', 'username' => 'devportal', 'password' => 'devportal', 'host' => 'localhost', 'port' => '', 'driver' => 'mysql', 'prefix' => '', ), ), 'custom' => array ( 'default' => array ( 'database' => 'newportaldb', 'username' => 'apigee', 'password' => 'postgres', 'host' => '192.168.168.100', 'port' => '5432', 'driver' => 'pgsql', 'prefix' => '', ) ) );其中,
host和port指定 Postgres 服务器的 IP 地址和端口。Postgres 使用端口 5432 进行连接。 -
在基于 tar 的门户上,安装 Postgres 驱动程序:
- 使用 Yum 安装驱动程序:
yum install php-pdo_pgsql
- 修改
/etc/php.ini,在文件中的任意位置添加以下行:extension=pgsql.so
- 重启 Apache:
service httpd restart
- 使用 Yum 安装驱动程序:
- 在基于 tar 的门户上,将门户数据库迁移到基于 RPM 的门户:
- 以管理员身份登录门户。
- 在 Drupal 菜单中选择结构 -> 迁移工具。
- 根据上面显示的
settings.php文件,在基于 tar 的门户上选择源数据库default和目标数据库custom。 - 点击迁移。基于 tar 的数据库会迁移到基于 RPM 的数据库。
- 将
sites目录从基于 tar 的服务器复制到基于 RPM 的服务器。以下步骤中显示的路径基于默认路径。根据您的安装情况进行必要的修改。- 在基于 tar 的门户上,打包
/var/www/html/sites目录:cd /var/www/html/sites
tar -cvzf /tmp/sites.tar.gz . - 将
/tmp/sites.tar.gz复制到基于 RPM 的服务器上的/opt/apigee/apigee-drupal/wwwroot/sites。 - 解绑网站目录,但不要覆盖重要文件。
- 备份
settings.php文件:sudo cp /opt/apigee/apigee-drupal/wwwroot/sites/default/settings.php /opt/apigee/apigee-drupal/wwwroot/sites/default/settings.bak.php
- 备份现有
files目录:sudo mv /opt/apigee/apigee-drupal/wwwroot/sites/default/files /opt/apigee/apigee-drupal/wwwroot/sites/default/files_old
- 备份现有
sites目录:tar -cvzf /tmp/sites_old.tar.gz /opt/apigee/apigee-drupal/wwwroot/sites
- 从基于 tar 的服务器中解压缩
sites目录:gunzip /opt/apigee/apigee-drupal/wwwroot/sites/sites.tar.gz
tar -xvf /opt/apigee/apigee-drupal/wwwroot/sites/sites.tar - 确保复制的文件具有适当的所有权:
chown -R apigee:apigee /opt/apigee/apigee-drupal/wwwroot/sites/
- 恢复
settings.php文件:sudo cp /opt/apigee/apigee-drupal/wwwroot/sites/default/settings.bak.php /opt/apigee/apigee-drupal/wwwroot/sites/default/settings.php
- 将私密文件移至新位置:
cp -r /opt/apigee/apigee-drupal/wwwroot/sites/default/files/private/* /opt/apigee/data/apigee-drupal-devportal/private
rm -rf /opt/apigee/apigee-drupal/wwwroot/sites/default/files/privatechown -R apigee:apigee /opt/apigee/data/apigee-sap-drupal-devportal/private
- 备份
- 在基于 tar 的门户上,打包
- 在基于 tar 的门户上,仅当您将基于 tar 的门户上的 Web 根目录路径从默认路径 /var/www/html 更改为其他路径时:运行
drush status并查看files路径和private files路径:cd /var/www/html
drush status如果文件/私有文件不在
sites目录下,请将其复制到基于 RPM 的服务器,如上所示。 - 在基于 RPM 的门户上,更新
/opt/apigee/apigee-drupal/wwwroot/sites/default/settings.php以设置默认数据库的属性:vi /opt/apigee/apigee-drupal/wwwroot/sites/default/settings.php
在 settings.php 中设置默认数据库说明:
$databases = array ( 'default' => array ( 'default' => array ( 'database' => 'newportaldb', 'username' => 'apigee', 'password' => 'postgres', 'host' => 'localhost', 'port' => '5432', 'driver' => 'pgsql', 'prefix' => '', ) ) );其中,
database指定您创建的新数据库,username和password是为基于 tar 的门户上的自定义数据库定义的,prefix为空。 - 在基于 RPM 的门户上,基于 RPM 的门户版本包含的 Drupal 模块比基于 tar 的版本少。迁移到基于 RPM 的门户后,您必须检查是否有任何缺失的模块,并根据需要进行安装。
- 安装用于检测缺失模块的 Drupal
missing_module:cd /opt/apigee/apigee-drupal/wwwroot
drush dl missing_moduledrush en missing_module - 以管理员身份登录基于 RPM 的门户。
- 在 Drupal 菜单中选择报告 > 状态报告,然后检查是否有任何缺失的模块。
- 使用该报告安装任何缺失的模块,或使用以下命令:
cd /opt/apigee/apigee-drupal/wwwroot
drush dl <moduleA> <moduleB> ...drush en <moduleA> <moduleB> ... - 启用所有模块后,请确保文件归 apigee 用户所有:
chown -LR apigee:apigee /opt/apigee/apigee-drupal/wwwroot
如需详细了解文件权限,请参阅 https://www.drupal.org/node/244924。
- 安装用于检测缺失模块的 Drupal
- 在基于 RPM 的门户上,在浏览器中运行 update.php 以移除有关缺失模块的所有错误:
- 以管理员身份登录基于 RPM 的门户。
- 在浏览器中,前往以下网址:
http://portal_IP_or_DNS:8079/update.php
其中,portal_IP_or_DNS 是基于 RPM 的门户的 IP 地址或域名。
- 按照屏幕提示操作。
- 更新 DNS 条目,使其指向新的基于 RPM 的门户。
请注意,基于 RPM 的门户版本默认使用端口 8079,而基于 tar 的版本使用端口 80。请确保在 DNS 条目中使用正确的端口号。如需了解如何使用其他端口,请参阅设置门户使用的 HTTP 端口。
转换已完成。