Ir al contenido

Proxmox VE管理与故障排除

Proxmox VE高级管理手册,集群仲裁,Ceph和Universal Print混合部署在Windows Server实验室环境中的实施指南。

0阅读

Ceph是一种集成到Proxmox VE中的软件定义存储(SDS)引擎。它允许将多台服务器上的物理磁盘(SSD/NVMe)统一为一个分布式、共享且冗余的逻辑存储池。

  1. 分布式存储:整合分散的本地硬盘,无需购买专有外部SAN/NAS阵列。
  2. 高可用性(HA):如果物理节点发生故障,数据可在剩余节点上透明访问,HA管理器可立即重启受影响的虚拟机(VM)。
  3. 实时迁移:允许在不停机或服务中断的情况下在物理节点之间移动运行中的虚拟机,因为存储是集群挂载的。
  4. 自我修复:在更换有缺陷的磁盘后,Ceph会自主启动重建和索引以恢复池的逻辑冗余。

为确保生产环境中的稳定数据仲裁:

  • 至少3个节点:避免< em >脑裂< /em >冲突场景的必要条件。
  • 专用存储网络:专用于Ceph复制流量的< strong >10 Gbps< /strong >物理链路。1 Gbps网络会导致高延迟和瓶颈。
  • 固态硬盘(SSD/NVMe):在动态虚拟化环境中提供必要的IOPS。

Proxmox VE 使用终端主机名(hostname)来构建其只读集群文件系统(/etc/pve/nodes/NOMBRE_NODO)的物理路径。直接在运行时更改此值将破坏连接和逻辑挂载。

从服务器的本地SSH控制台:

  1. 编辑系统主机名:
    Ventana de terminal
    nano /etc/hostname
    # Modifica 'nombre-antiguo' por 'PT-PORTEL-ADMIN-NODE01'
  2. 修改本地主机名解析:
    Ventana de terminal
    nano /etc/hosts
    # Asegura la IP correspondiente:
    # 192.168.10.50 PT-PORTEL-ADMIN-NODE01.local PT-PORTEL-ADMIN-NODE01

重启后,Proxmox将根据新主机名生成空目录结构。旧的VM和LXC配置必须手动复制到新的逻辑位置:

  1. 重启物理节点:
    Ventana de terminal
    reboot
  2. 重新通过 SSH 登录并执行文件迁移 .conf:
    Ventana de terminal
    cp /etc/pve/nodes/NOMBRE_ANTIGUO/qemu-server/* /etc/pve/nodes/PT-PORTEL-ADMIN-NODE01/qemu-server/
    cp /etc/pve/nodes/NOMBRE_ANTIGUO/lxc/* /etc/pve/nodes/PT-PORTEL-ADMIN-NODE01/lxc/

一旦通过Web GUI验证新的节点下逻辑资源和VM可访问,即可删除旧的残留物:

Ventana de terminal
rm -rf /etc/pve/nodes/NOMBRE_ANTIGUO

要断开节点与通信集群(Corosync)的连接并恢复其独立状态而不格式化物理主机:

Ventana de terminal
systemctl stop pve-cluster
systemctl stop corosync

如果网络没有仲裁,文件系统 /etc/pve 将锁定为只读模式。要在本地修改它:

Ventana de terminal
pmxcfs -l
Ventana de terminal
rm -f /etc/pve/corosync.conf
rm -rf /etc/corosync/*
Ventana de terminal
killall pmxcfs
systemctl start pve-cluster

错误 1:Cluster not ready - No Quorum

Sección titulada «Error 1: Cluster not ready - No Quorum»
  • 症状: 所有虚拟机显示灰色问号图标且无法编辑或启动。
  • 原因: 节点与Corosync集群其余部分失去通信,并阻止元数据写入以防止逻辑冲突。
  • 紧急旁路(最多 1 票):
    Ventana de terminal
    pvecm expected 1

错误 2:使用 root 删除节点文件夹时出现 Permission Denied

Sección titulada «Error 2: Permission Denied al Borrar Carpetas de Nodos con Root»
  • 症状:你尝试使用 rm -rf /etc/pve/nodes/antiguo 删除一个幽灵节点,而系统在内核层面拒绝了该操作。
  • 原因:仲裁丢失导致集群 pmxcfs 基础被锁定为只读模式。
  • 解决方案:执行本地挂载序列:
    Ventana de terminal
    systemctl stop pve-cluster
    pmxcfs -l
    rm -rf /etc/pve/nodes/antiguo
    killall pmxcfs
    systemctl start pve-cluster

本案例研究详细介绍了在Proxmox VE下运行的Windows Server Core中间打印网关的集成架构,用于将本地物理打印机连接到Microsoft 365通用打印 SaaS服务。

[💻 Cliente Windows 11] ───► [☁️ Universal Print] ───► [🔌 Conector (VM Core)]
(PT-PORTEL-ADMIN) (Microsoft 365) (w-server-2022)
│ │
▼ ▼
(Gestión Remota MMC) ────────────────────────────────► [🖨️ Impresoras Red]
  • 主机Hypervisor: 带有SSD存储的Proxmox VE节点。
  • 网关服务器(VM 来宾):Windows Server 2022 Core(最小网络安装)。
    • 服务器逻辑 IP:192.168.10.22
    • 主机名:w-server-2022
  • 管理客户端 PC:Windows 11(PT-PORTEL-ADMIN),位于本地管理子网,并已通过 Microsoft Entra ID(AzureAD\PortelAdmin)认证。
    • 管理员 IP:192.168.10.164

在Proxmox上启动Windows Server Core安装时,由于Windows内核缺乏虚拟化环境中优化的SCSI控制器驱动程序,不会显示物理目标磁盘。

  • 解决方案:
    1. 确保已将镜像 virtio-win.iso 挂载到 Proxmox 虚拟 CD 控制台中。
    2. 在Windows安装程序中点击加载驱动程序。
    3. 选择物理路径:D:\viostor\2k22\amd64。
    4. 如果磁盘在安装终端中显示为未激活,请按 Shift + F10 打开控制台,并通过 Diskpart 激活它:
      Ventana de terminal
      diskpart
      select disk 0
      attributes disk clear readonly
      online disk
      exit

由于 Windows Core 的最小界面没有经典图形控制台(devmgmt.msc),因此必须通过 PowerShell 命令为虚拟网卡配置驱动程序:

Ventana de terminal
pnputil /add-driver "D:\NetKVM\2k22\amd64\netkvm.inf" /install

加载 NetKVM 驱动后,执行基本管理工具 sconfig,以在实验室服务器子网中分配永久静态 IP 地址。


由于我们的实验室位于一个孤立的工作组中(无本地 Active Directory),且客户端 PC 已加入云端的 Entra ID(AzureAD\PortelAdmin),因此必须启用 CredSSP 并显式委派远程权限,以允许 Windows 11 的 RSAT 工具远程管理 Core 服务器的打印子系统。

步骤1:将Core服务器网络配置文件更改为专用

Sección titulada «Paso 1: Cambiar el Perfil de Red del Servidor Core a Privado»

如果Windows Server Core网络卡配置为“公共”类别,防火墙将基于DCOM/WMI阻止所有远程管理连接:

Ventana de terminal
# Identificar el InterfaceIndex del adaptador
Get-NetConnectionProfile
# Reemplazar el número de índice por el correcto obtenido (ejemplo: index 12)
Set-NetConnectionProfile -InterfaceIndex 12 -NetworkCategory Private

步骤2:在管理员客户端PC上配置受信任主机

Sección titulada «Paso 2: Configurar TrustedHosts en el PC Cliente Administrador»

在 Windows 11 管理主机(PT-PORTEL-ADMIN)的提升权限 PowerShell 终端中,将目标服务器添加到 WinRM 受信任主机列表:

Ventana de terminal
winrm set winrm/config/client '@{TrustedHosts="w-server-2022,192.168.10.22"}'

为了在打印队列配置期间授权网络密码的双跳安全传输:

  • 在 Windows 11 客户端 PC 上:
    Ventana de terminal
    Enable-WSManCredSSP -Role Client -DelegateComputer "w-server-2022"
  • 在 Core 打印服务器上:
    Ventana de terminal
    Enable-WSManCredSSP -Role Server

默认情况下,Windows会应用严格策略,从远程WMI连接中剥离本地账户的管理员权限。在Windows Server Core终端中运行此命令以禁用它:

Ventana de terminal
New-ItemProperty -Name LocalAccountTokenFilterPolicy -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Value 1 -PropertyType DWord -Force

通用打印连接器需要在目标节点上安装操作系统的基本队列框架和基础设施:

Ventana de terminal
Install-WindowsFeature Print-Services -IncludeManagementTools

允许Ricoh或Zebra驱动程序远程导入和安装到VM,而无需现场UAC授权:

Ventana de terminal
$regPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint"
if (-not (Test-Path $regPath)) { New-Item -Path $regPath -Force }
Set-ItemProperty -Path $regPath -Name "Restricted" -Value 0 -Type DWord -Force
Set-ItemProperty -Path $regPath -Name "NoWarningNoElevationOnInstall" -Value 1 -Type DWord -Force

由于 Windows 在管理已加入 Azure AD 的客户端对本地独立服务器的远程网络认证时存在反复出现的故障,你必须通过命令 runas /netonly 强制服务器凭据范围来启动远程打印管理控制台(printmanagement.msc):

Ventana de terminal
# Ejecuta en el CMD de tu PC de administración (PT-PORTEL-ADMIN)
runas /netonly /user:w-server-2022\Administrador "mmc printmanagement.msc"

该命令将使用你的本地身份启动 Windows 11 远程管理控制台,但子网中与 w-server-2022 虚拟机的通信将通过服务器管理角色隐式授权,从而可以透明地添加打印机和 TCP 端口。

不要在核心服务器上逐一添加10个网络打印机:

  1. 导出:在使用上述命令打开的 MMC 图形控制台中,右键单击本地管理 PC 节点(PT-PORTEL-ADMIN),然后选择将打印机导出到文件…。
  2. 导入:在同一控制台树中,右键单击远程服务器(w-server-2022),然后选择从文件导入打印机…,加载文件 .printerExport,以在不到一分钟内迁移 10 个端口、配置和驱动程序。

5.5. 第四阶段:在通用打印中的最终注册

Sección titulada «5.5. Fase 4: Registro Final en Universal Print»

在虚拟服务器上配置本地队列后,打开核心服务器上的远程PowerShell会话并运行连接器,将您的打印资源注册到受授权的Microsoft 365组织的云中:

Ventana de terminal
# Instalación del paquete del conector en modo desatendido
C:\Deploy\UniversalPrintConnector.exe /quiet ACCEPT_EULA=Y AUTH_CODE="CODIGO_REGISTRO_ENTRA_ID"

  • ✓ Quórum Garantizado: Servidores de clúster Proxmox resolviendo comunicaciones y enrutando almacenamiento de forma redundante.
  • ✓ Seguridad Híbrida: Enlaces remotos WinRM asegurados bajo CredSSP y UAC filtrado para administración de impresión.
  • ✓ Cuentas Limpias: Identidades y credenciales de red simuladas en consonancia con la arquitectura lógica de laboratorio de Portelcore.