您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

如何设置 Moodle 辅助角色节点How to set up Moodle worker nodes

按照以下步骤配置 Moodle 的虚拟机规模集或辅助角色节点。Follow these steps to configure a virtual machine scale set, or worker nodes, for Moodle.

虚拟机规模集实例Virtual machine scale set instances

为虚拟机规模集实例分配一个专用 IP 地址。A virtual machine scale set instance is assigned a private IP address. 只能使用与 IP 地址位于同一虚拟网络中的控制器虚拟机访问此 IP 地址。You can only access this IP address with a controller virtual machine that is in the same virtual network as the IP address. 本文介绍如何设置该 IP 地址,然后配置 Moodle 迁移创建的 Azure 虚拟机规模集。This article describes how to set up that IP address and then configure the Azure virtual machine scale set that your Moodle migration creates.

访问虚拟机规模集Access the virtual machine scale set

请按照以下步骤访问虚拟机规模集:Follow these steps to access the virtual machine scale set:

  1. 确定 Azure 用于虚拟机规模集实例的专用 IP 地址:Determine the private IP address that Azure uses for your virtual machine scale set instance:

    1. 登录到 Azure 门户,找到部署创建的资源组。Sign in to the Azure portal, and locate the resource group that deployment created.

    2. 打开虚拟机规模集资源的页面。Open the page for the virtual machine scale set resource.

    3. 在左面板中,选择 " 实例"。In the left panel, select Instances.

    4. 打开正在运行的实例。Open the running instance. 在 " 概述 " 部分中,复制与该实例关联的专用 IP 地址。In the Overview section, copy the private IP address that is associated with that instance.

  2. 输入以下命令,从控制器虚拟机登录到虚拟机规模集:Enter these commands to sign in to the virtual machine scale set from the controller virtual machine:

    sudo -s
    sudo ssh azureadmin@<private IP address>
    

    在命令中, <private IP address> 是虚拟机规模集的专用 IP 地址。In the command, <private IP address> is the private IP address of the virtual machine scale set. 例如,输入:For example, enter:

    sudo -s
    sudo ssh azureadmin@172.31.X.X
    

创建备份目录Create a backup directory

迁移过程的更早步骤是将备份文件提取到中名为 storage 的目录中 /home/azureadminAn earlier step of the migration process extracted backup files to a directory named storage in /home/azureadmin. storage 目录包含 moodlemoodledata 目录、配置目录和数据库备份文件。This storage directory contains the moodle and moodledata directories, a configuration directory, and a database backup file. 登录到规模集虚拟机实例后,请输入以下命令,为这些文件创建备份目录:After signing in to your scale set virtual machine instance, enter these commands to create a backup directory for these files:

cd /home/azureadmin/
mkdir -p backup
mkdir -p backup/moodle

配置 PHP 和 web 服务器Configure the PHP and web server

若要配置 PHP 和 web 服务器,请执行以下步骤:To configure the PHP and web server, take these steps:

  1. 将 PHP 版本设置为变量:Set the PHP version to a variable:

    _PHPVER=`/usr/bin/php -r "echo PHP_VERSION;" | /usr/bin/cut -c 1,2,3`
    echo $_PHPVER
    
  2. 创建 PHP 和 web 服务器配置的备份:Create a backup of the PHP and web server configurations:

    sudo mv /etc/nginx/sites-enabled/*.conf /home/azureadmin/backup/
    sudo mv /etc/php/$_PHPVER/fpm/pool.d/www.conf /home/azureadmin/backup/www.conf  
    
  3. 复制 PHP 和 web 服务器配置文件:Copy the PHP and web server configuration files:

    sudo cp /moodle/config/nginx/*.conf  /etc/nginx/sites-enabled/
    sudo cp /moodle/config/php/www.conf /etc/php/$_PHPVER/fpm/pool.d/
    

安装缺少的扩展Install missing extensions

执行以下步骤以安装缺少的扩展:Take these steps to install missing extensions:

  1. 若要获取本地安装的 PHP 扩展的列表,请在本地虚拟机上输入以下命令:To obtain a list of PHP extensions that are installed on-premises, enter the following command on an on-premises virtual machine:

    php -m
    
  2. 使用 Azure 资源管理器模板安装以下 PHP 扩展:Use an Azure Resource Manager template to install the following PHP extensions:

    • fpm
    • cli
    • curl
    • zip
    • pear
    • mbstring
    • dev
    • mcrypt
    • soap
    • json
    • redis
    • bcmath
    • gd
    • mysql
    • xmlrpc
    • intl
    • xml
    • bz2
  3. 如果本地 Moodle 应用程序具有不在控制器虚拟机中的任何其他 PHP 扩展,请通过以下命令手动安装它们:If the on-premises Moodle application has any additional PHP extensions that aren't in the controller virtual machine, install them manually with this command:

    sudo apt-get install -y php-<extension name>
    

后续步骤Next steps

Moodle 迁移后继续操作。Continue to How to follow up after a Moodle migration.