小程序框架kbone与Hybird混合开发
758
2022-09-02
DB2 HADR TSA切换
1.使用root用户登录到tsa01和tsa02节点
[root@tsa01 ~]# lsrpdomainName OpState RSCTActiveVersion MixedVersions TSPort GSPort db2ha Online 3.2.5.3 No 12347 12348 [root@tsa01 ~]# lsrpnodeName OpState RSCTVersion tsa02 Online 3.2.5.3 tsa01 Online 3.2.5.3 [root@tsa02 ~]# lsrpdomainName OpState RSCTActiveVersion MixedVersions TSPort GSPort db2ha Online 3.2.5.3 No 12347 12348 [root@tsa02 ~]# lsrpnodeName OpState RSCTVersion tsa02 Online 3.2.5.3 tsa01 Online 3.2.5.3
2.查看HADR状态
[root@tsa01 ~]# su - db2inst1 -c 'db2pd -d testdb -hadr | egrep "HADR_ROLE|HADR_STATE"' HADR_ROLE = PRIMARY HADR_STATE = PEER[root@tsa02 ~]# su - db2inst1 -c 'db2pd -d testdb -hadr | egrep "HADR_ROLE|HADR_STATE"' HADR_ROLE = STANDBY HADR_STATE = PEER
3.查看rg名称root用户登录到tsa01, tsa02任意一台
[root@tsa01 ~]# lsrgResource Group names:db2_db2inst1_db2inst1_TESTDB-rg db2_db2inst1_tsa01_0-rg db2_db2inst1_tsa02_0-rg
4.执行命令切换
[root@tsa01 ~]# rgreq -o move db2_db2inst1_db2inst1_TESTDB-rgCompleted applying request to resource group "db2_db2inst1_db2inst1_TESTDB-rg".
5.再次查看HADR状态,发现HADR角色已经发生改变
[root@tsa01 ~]# su - db2inst1 -c 'db2pd -d testdb -hadr | egrep "HADR_ROLE|HADR_STATE"' HADR_ROLE = STANDBY HADR_STATE = PEER[root@tsa02 ~]# su - db2inst1 -c 'db2pd -d testdb -hadr | egrep "HADR_ROLE|HADR_STATE"' HADR_ROLE = PRIMARY HADR_STATE = PEER
6.切换后查看
[root@tsa01 ~]# lssamOnline IBM.ResourceGroup:db2_db2inst1_db2inst1_TESTDB-rg Nominal=Online '- Online IBM.Application:db2_db2inst1_db2inst1_TESTDB-rs |- Offline IBM.Application:db2_db2inst1_db2inst1_TESTDB-rs:tsa01 '- Online IBM.Application:db2_db2inst1_db2inst1_TESTDB-rs:tsa02Online IBM.ResourceGroup:db2_db2inst1_tsa01_0-rg Nominal=Online '- Online IBM.Application:db2_db2inst1_tsa01_0-rs '- Online IBM.Application:db2_db2inst1_tsa01_0-rs:tsa01Online IBM.ResourceGroup:db2_db2inst1_tsa02_0-rg Nominal=Online '- Online IBM.Application:db2_db2inst1_tsa02_0-rs '- Online IBM.Application:db2_db2inst1_tsa02_0-rs:tsa02Online IBM.Equivalency:db2_db2inst1_db2inst1_TESTDB-rg_group-equ |- Online IBM.PeerNode:tsa01:tsa01 '- Online IBM.PeerNode:tsa02:tsa02Online IBM.Equivalency:db2_db2inst1_tsa01_0-rg_group-equ '- Online IBM.PeerNode:tsa01:tsa01Online IBM.Equivalency:db2_db2inst1_tsa02_0-rg_group-equ '- Online IBM.PeerNode:tsa02:tsa02Online IBM.Equivalency:db2_public_network_0 |- Online IBM.NetworkInterface:enp0s3:tsa01 '- Online IBM.NetworkInterface:enp0s3:tsa02[root@tsa02 ~]# lssamOnline IBM.ResourceGroup:db2_db2inst1_db2inst1_TESTDB-rg Nominal=Online '- Online IBM.Application:db2_db2inst1_db2inst1_TESTDB-rs |- Offline IBM.Application:db2_db2inst1_db2inst1_TESTDB-rs:tsa01 '- Online IBM.Application:db2_db2inst1_db2inst1_TESTDB-rs:tsa02Online IBM.ResourceGroup:db2_db2inst1_tsa01_0-rg Nominal=Online '- Online IBM.Application:db2_db2inst1_tsa01_0-rs '- Online IBM.Application:db2_db2inst1_tsa01_0-rs:tsa01Online IBM.ResourceGroup:db2_db2inst1_tsa02_0-rg Nominal=Online '- Online IBM.Application:db2_db2inst1_tsa02_0-rs '- Online IBM.Application:db2_db2inst1_tsa02_0-rs:tsa02Online IBM.Equivalency:db2_db2inst1_db2inst1_TESTDB-rg_group-equ |- Online IBM.PeerNode:tsa01:tsa01 '- Online IBM.PeerNode:tsa02:tsa02Online IBM.Equivalency:db2_db2inst1_tsa01_0-rg_group-equ '- Online IBM.PeerNode:tsa01:tsa01Online IBM.Equivalency:db2_db2inst1_tsa02_0-rg_group-equ '- Online IBM.PeerNode:tsa02:tsa02Online IBM.Equivalency:db2_public_network_0 |- Online IBM.NetworkInterface:enp0s3:tsa01 '- Online IBM.NetworkInterface:enp0s3:tsa02
7.回切root用户登录到tsa01, tsa02任意一台
[root@tsa01 ~]# rgreq -o move db2_db2inst1_db2inst1_TESTDB-rgCompleted applying request to resource group "db2_db2inst1_db2inst1_TESTDB-rg".
8.回切后查看HADR状态
[root@tsa01 ~]# su - db2inst1 -c 'db2pd -d testdb -hadr | egrep "HADR_ROLE|HADR_STATE"' HADR_ROLE = PRIMARY HADR_STATE = REMOTE_CATCHUP_PENDING[root@tsa02 ~]# su - db2inst1 -c 'db2pd -d testdb -hadr | egrep "HADR_ROLE|HADR_STATE"' HADR_ROLE = STANDBY HADR_STATE = PEER[root@tsa01 ~]# lssamOnline IBM.ResourceGroup:db2_db2inst1_db2inst1_TESTDB-rg Nominal=Online '- Online IBM.Application:db2_db2inst1_db2inst1_TESTDB-rs |- Online IBM.Application:db2_db2inst1_db2inst1_TESTDB-rs:tsa01 '- Offline IBM.Application:db2_db2inst1_db2inst1_TESTDB-rs:tsa02Online IBM.ResourceGroup:db2_db2inst1_tsa01_0-rg Nominal=Online '- Online IBM.Application:db2_db2inst1_tsa01_0-rs '- Online IBM.Application:db2_db2inst1_tsa01_0-rs:tsa01Online IBM.ResourceGroup:db2_db2inst1_tsa02_0-rg Nominal=Online '- Online IBM.Application:db2_db2inst1_tsa02_0-rs '- Online IBM.Application:db2_db2inst1_tsa02_0-rs:tsa02Online IBM.Equivalency:db2_db2inst1_db2inst1_TESTDB-rg_group-equ |- Online IBM.PeerNode:tsa01:tsa01 '- Online IBM.PeerNode:tsa02:tsa02Online IBM.Equivalency:db2_db2inst1_tsa01_0-rg_group-equ '- Online IBM.PeerNode:tsa01:tsa01Online IBM.Equivalency:db2_db2inst1_tsa02_0-rg_group-equ '- Online IBM.PeerNode:tsa02:tsa02Online IBM.Equivalency:db2_public_network_0 |- Online IBM.NetworkInterface:enp0s3:tsa01 '- Online IBM.NetworkInterface:enp0s3:tsa02[root@tsa02 ~]# lssamOnline IBM.ResourceGroup:db2_db2inst1_db2inst1_TESTDB-rg Nominal=Online '- Online IBM.Application:db2_db2inst1_db2inst1_TESTDB-rs |- Online IBM.Application:db2_db2inst1_db2inst1_TESTDB-rs:tsa01 '- Offline IBM.Application:db2_db2inst1_db2inst1_TESTDB-rs:tsa02Online IBM.ResourceGroup:db2_db2inst1_tsa01_0-rg Nominal=Online '- Online IBM.Application:db2_db2inst1_tsa01_0-rs '- Online IBM.Application:db2_db2inst1_tsa01_0-rs:tsa01Online IBM.ResourceGroup:db2_db2inst1_tsa02_0-rg Nominal=Online '- Online IBM.Application:db2_db2inst1_tsa02_0-rs '- Online IBM.Application:db2_db2inst1_tsa02_0-rs:tsa02Online IBM.Equivalency:db2_db2inst1_db2inst1_TESTDB-rg_group-equ |- Online IBM.PeerNode:tsa01:tsa01 '- Online IBM.PeerNode:tsa02:tsa02Online IBM.Equivalency:db2_db2inst1_tsa01_0-rg_group-equ '- Online IBM.PeerNode:tsa01:tsa01Online IBM.Equivalency:db2_db2inst1_tsa02_0-rg_group-equ '- Online IBM.PeerNode:tsa02:tsa02Online IBM.Equivalency:db2_public_network_0 |- Online IBM.NetworkInterface:enp0s3:tsa01 '- Online IBM.NetworkInterface:enp0s3:tsa02
DB2
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~