标题: 【VMware vCenter】一次性说清晰 vCenter Server 的 CLI 摆设方式。 [打印本页] 作者: 王柳 时间: 2024-8-9 14:45 标题: 【VMware vCenter】一次性说清晰 vCenter Server 的 CLI 摆设方式。 VMware vCenter Server 是 VMware vSphere 解决方案的核心组件,用于管理多个 ESXi 主机并实现更多高级功能特性(如 HA、DRS 以及 FT 等),相信各人已经非常认识了。对于 vCenter Server 的安装和摆设,可能大部分人会选择使用 GUI 方式摆设 vCenter Server,并使用 vCenter Server ISO 镜像文件中的 \vcsa-ui-installer\win32\installer.exe 摆设步伐,如下图所示。摆设过程分为两个阶段,第一阶段设置并摆设 vCenter Server 的 OVA 虚拟机文件;第二阶段设置并启动 vCenter Server 虚拟机的服务。
其实,对于 vCenter Server 的摆设还支持 CLI 摆设方式,像我这种在实验室中经常需要安装删除 vCenter Server 环境的来说,可能更喜欢 CLI 自动化摆设方式,因为如许可以节约很多时间来做其他事情。如果你能了解 vCenter Server 的 GUI 摆设过程,那对于使用 CLI 的摆设方式应该也会非常简单。下面来看看如何使用 CLI 方式来摆设我们所需要的 vCenter Server 环境,涵盖了 GUI 摆设过程中的所有场景,更多内容和细节请查察 vCenter Server 产物文档。
将 vCenter Server ISO 镜像文件挂载到当地虚拟机光驱 F 盘符上,可以看到 vCenter Server 安装镜像文件中包罗的所有文件,如下图所示。注,对于 vCenter Server 的 CLI 摆设将使用 PowerShell 方式执行,ISO 镜像文件基于 vCenter Server 8.0 U2b,内部版本号 23319993。
将 vCenter Server 虚拟机摆设到现有 vCenter Server 上,通常是当前环境中已经具有 vSphere 环境并想在之上摆设别的一套环境,这种场景需要用到 vCenter Server 镜像文件中的 embedded_vCSA_on_VC.json 设置文件,根据这个设置文件修改为实际环境中的信息,示比方下:
{
"__version": "2.13.0",
"__comments": "将 vCenter Server 虚拟机部署到现有 vCenter Server 上",
"new_vcsa": {
"vc": {
"__comments": [
"'datacenter' must end with a datacenter name, and only with a datacenter name.",
"'target' must end with an ESXi hostname, a cluster name, or a resource pool name.",
"The item 'Resources' must precede the resource pool name. ",
"All names are case-sensitive. ",
"For details and examples, refer to template help, i.e. vcsa-deploy {install|upgrade|migrate} --template-help"
],
"hostname": "vcsa8-01.mulab.local",
"username": "administrator@vsphere.local",
"password": "vSphere8@password",
"deployment_network": "VM Network",
"datacenter": [
"mulab"
],
"datastore": "vsanDatastore",
"target": [
"vsan8-hci-esa"
]
},
"appliance": {
"__comments": [
"vCenter Server 部署参数"
],
"thin_disk_mode": true,
"deployment_option": "tiny",
"name": "vcenter02"
},
"network": {
"ip_family": "ipv4",
"mode": "static",
"system_name": "vcenter02.mulab.local",
"ip": "192.168.32.56",
"prefix": "24",
"gateway": "192.168.32.254",
"dns_servers": [
"192.168.32.3"
]
},
"os": {
"password": "vSphere8@password",
"ntp_servers": "192.168.32.3",
"ssh_enable": true
},
"sso": {
"password": "vSphere8@password",
"domain_name": "vsphere.local"
}
},
"ceip": {
"description": {
"__comments": [
"++++VMware Customer Experience Improvement Program (CEIP)++++",
"VMware's Customer Experience Improvement Program (CEIP) ",
"provides VMware with information that enables VMware to ",
"improve its products and services, to fix problems, ",
"and to advise you on how best to deploy and use our ",
"products. As part of CEIP, VMware collects technical ",
"information about your organization's use of VMware ",
"products and services on a regular basis in association ",
"with your organization's VMware license key(s). This ",
"information does not personally identify any individual. ",
"",
"Additional information regarding the data collected ",
"through CEIP and the purposes for which it is used by ",
"VMware is set forth in the Trust & Assurance Center at ",
"http://www.vmware.com/trustvmware/ceip.html . If you ",
"prefer not to participate in VMware's CEIP for this ",
"product, you should disable CEIP by setting ",
"'ceip_enabled': false. You may join or leave VMware's ",
"CEIP for this product at any time. Please confirm your ",
前面两种场景分别是将 vCenter Server 摆设到 ESXi 主机或者现有 vCenter Server 上,针对前面两种情况,可能你有同时摆设多个 vCenter Server 环境的需求,可以将 embedded_vCSA_on_ESXi.json 或者 embedded_vCSA_on_VC.json 设置文件复制为多个 vCenter Server 的摆设设置文件,然后将这些文件放在同一个文件夹内(如 deploy-multiple-vcenter),摆设的时间指定这个文件夹即可同时摆设多个 vCenter Server 环境。
摆设具有增强型链接模式 vCenter Server 的时间,可能大部分情况是环境中已经有第一个 vCenter Server 了,然后再使用上面所述的方式摆设第二个 vCenter Server 并将其链接到第一个 vCenter Server 中。其实,如果环境中没有第一个 vCenter Server 的时间,也可以同时摆设增强型链接模式的 vCenter Server,好比,deploy-vcenter01-on-esxi.json 设置文件用于摆设第一个 vCenter Server,deploy-vcenter01-elm-on-esxi.json 设置文件用于摆设具有增强型链接模式的第二个 vCenter Server,将这两个 JSON 设置文件放在同一文件夹中,在摆设的时间指定这个文件夹,如许 CLI 摆设完第一个 vCenter Server 后,然后当第二个 vCenter Server 摆设的时间就会自动链接到第一个 vCenter Server 中去。
五、将 vCenter Server 虚拟机摆设到 ESXi 主机上并设置单节点 vSAN ESA 集群
对于初始构建 vSphere 环境的用户来说,可能 ESXi 主机安装摆设以后,想直接将 ESXi 主机应用于 vSAN 环境,同时又想将 vSAN 存储用于承载 vCenter Server。如果使用以上所述场景,摆设 vCenter Server 的前提是环境中必须具有效于存放 vCenter Server 的当地/共享存储,但是,VMware 这里提供了一种方式,在摆设 vCenter Server 之前,可以直接将初始安装的 ESXi 主机转换成 vSAN 集群的第一台主机,如许设置为单节点 vSAN 集群后,再将设置后的 vSAN 存储用于承载 vCenter Server 虚拟机所使用的存储。如果是如许,就不用单独先设置 ESXi 主机的当地/共享存储用于摆设 vCenter Server 了,这也是 VMware 很多解决方案所使用的方式,好比 VMware Cloud Foundation。
将 vCenter Server 虚拟机摆设到 ESXi 主机上并设置单节点 vSAN ESA 集群,需要用到 vCenter Server 镜像文件中的 vCSA_with_cluster_on_ESXi.json 设置文件,根据这个设置文件修改为实际环境中的信息,示比方下:
{
"__version": "2.13.0",
"__comments": "将 vCenter Server 虚拟机部署到 ESXi 主机上并配置单节点 vSAN ESA 集群",
"new_vcsa": {
"esxi": {
"hostname": "esxi.mulab.local",
"username": "root",
"password": "vSphere8@password",
"deployment_network": "VM Network",
"VCSA_cluster": {
"__comments": [
"Optional section. You must provide this option if you want to create the vSAN bootstrap cluster"
],
"datacenter": "datacenter",
"cluster": "vsan-esa",
"compression_only": false,
"deduplication_and_compression": false,
"enable_vlcm": true,
"enable_vsan_esa": true,
"storage_pool": {
"single_tier": [
"0654f79de904b1744a000c29669162b236",
"063ec1878a6b90d657000c296a1c16f648"
]
},
"vsan_hcl_database_path": "all.json"
}
},
"appliance": {
"__comments": [
"vCenter Server 部署参数"
],
"thin_disk_mode": true,
"deployment_option": "small",
"name": "vcenter"
},
"network": {
"ip_family": "ipv4",
"mode": "static",
"ip": "192.168.32.50",
"dns_servers": [
"192.168.32.3"
],
"prefix": "24",
"gateway": "192.168.32.254",
"system_name": "vcenter.mulab.local"
},
"os": {
"password": "vSphere8@password",
"ntp_servers": "192.168.32.3",
"ssh_enable": true
},
"sso": {
"password": "vSphere8@password",
"domain_name": "vsphere.local"
}
},
"ceip": {
"description": {
"__comments": [
"++++VMware Customer Experience Improvement Program (CEIP)++++",
"VMware's Customer Experience Improvement Program (CEIP) ",
"provides VMware with information that enables VMware to ",
"improve its products and services, to fix problems, ",
"and to advise you on how best to deploy and use our ",
"products. As part of CEIP, VMware collects technical ",
"information about your organization's use of VMware ",
"products and services on a regular basis in association ",
"with your organization's VMware license key(s). This ",
"information does not personally identify any individual. ",
"",
"Additional information regarding the data collected ",
"through CEIP and the purposes for which it is used by ",
"VMware is set forth in the Trust & Assurance Center at ",
"http://www.vmware.com/trustvmware/ceip.html . If you ",
"prefer not to participate in VMware's CEIP for this ",
"product, you should disable CEIP by setting ",
"'ceip_enabled': false. You may join or leave VMware's ",
"CEIP for this product at any time. Please confirm your ",