云服务器内容精选

  • 步骤三:关联应用 将待迁移主机关联应用,在后续的规格评估和创建迁移工作流时,选择该应用,即可对应用内的所有主机进行迁移评估推荐和创建迁移任务。 在资源列表页面的主机页签,勾选需要关联到同一应用的主机,单击页面左上角的“关联到应用”,弹出关联到应用窗口。 在下拉列表中选择需要关联的应用。未提前创建应用,单击“新建应用”,输入自定义的应用名称和描述;根据实际需求,选择业务场景和使用场景;目的端区域选择目的端所在区域,单击“确定”按钮,应用创建成功。 选择应用后,单击“确定”。在主机的已关联应用列,查看资源所关联应用。
  • 准备工作 建议在源端内网环境中准备一台用于安装MgC Agent(原Edge)的Windows主机,并确保该Windows主机满足以下要求: 可以连接外网(公网),并检查是否能够访问MgC和IoTDA服务的 域名 ,具体需要检查的域名请查看域名列表。 检查是否已开放MgC Agent(原Edge)需要的端口,所需端口请查看通信矩阵。 PowerShell 版本在3.0及以上。 推荐规格不小于4U8G。 安全组的出方向规则中,需要包含8883端口。 关闭该主机上的杀毒、防护类软件,该类软件会拦截MgC Agent的执行,导致迁移工作流执行失败。 不建议将MgC Agent安装在源端待迁移的主机上,主要原因包括: 资源消耗:MgC Agent在采集和迁移运行过程中会消耗CPU和内存资源。在迁移任务量大时,这可能会对源端的业务运行造成影响。 端口占用:MgC Agent会占用源端主机上的一些端口,也可能会对源端业务产生影响。 源端是Windows主机时,源端主机需要满足如下条件: 需要对安装MgC Agent的主机开放5985端口。 需要开启WinRM远程访问,并与安装MgC Agent的主机建立连接,方法请参考Windows服务器WinRM服务配置与故障排查。 允许执行shell脚本。在源端主机打开PowerShell(以管理员身份),然后运行以下命令来查看当前的执行策略。 Get-ExecutionPolicy 如果返回值为“Restricted”,则表示不允许运行任何脚本。需要执行如下命令,并输入Y,将策略改为“RemoteSigned”。 Set-ExecutionPolicy RemoteSigned 源端是Linux主机时,源端主机需要满足如下条件: 需要对安装MgC Agent的主机开放22端口。 需要开放root账号的直接连接权限。即允许通过SSH等远程连接方式使用root账号登录到源端Linux主机。 需要启用SFTP和SSH服务。 需要支持以下SSH连接安全算法: ssh-ed25519、ecdsa-sha2-nistp256、ecdsa-sha2-nistp384、ecdsa-sha2-nistp521、rsa-sha2-512、rsa-sha2-256。 如果源端主机不支持以上安全算法,推荐升级OpenSSH版本至8.0及以上版本,否则无法进行主机深度采集。 iptable未禁用与MgC Agent所在主机的通信。在源端主机执行如下命令,如果命令输出中的source字段包含MgC Agent所在主机的访问IP和端口,则代表已禁用,需要取消禁用。 iptables -L INPUT -v -n 使用MgC之前,您需要拥有一个华为账号或一个可用于访问MgC的 IAM 用户,获取方法请参见准备工作。 在MgC控制台创建项目。
  • 使用须知 在创建 主机迁移 工作流前,请仔细阅读并了解以下使用须知内容。 项目 须知 源端下载带宽 用于源端服务器下载 SMS -Agent。 推荐带宽:每台机器不低于30 Mbit/s。 共用带宽建议:若多台机器共用,平均不低于50 Mbit/s。 迁移带宽 重要性:影响数据传输速度和迁移时间。 推荐值与预估时长:详情请参见迁移需要多长时间? CPU和内存要求 内存:至少预留520 MB。 CPU:Linux系统预留不少于0.3核,Windows系统不低于1核。 系统兼容性列表 支持迁移的操作系统列表,请参见兼容性列表。 主机迁移重要声明 了解迁移过程中的重要信息和免责声明,详情请参见 主机迁移服务 重要声明有哪些? 约束与限制 确保迁移过程符合服务条款和限制条件,详情请参见主机迁移约束与限制。 计费说明 了解迁移过程中可能产生的费用,详情请参见计费说明。 权限配置 使用IAM进行精细的权限管理,详情请参见权限配置。 网络配置及迁移端口 确保源端和目的端的网络连接和端口开放满足迁移要求,详情请参见网络配置及端口开放。
  • 步骤二:上传URL列表文件至OBS桶 登录OBS管理控制台,在左侧导航栏选择“桶列表”。 在桶列表中,单击创建的目的端OBS桶,进入“对象”页面。 单击“新建文件夹”,在“文件夹名称”中输入自定义名称(例如:minioUrl),单击“确定”。 单击上一步创建的文件夹名称,进入该文件夹,单击“上传对象”,系统弹出“上传对象”对话框。 通过以下任意方式,将待迁移对象的URL列表文件(在本文示例中为test2.txt)上传至文件夹。 拖拽URL列表文件至“上传对象”区域框内,单击“上传”。 单击“上传对象”区域框内的“添加文件”,选择URL列表文件进行添加,单击“上传”。
  • 准备工作 华为账号准备 使用MgC之前,您需要拥有一个华为账号或一个可用于访问MgC的IAM用户,并获取账号/IAM用户的访问密钥(AK/SK)。获取方法请参考准备工作。 创建应用迁移项目 在MgC控制台为本次迁移创建独立的项目,方法请参考项目管理。 创建目的端OBS桶 在华为云创建一个用于存放URL列表文件和接收源端数据的OBS标准存储桶,区域选择您希望迁移到的目的端区域。创建方法请参考创建桶。 如果使用IAM用户进行迁移,该IAM用户需要拥有目的端桶的读写权限。授权方法请参考对单个IAM用户授予桶的读写权限。 创建集群 通过集群可以创建Master节点、迁移节点和列举节点,确保存储工作流的顺利运行。创建方法请参考创建集群。
  • 更改目的端规格 在资源配置明细区域,单击主机资源操作列的“更改目的端规格”,右侧弹出资源详情窗口。 单击主机规格后的“更改规格”,可以修改目的端主机规格和镜像。 单击磁盘对应的目的端规格处的“更改规格”,可以修改目的端磁盘的存储类型和资源总用量(磁盘容量)。Linux主机的磁盘容量可以根据源端主机磁盘的实际使用量,进行缩容,即小于源端磁盘容量。更改磁盘规格后,系统会自动判断是否进行了磁盘缩容,在主机资源配置明细列表中的“磁盘缩容”列,“是”代表已缩容;“否”代表未缩容。 系统盘容量取值范围为:40 G~1024 G 数据盘容量取值范围为:10 G~32768 G 当前仅支持Linux主机磁盘缩容,需确保缩容后容量大于源端实际使用量。 跨可用区迁移场景仅支持扩容,即使配置缩容,系统也会自动创建一个与源端磁盘容量相同的目的端磁盘。
  • 如何启用 PowerShell 远程管理模块 通常Windows Server 2012及更高版本已默认启用PowerShell远程处理。如果更改了设置,可以通过以下方法重新启用PowerShell远程管理。 以管理员权限启动PowerShell。 执行如下命令,即可启用PowerShell远程管理。 Enable-PSRemoting 验证配置。在PowerShell中输入如下命令: New-PSSession 如果配置成功,则该命令会在本地计算机上创建会话,并返回一个会话对象。返回示例: Id Name ComputerName State ConfigurationName -- ---- ------------ ----- ----- 1 Session1 localhost Opened Microsoft.PowerShell 如果配置失败,请参考 PowerShell 帮助文档中的 about_Remote_Troubleshooting 获取解决方案。 父主题: 常见问题
  • 操作步骤 在执行脚本的主机上创建一个名为“rollback_hosts_win.ps1”的文件,然后将以下脚本示例的内容复制到文件中。 # Configuration # Path to the CS V file with server information. Must exist before running the script. $csvFile = "C:\Users\Public\target_servers.csv" # Manually configure # Directory for storing log files. Will be created if it doesn't exist. $logDir = "C:\Users\Public\Hosts_Script_Logs" # Automatically created # Log file for general run information. $runLog = Join-Path $logDir "run.log" # Automatically created # Log file for error messages. $errorLog = Join-Path $logDir "error.log" # Automatically created # Log file for summary information. $summaryLog = Join-Path $logDir "summary.log" # Automatically created # Initialize log directory and files function Initialize-Logs { if (-not (Test-Path $logDir)) { New-Item -Path $logDir -ItemType Directory } Add-Content -Path $runLog -Value "========================================" Add-Content -Path $runLog -Value "[INFO] $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - Starting new restore execution" Add-Content -Path $runLog -Value "========================================" Add-Content -Path $errorLog -Value "========================================" Add-Content -Path $errorLog -Value "[INFO] $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - Starting new restore execution" Add-Content -Path $errorLog -Value "========================================" Add-Content -Path $summaryLog -Value "========================================" Add-Content -Path $summaryLog -Value "[INFO] $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - Starting new restore execution" Add-Content -Path $summaryLog -Value "========================================" } # Log info function function Log-Info { param ( [string]$message ) $logMessage = "[INFO] $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - $message" Add-Content -Path $runLog -Value $logMessage Write-Output $logMessage } # Log error function function Log-Error { param ( [string]$message ) $logMessage = "[ERROR] $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - $message" Add-Content -Path $runLog -Value $logMessage Add-Content -Path $errorLog -Value $logMessage Write-Output $logMessage } # Read server information from CSV file function Read-ServersFromCSV { param ( [string]$csvFile ) if (-not (Test-Path $csvFile)) { Log-Error "CSV file '$csvFile' not found." exit 1 } return Import-Csv -Path $csvFile } # Add to TrustedHosts function Add-ToTrustedHosts { param ( [string]$ip ) # Check current TrustedHosts list $trustedHostsPath = "WSMan:\localhost\Client\TrustedHosts" $trustedHosts = (Get-Item $trustedHostsPath).Value if ($trustedHosts -eq $null -or $trustedHosts -eq "") { # Set the initial trusted host Set-Item $trustedHostsPath -Value $ip -Force Log-Info "Set initial TrustedHosts value to $ip" } elseif ($trustedHosts -notlike "*$ip*") { # Add new IP to TrustedHosts if not already present $updatedTrustedHosts = if ($trustedHosts -eq "*") { $ip } else { "$trustedHosts,$ip" } try { Set-Item $trustedHostsPath -Value $updatedTrustedHosts -Force Log-Info "Added $ip to TrustedHosts" } catch { Log-Error "Failed to add $ip to TrustedHosts: $_" } } else { Write-Host "TrustedHosts list already contains IP $ip." } } # Initialize log files Initialize-Logs # Verify CSV file if (-not (Test-Path $csvFile)) { Log-Error "CSV file '$csvFile' not found." exit 1 } # Read server information from CSV file $servers = Read-ServersFromCSV -csvFile $csvFile # Counters for success and failure $successCount = 0 $failureCount = 0 $failedServers = @() # Remote script block $remoteScriptBlock = { param () $hostsFilePath = 'C:\Windows\System32\drivers\etc\hosts' # Read the file content $content = Get-Content -Path $hostsFilePath # Initialize flag $inBlock = $false $newContent = @() # Traverse file content foreach ($line in $content) { if ($line -match '#Migration-proxy-start') { $inBlock = $true } if (-not $inBlock) { $newContent += $line } if ($line -match '#Migration-proxy-end') { $inBlock = $false continue } } # Remove trailing empty lines while ($newContent[-1] -eq '') { $newContent = $newContent[0..($newContent.Count - 2)] } # Write the new content back to the file $newContent | Set-Content -Path $hostsFilePath Write-Output 'Successfully restored hosts file on remote server.' } # Main script logic Log-Info "Script execution started." foreach ($server in $servers) { $username = $server.username $ip = $server.ip $password = $server.password if (-not $username -or -not ${ip} -or -not $password) { Log-Error "Invalid server entry: $username, ${ip}, $password. Skipping." continue } Log-Info "Starting restore for $username@${ip}" $securePassword = ConvertTo-SecureString $password -AsPlainText -Force $credential = New-Object System.Management.Automation.PSCredential ($username, $securePassword) Add-ToTrustedHosts -ip $ip try { $session = New-PSSession -ComputerName ${ip} -Credential $credential -ErrorAction Stop Invoke-Command -Session $session -ScriptBlock $remoteScriptBlock Remove-PSSession -Session $session Log-Info "Restored hosts on ${ip} successfully" $successCount++ } catch { Log-Error "Failed to restore hosts on ${ip}: $_" $failedServers += "$username@${ip}" $failureCount++ } } # Calculate failure and success percentages $totalCount = $servers.Count if ($totalCount -gt 0) { $failurePercentage = [math]::Round(($failureCount / $totalCount) * 100, 2) $successPercentage = [math]::Round(($successCount / $totalCount) * 100, 2) } else { $failurePercentage = 0 $successPercentage = 100 } # Output summary result and log to file $summaryContent = @" ======================================== [SUMMARY] $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - Execution Rollback Summary ======================================== Total number of servers: $totalCount Number of successful restores: $successCount Number of failed restores: $failureCount Failure rate: $failurePercentage% Success rate: $successPercentage% ---------------------------------------- "@ if ($failedServers.Count -gt 0) { $summaryContent += "Failed servers:`n" foreach ($server in $failedServers) { $summaryContent += " - $server`n" } } $summaryContent += "========================================" # Output summary result to log file and terminal $summaryContent | Add-Content -Path $summaryLog Write-Output $summaryContent Log-Info "Script execution completed. Check $summaryLog for summary." 根据实际情况,修改脚本中的以下配置项参数: $logDir = "C:\Users\Public\Hosts_Script_Logs" 描述:日志目录路径,用于存放运行日志、错误日志和总结日志的文件夹路径。 参数默认值: C:\Users\Public\Hosts_Script_Logs 修改建议:修改为当前用户具有写入权限的目录路径。 修改示例:$logDir ="C:\Users\username\Documents\Hosts_Script_Logs" $csvFile = "C:\Users\Public\target_servers.csv" 描述:CSV文件存放路径,包含源端主机信息。 参数默认值:C:\Users\Public\target_servers.csv 修改建议:使用绝对路径,或确保相对路径是正确的。如果CSV文件路径发生变化,需要更新填写的路径。 修改示例:$csvFile = "C:\Users\username\Documents\servers.csv" 配置项参数修改完成并保存后,以管理员身份打开PowerShell窗口,使用以下命令执行脚本: .\rollback_hosts_win.ps1 脚本会在终端窗口中输出日志信息,并在执行完毕后生成一个执行结果报告,可以在$logDir 指定目录中的 summary.log 文件中查看。
  • 概述 创建一个新的用户组migration_users,赋予MgC和SMS所需要的最小权限,后续使用的AK/SK权限以此为准。 用户通过属于admin组的用户,创建属于migration_users组的、仅支持编程访问的用户mgc-user(同时勾选访问密钥,在创建用户后下载访问密钥),该用户无法通过华为云console密码登录,仅支持编程访问。 后续提供创建mgc-user用户时下载的AK/SK给迁移中心Agent(MgC Agent,原Edge),该AK/SK负责MgC Agent注册到MgC以及迁移过程中的接口调用鉴权。
  • 操作步骤 在执行脚本的主机上创建一个名为“update_hosts_lwin.ps1”的文件,然后将以下脚本示例的内容复制到文件中。 # Configuration # Path to the CSV file with server information. Must exist before running the script. $csvFile = "C:\Users\Public\target_servers.csv" # Manually configure # Path to the hosts content file. Must exist before running the script. $hostsFile = "C:\Users\Public\hosts_content.txt" # Manually configure # Directory for storing log files. Will be created if it doesn't exist. $logDir = "C:\Users\Public\Hosts_Script_Logs" # Automatically created # Log file for general run information. $runLog = Join-Path $logDir "run.log" # Automatically created # Log file for error messages. $errorLog = Join-Path $logDir "error.log" # Automatically created # Log file for summary information. $summaryLog = Join-Path $logDir "summary.log" # Automatically created # Initialize log directory and files function Initialize-Logs { if (-not (Test-Path $logDir)) { New-Item -Path $logDir -ItemType Directory } Add-Content -Path $runLog -Value "========================================" Add-Content -Path $runLog -Value "[INFO] $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - Starting new update execution" Add-Content -Path $runLog -Value "========================================" Add-Content -Path $errorLog -Value "========================================" Add-Content -Path $errorLog -Value "[INFO] $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - Starting new update execution" Add-Content -Path $errorLog -Value "========================================" Add-Content -Path $summaryLog -Value "========================================" Add-Content -Path $summaryLog -Value "[INFO] $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - Starting new update execution" Add-Content -Path $summaryLog -Value "========================================" } # Log info function function Log-Info { param ( [string]$message ) $logMessage = "[INFO] $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - $message" Add-Content -Path $runLog -Value $logMessage Write-Output $logMessage } # Log error function function Log-Error { param ( [string]$message ) $logMessage = "[ERROR] $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - $message" Add-Content -Path $runLog -Value $logMessage Add-Content -Path $errorLog -Value $logMessage Write-Output $logMessage } # Read server information from CSV file function Read-ServersFromCSV { param ( [string]$csvFile ) if (-not (Test-Path $csvFile)) { Log-Error "CSV file '$csvFile' not found." exit 1 } return Import-Csv -Path $csvFile } # Read hosts content from TXT file function Read-HostsContentFromTXT { param ( [string]$hostsFile ) if (-not (Test-Path $hostsFile)) { Log-Error "Hosts content file '$hostsFile' not found." exit 1 } return Get-Content -Path $hostsFile -Raw } # Add to TrustedHosts function Add-ToTrustedHosts { param ( [string]$ip ) # Check current TrustedHosts list $trustedHostsPath = "WSMan:\localhost\Client\TrustedHosts" $trustedHosts = (Get-Item $trustedHostsPath).Value if ($trustedHosts -eq $null -or $trustedHosts -eq "") { # Set the initial trusted host Set-Item $trustedHostsPath -Value $ip -Force Log-Info "Set initial TrustedHosts value to $ip" } elseif ($trustedHosts -notlike "*$ip*") { # Add new IP to TrustedHosts if not already present $updatedTrustedHosts = if ($trustedHosts -eq "*") { $ip } else { "$trustedHosts,$ip" } try { Set-Item $trustedHostsPath -Value $updatedTrustedHosts -Force Log-Info "Added $ip to TrustedHosts" } catch { Log-Error "Failed to add $ip to TrustedHosts: $_" } } else { Write-Host "TrustedHosts list already contains IP $ip." } } # Initialize log files Initialize-Logs # Verify CSV file if (-not (Test-Path $csvFile)) { Log-Error "CSV file '$csvFile' not found." exit 1 } # Verify hosts file if (-not (Test-Path $hostsFile)) { Log-Error "Hosts content file '$hostsFile' not found." exit 1 } # Read server information from CSV file $servers = Read-ServersFromCSV -csvFile $csvFile # Read hosts content from TXT file $hostsContent = Read-HostsContentFromTXT -hostsFile $hostsFile # Counters for success and failure $successCount = 0 $failureCount = 0 $failedServers = @() # Remote script block $remoteScriptBlock = { param ( [string]$hostsContent ) $hostsFilePath = 'C:\Windows\System32\drivers\etc\hosts' # Read the file content $content = Get-Content -Path $hostsFilePath # Initialize flag $inBlock = $false $newContent = @() # Traverse file content foreach ($line in $content) { if ($line -match '#Migration-proxy-start') { $inBlock = $true } if (-not $inBlock) { $newContent += $line } if ($line -match '#Migration-proxy-end') { $inBlock = $false continue } } # Remove trailing empty lines while ($newContent[-1] -eq '') { $newContent = $newContent[0..($newContent.Count - 2)] } # Write the new content back to the file $newContent | Set-Content -Path $hostsFilePath # Append new Migration-proxy section Add-Content -Path $hostsFilePath -Value $hostsContent Write-Output 'Successfully updated hosts file on remote server.' } # Main script logic Log-Info "Script execution started." foreach ($server in $servers) { $username = $server.username $ip = $server.ip $password = $server.password if (-not $username -or -not ${ip} -or -not $password) { Log-Error "Invalid server entry: $username, ${ip}, $password. Skipping." continue } Log-Info "Starting update for $username@${ip}" $securePassword = ConvertTo-SecureString $password -AsPlainText -Force $credential = New-Object System.Management.Automation.PSCredential ($username, $securePassword) Add-ToTrustedHosts -ip $ip try { $session = New-PSSession -ComputerName ${ip} -Credential $credential -ErrorAction Stop Invoke-Command -Session $session -ScriptBlock $remoteScriptBlock -ArgumentList $hostsContent Remove-PSSession -Session $session Log-Info "Updated hosts on ${ip} successfully" $successCount++ } catch { Log-Error "Failed to update hosts on ${ip}: $_" $failedServers += "$username@${ip}" $failureCount++ } } # Calculate failure and success percentages $totalCount = $servers.Count if ($totalCount -gt 0) { $failurePercentage = [math]::Round(($failureCount / $totalCount) * 100, 2) $successPercentage = [math]::Round(($successCount / $totalCount) * 100, 2) } else { $failurePercentage = 0 $successPercentage = 100 } # Output summary result and log to file $summaryContent = @" ======================================== [SUMMARY] $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - Execution Update Summary ======================================== Total number of servers: $totalCount Number of successful updates: $successCount Number of failed updates: $failureCount Success rate: $successPercentage% Failure rate: $failurePercentage% ---------------------------------------- "@ if ($failedServers.Count -gt 0) { $summaryContent += "Failed servers:`n" foreach ($server in $failedServers) { $summaryContent += " - $server`n" } } $summaryContent += "========================================" # Output summary result to log file and terminal $summaryContent | Add-Content -Path $summaryLog Write-Output $summaryContent Log-Info "Script execution completed. Check $summaryLog for summary." 根据实际情况,修改脚本中的以下配置项参数: $logDir = "C:\Users\Public\Hosts_Script_Logs" 描述:日志目录路径,用于存放运行日志、错误日志和总结日志的文件夹路径。 参数默认值: C:\Users\Public\Hosts_Script_Logs 修改建议:修改为当前用户具有写入权限的目录路径。 修改示例:$logDir ="C:\Users\username\Documents\Hosts_Script_Logs" $csvFile = "C:\Users\Public\target_servers.csv" 描述:CSV文件存放路径,包含源端主机信息。 参数默认值:C:\Users\Public\target_servers.csv 修改建议:使用绝对路径,或确保相对路径是正确的。如果CSV文件路径发生变化,需要更新填写的路径。 修改示例:$csvFile = "C:\Users\username\Documents\servers.csv" $hostsFile = "C:\Users\Public\hosts_content.txt" 描述:Hosts文件存放路径,包含要追加到源端主机hosts文件中的内容。 参数默认值:C:\Users\Public\hosts_content.txt 修改建议:使用绝对路径,或确保相对路径是正确的。 修改示例:$hostsFile = "C:\Users\username\Documents\hosts_content.txt" 配置项参数修改完成并保存后,以管理员身份打开PowerShell窗口,使用以下命令执行脚本: .\update_hosts_win.ps1 脚本会在终端窗口中输出日志信息,并在执行完毕后生成一个执行结果报告,可以在$logDir 指定目录中的 summary.log 文件中查看。
  • 深度采集原理 MgC对AWS 容器资源进行深度采集的原理图,如图2所示。 图2 AWS容器深度采集原理图 对AWS容器资源进行深度采集的过程详细说明如下: 迁移中心下发命令:迁移中心向MgC Agent(原Edge)发出采集容器资源信息的命令。 MgC Agent通过凭证登录容器集群:MgC Agent使用用户提供的凭证登录至目标容器集群中。 K8s接口采集信息:MgC Agent通过Kubernetes(K8s)API接口与容器集群交互,采集容器集群的详细信息,包括容器的详细规格、节点配置、持久卷配置以及网络策略等。 信息上报给迁移中心:MgC Agent将采集到的信息上报给迁移中心。 迁移中心解析并保存信息:迁移中心接收到上报的信息后,会进行解析,提取出有用的信息,并将其保存到数据库中。
  • 准备工作 华为账号准备 使用MgC之前,您需要拥有一个华为账号或一个可用于访问MgC的IAM用户, 注册华为账号 以及创建IAM用户的方法请参考准备工作。 创建应用迁移项目 在MgC控制台为本次采集创建独立的项目(建议创建简单项目),方法请参考项目管理。 AWS账号凭证准备 提前获取待采集资源所属AWS账号的AK/SK,方法请参考获取AWS访问密钥(Access keys)。 添加源端凭证 在MgC控制台添加AWS账号凭证作为采集凭证,方法请参考添加凭证。 获取AWS容器集群的登录配置文件 配置文件将作为深度采集的凭证,以允许MgC Agent通过提供的凭证登录至AWS容器集群中,并使用K8s接口采集容器集群的详细信息。
  • 公网发现原理 使用MgC通过公网发现AWS容器资源的原理图,如图1所示。 图1 采集AWS容器资源原理图 调用SDK:通过调用Amazon EKS服务提供的API,获取容器、虚拟机等资源信息。 接口返回:MgC接收API调用的返回值,这些返回值通常包含丰富的资源数据。 解析数据:MgC将返回的数据进行解析,提取关键信息,如节点数、虚拟机核数等。然后将这些关键信息保存到数据库中,为后续分析和迁移提供支持。
  • 检查网络连通性 网络连接检查:确认执行脚本的本地计算机能够通过网络访问所有源端Windows主机的IP地址和端口。源端Windows主机需要对执行脚本的主机开放 5985端口。 防火墙配置:检查并配置本地计算机和源端主机的防火墙,确保允许通过WinRM(Windows远程管理)连接进行远程PowerShell会话。 启用WinRM服务:确保所有源端Windows主机上的WinRM服务已启用并正常运行。可以在源端主机上使用以下命令启用WinRM: Enable-PSRemoting -Force
  • 配置PowerShell执行策略 检查执行策略,确保PowerShell允许运行脚本。打开PowerShell,输入以下命令检查当前执行策略: Get-ExecutionPolicy 以下是不同的返回结果说明: Restricted:不允许执行任何脚本。 AllSigned:只能运行由可信发布者签名的脚本。 RemoteSigned:允许运行本地创建的脚本,但远程下载的脚本必须经过签名。 Unrestricted:允许运行所有脚本,但会在运行从互联网下载的脚本时发出警告。 Bypass:不阻止任何脚本的执行,不会显示任何警告或提示。 如果执行策略为Restricted或AllSigned,请通过以下命令临时更改策略,以允许运行本地创建的脚本和已签名的远程脚本。 Set-ExecutionPolicy RemoteSigned -Scope Process 该命令仅在当前PowerShell会话中更改执行策略,并在会话结束后恢复为默认策略。