Edge for Private Cloud v4.18.01
4.18.01 版开发者服务门户不允许您更新之前基于 tar 的门户版本。您只能直接将基于 RPM 的门户版本更新到 4.18.01。
但是,您可以将基于 tar 的门户版本转换为基于 4.18.01 RPM 的门户实例。在此过程中,您需要将现有门户的 MySQL/MariaDB 迁移到 Postgres 数据库。转换后,您的门户仍将保持基于每千次展示收入的门户。
您可以将许多先前版本的基于 tar 的门户迁移到基于 RPM 的门户,包括版本 4.16.09 和 4.17.01,而不仅仅是版本 4.17.05。唯一的要求是门户必须运行 Drupal 7 或更高版本。如需查看 Drupal 的版本,请在 Drupal 菜单中依次选择报告 > 状态报告。Drupal 的版本会显示在输出的第一行。
从基于 tar 的门户迁移到基于 RPM 的门户的简要步骤如下:
- 在新节点上安装基于 RPM 的 4.18.01 版开发者服务门户。
- 在基于 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.01 版开发者服务门户。
-
在基于 RPM 的门户上,创建一个新的 Postgres 数据库。稍后,您需要将该数据库从基于 tar 的门户迁移到这个新数据库:
- 登录到 psql:
>psql -h localhost -p 5432 -U apigee
根据门户配置文件中 PG_PWD 属性的定义,输入您的 Postgres 密码。 - 创建新的 Postgred 数据库:
# 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 "_apigee-query =system'db name'db' -
在基于 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 菜单中选择 Modules。
- 启用 DBTNG Migrator 模块。
- 保存配置。
- 在基于 tar 的门户上,修改 /var/www/html/sites/default/settings.php 以添加第二个数据库配置,指向基于 RPM 的门户上新创建的数据库。当前的数据库配置名为 default。将新配置命名为自定义:
$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:
> 服务 httpd restart
- 使用 Yum 安装驱动程序:
-
在基于 tar 的门户上,将门户数据库迁移到基于 RPM 的门户:
- 以管理员身份登录门户。
- 在 Drupal 菜单中,选择结构 -> Migrator。
- 在基于 tar 的门户 default 上选择您的源数据库,根据上面显示的 settings.php 文件选择目标数据库 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/wwwdata/root/default/files/apigee-opts
- 备份 settings.php 文件:
- 在基于 tar 的门户上,打包 /var/www/html/sites 目录:
- 在基于 tar 的门户上,仅当您将基于 tar 的门户的默认路径从 /var/www/html 更改为 Web 根目录的路径时:运行 drush status,然后查看 files 路径和 private files 路径:
> cd /var/www/html
> drush status
如果上述“<文件>/<网站>”目录未显示为 RPM 目录, - 在基于 RPM 的门户中,更新 /opt/apigee/apigee-drupal/wwwroot/sites/default/settings.php 以设置默认数据库的属性:
> vi /opt/apigee/apigee-drupal/wwwroot/sites/default/settings.php
在 settings.php 中将默认数据库说明设为,并将默认数据库说明设为在 settings.php:
中新建的数据库:
$databases = array ( 'default' => array ( 'default' => array ( 'database' => 'newportaldb', 'username' => 'apigee', 'password' => 'postgres', 'host' => 'localhost', 'port' => '5432', 'driver' => 'pgsql', 'prefix' => '', ) ) );
-
在基于 RPM 的门户上,基于 RPM 的门户版本包含的 Drupal 模块数量少于基于 tar 的版本。迁移到基于 RPM 的门户后,您必须检查是否有任何缺失的模块,并根据需要安装这些模块。
- 安装用于检测缺失模块的 Drupal missing_module:
> cd /opt/apigee/apigee-drupal/wwwroot
> drush dl missing_module
> drush 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 missing_module:
-
在基于 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 端口。
转换已完成。