一、检查磁盘使用状态(特别注意):
1、初步确认:
与添加存储的工程师确认刚刚添加的共享存储编号,自己也要仔细检查
hdiskpower78 Available 47-T1-01 PowerPath Device
hdiskpower79 Available 47-T1-01 PowerPath Device
hdiskpower80 Available 47-T1-01 PowerPath Device
hdiskpower81 Available 47-T1-01 PowerPath Device
2、使用lspv命令:(hdiskpower)
两个节点都要执行以下命令,检查磁盘是否被操作系统使用:
---------------------------节点1:---------------------------
-
一般来说未被使用的磁盘状态为”none“ lspv |grep hdiskpower
示例如下:
hdiskpower78 none None
hdiskpower79 none None
hdiskpower80 none None
hdiskpower81 none None
-
lspv hdiskpower命令会直接输出以下内容:
在系统数据库中找不到物理卷“hdiskpower[编号]”
lspv hdiskpower[编号]
示例如下:
0516-1396 : The physical volume hdiskpower78, was not found in the
system database.
0516-1396 : The physical volume hdiskpower79, was not found in the
system database.
0516-1396 : The physical volume hdiskpower80, was not found in the
system database.
0516-1396 : The physical volume hdiskpower81, was not found in the
system database.
---------------------------节点2:--------------------------- 示例如下:
hdiskpower78 none None
hdiskpower79 none None
hdiskpower80 none None
hdiskpower81 none None
0516-1396 : The physical volume hdiskpower78, was not found in the
system database.
0516-1396 : The physical volume hdiskpower79, was not found in the
system database.
0516-1396 : The physical volume hdiskpower80, was not found in the
system database.
0516-1396 : The physical volume hdiskpower81, was not found in the
system database.
3、使用lsattr命令:(hdiskpower)
两个节点都要执行以下命令,检查磁盘是否被修改为共享存储:
lsattr -El hdiskpower[编号]
示例:(这里就用一块磁盘演示)
PR_key_value none Reserve Key. True
clr_q yes Clear Queue (RS/6000) True
location Location True
lun_id 0x50000000000000 LUN ID False
lun_reset_spt yes FC Forced Open LUN True
max_coalesce 0x100000 Maximum coalesce size True
max_retries 5 Maximum Retries True
max_transfer 0x100000 Maximum transfer size True
pvid none Physical volume identifier False
pvid_takeover yes Takeover PVIDs from hdisks True
q_err no Use QERR bit True
q_type simple Queue TYPE False
queue_depth 32 Queue DEPTH True
reassign_to 120 REASSIGN time out value True
reserve_policy single_path Reserve Policy used to reserve device on open. True
reset_delay 2 Reset Delay True
rw_timeout 40 READ/WRITE time out True
scsi_id 0x14af00 SCSI ID False
start_timeout 180 START unit time out True
ww_name 0x50000975581b6844 World Wide Name False
没有添加过共享存储的磁盘在使用”lsattr -El“命令查看磁盘时reserve_policy参数的值为:single_path
二、将磁盘修改为共享存储:
两个节点都要执行以下命令,检查磁盘属主、权限、reserve_policy参数是否被修改
1、修改磁盘属主:(rhdiskpower)
chown grid:asmadmin /dev/rhdiskpower[编号]
示例:
chown grid:asmadmin /dev/rhdiskpower78
chown grid:asmadmin /dev/rhdiskpower79
chown grid:asmadmin /dev/rhdiskpower80
chown grid:asmadmin /dev/rhdiskpower81
修改后记得检查磁盘属主是否成功更改
2、修改磁盘权限:(rhdiskpower)
chmod 660 /dev/rhdiskpower[编号]
示例:
chmod 660 /dev/rhdiskpower78
chmod 660 /dev/rhdiskpower79
chmod 660 /dev/rhdiskpower80
chmod 660 /dev/rhdiskpower81
一定要注意,看好之前已经添加过的共享存储“属主”和“权限”,新添加的共享存储应该与之前一致
修改后记得检查磁盘裸设备权限是否成功更改
3、修改reserve_policy参数:(hdiskpower)
chdev -l hdiskpower[编号] -a reserve_policy=no_reserve
因为RAC需要并发的共享盘,所以盘不能被一台服务器锁住,所以要将reserve_policy的参数“single_path”改为“no_reserve”
示例:
chdev -l hdiskpower78 -a reserve_policy=no_reserve
chdev -l hdiskpower79 -a reserve_policy=no_reserve
chdev -l hdiskpower80 -a reserve_policy=no_reserve
chdev -l hdiskpower81 -a reserve_policy=no_reserve
PR_key_value none Reserve Key. True
clr_q yes Clear Queue (RS/6000) True
location Location True
lun_id 0x52000000000000 LUN ID False
lun_reset_spt yes FC Forced Open LUN True
max_coalesce 0x100000 Maximum coalesce size True
max_retries 5 Maximum Retries True
max_transfer 0x100000 Maximum transfer size True
pvid none Physical volume identifier False
pvid_takeover yes Takeover PVIDs from hdisks True
q_err no Use QERR bit True
q_type simple Queue TYPE False
queue_depth 32 Queue DEPTH True
reassign_to 120 REASSIGN time out value True
reserve_policy no_reserve Reserve Policy used to reserve device on open. True
reset_delay 2 Reset Delay True
rw_timeout 40 READ/WRITE time out True
scsi_id 0x14af00 SCSI ID False
start_timeout 180 START unit time out True
ww_name 0x50000975581b6844 World Wide Name False
alter diskgroup DG_DATA add disk '/dev/rhdiskpower78';
添加过共享存储的磁盘在使用”lsattr -El“命令查看磁盘时reserve_policy参数的值为:no_reserve,因为一般在将某一个快盘作为共享存储使用时会修改该参数
三、开始将共享磁盘添加到asm磁盘组:
将共享磁盘ASM磁盘组有以下两种方式:(图像化界面本质也是调用命令行执行)
1、使用asmca启动图形界面添加:
使用grid用户,设置环境变量图像化窗口在本机显示,启动asmca,这里就不做过多赘述。
2、使用sqlplus / as sysasm添加:
(1)切换grid用户登录asm实例:
su - grid
sqlplus / as sysasm
(2)查询磁盘状态:
set lines 200
col NAME for a15
col PATH for a50
select name,path,state,mount_status,header_status from v$asm_disk order by NAME;
(3)将共享存储添加到asm磁盘组:(rhdiskpower)
可以在将共享磁盘添加入磁盘组时指定再平衡功率(DG_DATA是示例磁盘组)
alter diskgroup DG_DATA add disk '/dev/rhdiskpower[编号]' rebalance power 11;
平衡磁盘所用的平衡功率(默认值为1,最大为11,用大功率值平衡磁盘时十分消耗磁盘IO,,建议在服务器空闲时添加磁盘并进行再平衡)
也手动修改asm实例平衡磁盘所用的最大权值,如下:
alter session set asm_power_limit=11;
或
alter system set asm_power_limit=11;
(4)查询磁盘组容量和状态:
select group_number,name,total_mb,free_mb,state from v$asm_diskgroup;
(5)查询在平衡状态:
set lines 200
col ERROR_CODE for a30
select * from gv$asm_operation;
在磁盘组做完REBALANCE 之后该表为空
(6)查看磁盘状态:
查看磁盘状态:
Set linesize 200
Col path for a20
Col name for a20
Col mount_status for a10
Col header_status for a10
Col state for a15
Select path,name,mount_status,header_status,mode_status,state from v$asm_disk order by 1;
查看磁盘组状态:
Set linesize 200
Col group_number for 99999
Col name for a20
Col state for a15
Col type for a15
Select group_number,name,state,type from v$asm_diskgroup;
(7)查询当前asm_power_limit值:
show parameter asm_power_limit;
至此结束,有什么问题欢迎留言。
|