共享磁盘:
另加一个虚机,为这三台主机提供服务
10.100.21.222
Disk /dev/sdb: 96.6 GB, 96636764160 bytes
255 heads, 63 sectors/track, 11748 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
其中15G预分配给 OCR 资源 剩余 预分配给+DATA
FDISK这样分区:
Device Boot Start End Blocks Id System /dev/sdb1 1 654 5253223+ 83 Linux /dev/sdb2 655 1308 5253255 83 Linux /dev/sdb3 1309 1962 5253255 83 Linux /dev/sdb4 1963 11748 78606045 5 Extended /dev/sdb5 1963 4574 20980858+ 83 Linux /dev/sdb6 4575 7186 20980858+ 83 Linux /dev/sdb7 7187 11748 36644233+ 83 Linux
reboot os 使其配置生效
[root@racdata ~]# partprobe
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (Device or resource busy). As a result, it may not reflect all of your changes until after reboot.
[root@racdata ~]# reboot
ISCSI 配置(因为这里没有存储,所以用ISCSI来设置)
racdata 机器安装,rac节点也安装下
[root@racdata ~]# rpm -aq|grep scsi
lsscsi-0.23-3.el6.x86_64
scsi-target-utils-1.0.24-16.0.2.el6.x86_64
iscsi-initiator-utils-6.2.0.873-14.0.1.el6.x86_64
[root@racdb01 ~]# cat /etc/tgt/targets.conf
<target iqn.2017-09.racdata:asm>
backing-store /dev/sdb1
backing-store /dev/sdb2
backing-store /dev/sdb3
backing-store /dev/sdb5
backing-store /dev/sdb6
backing-store /dev/sdb7
initiator-address 10.100.21.0/24
write-cache off
</target>
配置的命名规则:
iqn = iSCSI Qualified Name
iSCSI target的名称规则如下:
iqn.2014-07.dev.iscsi-target:iscsidisk
iqn.年份-月份.域名反写.设备识别
每个在同一个target上的backing-store 称为逻辑单元号(Logical Unit Number,LUN),这个实验中有6个LUN。
[root@racdata ~]# vim /etc/tgt/targets.conf
[root@racdata ~]# /etc/init.d/tgtd start Starting SCSI target daemon: [ OK ] [root@racdata ~]# netstat -anlp|grep tgt tcp 0 0 0.0.0.0:3260 0.0.0.0:* LISTEN 9597/tgtd tcp 0 0 :::3260 :::* LISTEN 9597/tgtd unix 2 [ ACC ] STREAM LISTENING 21166 9597/tgtd /var/run/tgtd.ipc_abstract_namespace.0 unix 2 [ ] DGRAM 25893 9597/tgtd [root@racdata ~]# tgt-admin --show Target 1: iqn.2017-09.racdata:asm System information: Driver: iscsi State: ready I_T nexus information: LUN information: LUN: 0 Type: controller SCSI ID: IET 00010000 SCSI SN: beaf10 Size: 0 MB, Block size: 1 Online: Yes Removable media: No Prevent removal: No Readonly: No Backing store type: null Backing store path: None Backing store flags: LUN: 1 Type: disk SCSI ID: IET 00010001 SCSI SN: beaf11 Size: 5379 MB, Block size: 512 Online: Yes Removable media: No Prevent removal: No Readonly: No Backing store type: rdwr Backing store path: /dev/sdb1 Backing store flags: LUN: 2 Type: disk SCSI ID: IET 00010002 SCSI SN: beaf12 Size: 5379 MB, Block size: 512 Online: Yes Removable media: No Prevent removal: No Readonly: No Backing store type: rdwr Backing store path: /dev/sdb2 Backing store flags: LUN: 3 Type: disk SCSI ID: IET 00010003 SCSI SN: beaf13 Size: 5379 MB, Block size: 512 Online: Yes Removable media: No Prevent removal: No Readonly: No Backing store type: rdwr Backing store path: /dev/sdb3 Backing store flags: LUN: 4 Type: disk SCSI ID: IET 00010004 SCSI SN: beaf14 Size: 21484 MB, Block size: 512 Online: Yes Removable media: No Prevent removal: No Readonly: No Backing store type: rdwr Backing store path: /dev/sdb5 Backing store flags: LUN: 5 Type: disk SCSI ID: IET 00010005 SCSI SN: beaf15 Size: 21484 MB, Block size: 512 Online: Yes Removable media: No Prevent removal: No Readonly: No Backing store type: rdwr Backing store path: /dev/sdb6 Backing store flags: LUN: 6 Type: disk SCSI ID: IET 00010006 SCSI SN: beaf16 Size: 37524 MB, Block size: 512 Online: Yes Removable media: No Prevent removal: No Readonly: No Backing store type: rdwr Backing store path: /dev/sdb7 Backing store flags: Account information: ACL information: 10.100.21.0/24 [root@racdata ~]#
客户端执行
chkconfig iscsid on;
chkconfig iscsi on;
iscsiadm -m discovery -t sendtargets -p 10.100.21.222
输出结果
[root@racdb01 ~]# iscsiadm -m discovery -t sendtargets -p 10.100.21.222
10.100.21.222:3260,1 iqn.2017-09.racdata:asm
重启所有rac节点服务器:
[root@racdb03 ~]# fdisk -l
[root@racdb01 ~]# fdisk -l|grep sd
Disk /dev/sda: 536.9 GB, 536870912000 bytes
/dev/sda1 1 4178 33554432 82 Linux swap / Solaris
/dev/sda2 * 4178 65271 490732544 83 Linux
Disk /dev/sdb: 5379 MB, 5379300864 bytes
Disk /dev/sdc: 5379 MB, 5379333120 bytes
Disk /dev/sdd: 5379 MB, 5379333120 bytes
Disk /dev/sde: 21.5 GB, 21484399104 bytes
Disk /dev/sdf: 21.5 GB, 21484399104 bytes
Disk /dev/sdg: 37.5 GB, 37523695104 bytes
你会发现磁盘都映射过来的。
在其中某一个rac节点,给映射过来的磁盘都格式化一下: 你会发现
[root@racdb01 ~]# fdisk -l|grep sd
Disk /dev/sda: 536.9 GB, 536870912000 bytes
/dev/sda1 1 4178 33554432 82 Linux swap / Solaris
/dev/sda2 * 4178 65271 490732544 83 Linux
Disk /dev/sdb: 5379 MB, 5379300864 bytes
/dev/sdb1 1 1020 5248889 83 Linux
Disk /dev/sdc: 5379 MB, 5379333120 bytes
/dev/sdc1 1 1020 5248889 83 Linux
Disk /dev/sdd: 5379 MB, 5379333120 bytes
/dev/sdd1 1 1020 5248889 83 Linux
Disk /dev/sde: 21.5 GB, 21484399104 bytes
/dev/sde1 1 20489 20980720 83 Linux
Disk /dev/sdf: 21.5 GB, 21484399104 bytes
/dev/sdf1 1 20489 20980720 83 Linux
Disk /dev/sdg: 37.5 GB, 37523695104 bytes
/dev/sdg1 1 35785 36643824 83 Linux
在其中某一个节点创建asm磁盘
[root@racdb01 ~]# which oracleasm
/usr/sbin/oracleasm
每个节点都执行
[root@racdb01 ~]# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting <ENTER> without typing an
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: grid
Default group to own the driver interface []: oinstall
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [ OK ]
Scanning the system for Oracle ASMLib disks: [ OK ]
[root@racdb01 ~]# oracleasm createdisk ocr01 /dev/sdb1
Writing disk header: done
Instantiating disk: done
[root@racdb01 ~]# oracleasm createdisk ocr02 /dev/sdc1
Writing disk header: done
Instantiating disk: done
[root@racdb01 ~]# oracleasm createdisk ocr03 /dev/sdd1
Writing disk header: done
Instantiating disk: done
[root@racdb01 ~]# oracleasm createdisk data01 /dev/sde1
Writing disk header: done
Instantiating disk: done
[root@racdb01 ~]# oracleasm createdisk data02 /dev/sdf1
Writing disk header: done
Instantiating disk: done
[root@racdb01 ~]# oracleasm createdisk data03 /dev/sdg1
Writing disk header: done
Instantiating disk: done
其他节点:
[root@racdb02 ~]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
Instantiating disk "OCR01"
Instantiating disk "OCR02"
Instantiating disk "OCR03"
Instantiating disk "DATA01"
Instantiating disk "DATA02"
Instantiating disk "DATA03"
root@racdb02 ~]# cat /etc/sysconfig/oracleasm
#
# This is a configuration file for automatic loading of the Oracle
# Automatic Storage Management library kernel driver. It is generated
# By running /etc/init.d/oracleasm configure. Please use that method
# to modify this file
#
# ORACLEASM_ENABLED: 'true' means to load the driver on boot.
ORACLEASM_ENABLED=true
# ORACLEASM_UID: Default user owning the /dev/oracleasm mount point.
ORACLEASM_UID=grid
# ORACLEASM_GID: Default group owning the /dev/oracleasm mount point.
ORACLEASM_GID=oinstall
# ORACLEASM_SCANBOOT: 'true' means scan for ASM disks on boot.
ORACLEASM_SCANBOOT=true
# ORACLEASM_SCANORDER: Matching patterns to order disk scanning
ORACLEASM_SCANORDER="sd"
# ORACLEASM_SCANEXCLUDE: Matching patterns to exclude disks from scan
ORACLEASM_SCANEXCLUDE="sda"
# ORACLEASM_USE_LOGICAL_BLOCK_SIZE: 'true' means use the logical block size
# reported by the underlying disk instead of the physical. The default
# is 'false'
ORACLEASM_USE_LOGICAL_BLOCK_SIZE=false
这里我们没有DNS服务器,和所谓的时间服务器
总结: rac的安装和部署其实不是多难的事情,主要是前期的配置比较复杂,不过只要勇于尝试,认证总结,总是能搞透的。
如果我的文章对您有帮助,您可以选择打赏!