ClusterStorage-236-3-在节点上配置存储卷volume

本文档介绍了如何在节点上配置GlusterFS的分布式、复制式和分布复制式存储卷,包括创建存储卷、设置访问权限、启用SSL功能、设置SSL授权节点以及启动存储卷的详细步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

0.实验环境图

 

1.创建分布式存储

在节点servera上操作,创建存储卷(默认为分布式存储),设置允许访问的网段,开启服务端ssl功能,开启客户端ssl功能,设置ssl授权节点,启动存储卷。

[root@servera ~]# gluster volume create testvol servera:/bricks/test/testvol_n1 serverb:/bricks/test/testvol_n2
volume create: testvol: success: please start the volume to access data
[root@servera ~]# gluster volume set testvol auth.allow 172.25.250.*
volume set: success
[root@servera ~]# gluster volume set testvol server.ssl on
volume set: success
[root@servera ~]# gluster volume set testvol client.ssl on
volume set: success
[root@servera ~]# gluster volume set testvol auth.ssl-allow 'servera.lab.example.com,serverb.lab.example.com,serverc.lab.example.com,serverd.lab.example.com,servere.lab.example.com,workstation.lab.example.com'
volume set: success
[root@servera ~]# gluster volume info testvol
 
Volume Name: testvol
Type: Distribute
Volume ID: 528cdf0b-39a1-460d-91bc-b45f6c2ed055
Status: Created
Number of Bricks: 2
Transport-type: tcp
Bricks:
Brick1: servera:/bricks/test/testvol_n1
Brick2: serverb:/bricks/test/testvol_n2
Options Reconfigured:
auth.ssl-allow: servera.lab.example.com,serverb.lab.example.com,serverc.lab.example.com,serverd.lab.example.com,servere.lab.example.com,workstation.lab.example.com
client.ssl: on
server.ssl: on
auth.allow: 172.25.250.*
performance.readdir-ahead: on

[root@servera ~]# gluster volume start testvol
volume start: testvol: success
 

2.复制式存储

在节点servera上操作,创建存储卷(指定replica参数),设置允许访问的网段,开启服务端ssl功能,开启客户端ssl功能,设置ssl授权节点,启动存储卷。

[root@servera ~]# gluster volume create secvol replica 2 serverc:/bricks/sec/secvol_n3 serverd:/bricks/sec/secvol_n4
volume create: secvol: success: please start the volume to access data
[root@servera ~]# gluster volume set secvol auth.allow 172.25.250.*
volume set: success
[root@servera ~]# gluster volume set secvol server.ssl on
volume set: success
[root@servera ~]# gluster volume set secvol client.ssl on
volume set: success
[root@servera ~]# gluster volume set secvol auth.ssl-allow 'servera.lab.example.com,serverb.lab.example.com,serverc.lab.example.com,serverd.lab.example.com,servere.lab.example.com,workstation.lab.example.com'
volume set: success
[root@servera ~]# gluster volume info secvol
 
Volume Name: secvol
Type: Replicate
Volume ID: 573c31d4-984c-42fe-b7ac-47b9bb1e4c4f
Status: Created
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: serverc:/bricks/sec/secvol_n3
Brick2: serverd:/bricks/sec/secvol_n4
Options Reconfigured:
auth.ssl-allow: servera.lab.example.com,serverb.lab.example.com,serverc.lab.example.com,serverd.lab.example.com,servere.lab.example.com,workstation.lab.example.com
client.ssl: on
server.ssl: on
auth.allow: 172.25.250.*
performance.readdir-ahead: on
[root@servera ~]# gluster volume start secvol
volume start: secvol: success
 

3.分布复制式

在节点servera上操作,创建存储卷(指定replica参数),设置允许访问的网段,开启服务端ssl功能,开启客户端ssl功能,设置ssl授权节点,启动存储卷。

[root@servera ~]# gluster volume create prodvol replica 2 servera:/bricks/prod/prodvol_n1 serverb:/bricks/prod/prodvol_n2 serverc:/bricks/prod/prodvol_n3 serverd:/bricks/prod/prodvol_n4
volume create: prodvol: success: please start the volume to access data
[root@servera ~]# gluster volume set prodvol auth.allow 172.25.250.*
volume set: success
[root@servera ~]# gluster volume set prodvol server.ssl on
volume set: success
[root@servera ~]# gluster volume set prodvol client.ssl on
volume set: success
[root@servera ~]# gluster volume set prodvol auth.ssl-allow 'servera.lab.example.com,serverb.lab.example.com,serverc.lab.example.com,serverd.lab.example.com,servere.lab.example.com,workstation.lab.example.com'
volume set: success
[root@servera ~]# gluster volume info prodvol
 
Volume Name: prodvol
Type: Distributed-Replicate
Volume ID: a97102d2-a002-4f0b-8c2c-ecf4904fa79d
Status: Created
Number of Bricks: 2 x 2 = 4
Transport-type: tcp
Bricks:
Brick1: servera:/bricks/prod/prodvol_n1
Brick2: serverb:/bricks/prod/prodvol_n2
Brick3: serverc:/bricks/prod/prodvol_n3
Brick4: serverd:/bricks/prod/prodvol_n4
Options Reconfigured:
auth.ssl-allow: servera.lab.example.com,serverb.lab.example.com,serverc.lab.example.com,serverd.lab.example.com,servere.lab.example.com,workstation.lab.example.com
client.ssl: on
server.ssl: on
auth.allow: 172.25.250.*
performance.readdir-ahead: on
[root@servera ~]# gluster volume start prodvol
volume start: prodvol: success
 

 

配置 Hyper-V 集群通常涉及多个步骤,包括准备主机、配置网络、安装角色与功能、创建集群以及验证配置。以下是一个通用的 PowerShell 脚本模板,可用于自动化部署和配置 Hyper-V 集群。该脚本适用于 Windows Server 2012 及以上版本。 ### Hyper-V 集群通用 PowerShell 脚本 ```powershell # 定义 Hyper-V 主机列表 $hosts = @("HVHost1", "HVHost2", "HVHost3") # 并行安装 Hyper-V 和故障转移集群功能 Invoke-Command -ComputerName $hosts { Install-WindowsFeature -Name Hyper-V, Failover-Clustering -IncludeManagementTools } # 并行重启主机以完成安装 $restartJobs = $hosts | ForEach-Object { Start-Job -ScriptBlock { param($computer) Restart-Computer -ComputerName $computer -Force -Wait } -ArgumentList $_ } Wait-Job -Job $restartJobs Remove-Job -Job $restartJobs # 创建故障转移集群 $clusterName = "MyHyperVCluster" New-Cluster -Name $clusterName -Node $hosts -NoStorage # 配置集群网络 Get-ClusterNetworkInterface -Cluster $clusterName | Set-ClusterNetworkInterface -Metric 1 # 添加存储(如果需要) # 假设共享存储已经配置好,并映射到所有节点 $storagePath = "\\ClusterStorage\Volume1" Add-ClusterDisk -Cluster $clusterName -DiskPath $storagePath # 验证集群配置 Test-Cluster -Cluster $clusterName -Include "Storage", "Network", "System" # 启用 Live Migration Get-ClusterResource -Cluster $clusterName | Where-Object { $_.ResourceType -eq "Network Name" } | Set-ClusterParameter -Name "EnableSharedVHD" -Value 1 # 配置集群角色(例如虚拟机) # 假设已经存在名为 "MyVM" 的虚拟机 Add-ClusterVirtualMachineRole -Cluster $clusterName -VirtualMachine "MyVM" ``` ### 脚本说明 - **安装角色与功能**:使用 `Install-WindowsFeature` 安装 Hyper-V 和故障转移集群功能,并包含管理工具。 - **并行操作**:通过 `Invoke-Command` 和 `Start-Job` 实现并行操作,提高部署效率。 - **创建集群**:使用 `New-Cluster` 创建一个没有存储的集群,适用于大多数 Hyper-V 集群场景。 - **网络配置**:通过 `Set-ClusterNetworkInterface` 设置网络接口的优先级。 - **存储配置**:如果使用共享存储,可以通过 `Add-ClusterDisk` 添加。 - **集群验证**:使用 `Test-Cluster` 验证集群配置是否符合要求。 - **Live Migration**:启用共享 VHD 以支持 Live Migration。 - **虚拟机角色**:将虚拟机添加到集群中,使其成为高可用性角色。 ### 注意事项 - 在运行脚本之前,请确保所有主机已加入域,并且 DNS 配置正确,以避免集群创建失败[^4]。 - 如果遇到网络或 DNS 问题,可能需要手动修复集群配置- 脚本中的存储路径和虚拟机名称需要根据实际环境进行调整。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值