使用VirtualBox工具在个人电脑上搭建RAC测试环境,共享存储设计方法如下:
1.利用VirtualBox中的VBoxManage工具创建磁盘,此工具在VirtualBox安装目录中可以找到
VBoxManage createhd –filename D:\VirOS\shaRedisks\crs.vdi –size 1048 –format VDI –variant Fixed
VBoxManage createhd –filename D:\VirOS\sharedisks\asm1.vdi –size 5120 –format VDI –variant Fixed
VBoxManage createhd –filename D:\VirOS\sharedisks\asm2.vdi –size 5120 –format VDI –variant Fixed
VBoxManage createhd –filename D:\VirOS\sharedisks\asm3.vdi –size 5120 –format VDI –variant Fixed
VBoxManage createhd –filename D:\VirOS\sharedisks\asm4.vdi –size 5120 –format VDI –variant Fixed
2.将创建完的磁盘连接至虚拟机上,注意中文部分“SATA 控制器”,这是一串标识符,如果你的VirtualBox使用英文界面,这里要调成英文对的控制器名
VBoxManage storageattach rac1 –storagectl “SATA 控制器” –port 1 –device 0 –type hdd –medium D:\VirOS\sharedisks\crs.vdi –mtype shareable
VBoxManage storageattach rac1 –storagectl “SATA 控制器” –port 2 –device 0 –type hdd –medium D:\VirOS\sharedisks\asm1.vdi –mtype shareable
VBoxManage storageattach rac1 –storagectl “SATA 控制器” –port 3 –device 0 –type hdd –medium D:\VirOS\sharedisks\asm2.vdi –mtype shareable
VBoxManage storageattach rac1 –storagectl “SATA 控制器” –port 4 –device 0 –type hdd –medium D:\VirOS\sharedisks\asm3.vdi –mtype shareable
VBoxManage storageattach rac1 –storagectl “SATA 控制器” –port 5 –device 0 –type hdd –medium D:\VirOS\sharedisks\asm4.vdi –mtype shareable
3.让这些磁盘能够共享,此信息将被记入到每个虚拟磁盘文件的文件头中,故其他其他再使用的时候就无需再设置成共享了
VBoxManage modifyhd D:\VirOS\sharedisks\crs.vdi –type shareable
VBoxManage modifyhd D:\VirOS\sharedisks\asm1.vdi –type shareable
VBoxManage modifyhd D:\VirOS\sharedisks\asm2.vdi –type shareable
VBoxManage modifyhd D:\VirOS\sharedisks\asm3.vdi –type shareable
VBoxManage modifyhd D:\VirOS\sharedisks\asm4.vdi –type shareable
4.将这些磁盘用如下命令加入到其他节点,同样的注意中文部分“SATA 控制器”标识名
VBoxManage storageattach rac2 –storagectl “SATA 控制器” –port 1 –device 0 –type hdd –medium D:\VirOS\sharedisks\crs.vdi –mtype shareable
VBoxManage storageattach rac2 –storagectl “SATA 控制器” –port 2 –device 0 –type hdd –medium D:\VirOS\sharedisks\asm1.vdi –mtype shareable
VBoxManage storageattach rac2 –storagectl “SATA 控制器” –port 3 –device 0 –type hdd –medium D:\VirOS\sharedisks\asm2.vdi –mtype shareable
VBoxManage storageattach rac2 –storagectl “SATA 控制器” –port 4 –device 0 –type hdd –medium D:\VirOS\sharedisks\asm3.vdi –mtype shareable
VBoxManage storageattach rac2 –storagectl “SATA 控制器” –port 5 –device 0 –type hdd –medium D:\VirOS\sharedisks\asm4.vdi –mtype shareable