如何为RAC增加管理IP地址

2020-08-23 00:00:00 节点 增加 监听 网段 公网

*************************** 在两个节点添加方法,需要先增加一个网络 (如果不与原先的公网在一个网段)*************************** 

 在生产实践中,往往需要一个集群的维护IP,这个IP同样需要高可用,如果不与原先公网在一个网段,可以采用今天我们测试的方法为集群增加管理IP,但是这种方式的劣势就是需要分配更多IP地址,而地址得对于任何单位都是稀缺资源,其实也可以在一个网段,我们当时在银行时就采用了在同一个公网网段增加管理IP的方法,如果你需要可以的单独联系我,今天我们测试与原先的公网不在一个网段增加管理IP的方法。


1 增加网络

[root@rac1 grid]# srvctl add network -k 200 -S 3.3.3.0/255.255.255.0/eth2 -w static


[root@rac1 grid]# srvctl config network

Network exists: 1/192.168.56.0/255.255.255.0/eth0, type static

Network exists: 200/3.3.3.0/255.255.255.0/eth2, type static


2 增加VIP,这里VIP就是公网IP(具有欺骗性)

之前要修改两个节点的host文件,解析VIP

[root@rac1 grid]# srvctl add vip -n rac1 -A mgr1_vip/255.255.255.0 -k 200

[root@rac1 grid]# srvctl add vip -n rac2 -A mgr2_vip/255.255.255.0 -k 200


查看VIP配置

[root@rac1 grid]# srvctl config vip -n rac1

VIP exists: /mgr1_vip/3.3.3.5/3.3.3.0/255.255.255.0/eth2, hosting node rac1

VIP exists: /rac1-vip/192.168.56.111/192.168.56.0/255.255.255.0/eth0, hosting node rac1

[root@rac1 grid]# srvctl config vip -n rac2

VIP exists: /mgr2_vip/3.3.3.6/3.3.3.0/255.255.255.0/eth2, hosting node rac2

VIP exists: /rac2-vip/192.168.56.222/192.168.56.0/255.255.255.0/eth0, hosting node rac2


3 启动VIP

[root@rac1 grid]# srvctl start vip  -i mgr1_vip

[root@rac1 grid]# srvctl start vip  -i mgr2_vip


查看VIP状态

[root@rac1 grid]# srvctl status vip -n rac1

VIP mgr1_vip is enabled

VIP mgr1_vip is running on node: rac1

VIP rac1-vip is enabled

VIP rac1-vip is running on node: rac1

[root@rac1 grid]# srvctl status vip -n rac2

VIP mgr2_vip is enabled

VIP mgr2_vip is running on node: rac2

VIP rac2-vip is enabled

VIP rac2-vip is running on node: rac2




4 通过netca创建监听或srvctl 添加监听

[grid@rac1 ~]$ srvctl add listener -l listener_mgr -p 1523 -k 200 -s


检查监听状态,并启动监听

[grid@rac1 ~]$ srvctl status listener -l listener_mgr

Listener LISTENER_MGR is enabled

Listener LISTENER_MGR is not running


[grid@rac1 ~]$ srvctl start listener -l listener_mgr


[grid@rac1 ~]$ srvctl status listener -l listener_mgr

Listener LISTENER_MGR is enabled

Listener LISTENER_MGR is running on node(s): rac2,rac1


5 lsnrctl检查监听状态,看是有服务注册


[grid@rac1 ~]$ lsnrctl status listener_mgr;


Copyright (c) 1991, 2013, Oracle.  All rights reserved.


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_MGR)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER_MGR

Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production

Uptime                    0 days 0 hr. 4 min. 25 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/11.2.0/grid/network/admin/listener.ora

Listener Log File         /u01/11.2.0/grid/log/diag/tnslsnr/rac1/listener_mgr/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_MGR)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=3.3.3.5)(PORT=1523)))

The listener supports no services

The command completed successfully


6 修改参数local_listener 

SQL> alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.111)(PORT=1521))','(ADDRESS=(PROTOCOL=TCP)(HOST=3.3.3.5)(PORT=1523))' sid='prod1';

SQL> alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.222)(PORT=1521))','(ADDRESS=(PROTOCOL=TCP)(HOST=3.3.3.6)(PORT=1523))' sid='prod2' ;


7 两个节点看服务是否注册到新网络的监听

节点1

[grid@rac1 ~]$ lsnrctl status listener_mgr;


Copyright (c) 1991, 2013, Oracle.  All rights reserved.


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_MGR)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER_MGR

Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production

Uptime                    0 days 0 hr. 13 min. 52 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/11.2.0/grid/network/admin/listener.ora

Listener Log File         /u01/11.2.0/grid/log/diag/tnslsnr/rac1/listener_mgr/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_MGR)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=3.3.3.5)(PORT=1523)))

Services Summary...

Service "prod" has 1 instance(s).

  Instance "prod1", status READY, has 1 handler(s) for this service...

The command completed successfully


节点2

[grid@rac2 Desktop]$ lsnrctl status listener_mgr;


Copyright (c) 1991, 2013, Oracle.  All rights reserved.


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_MGR)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER_MGR

Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production

Uptime                    0 days 0 hr. 14 min. 29 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/11.2.0/grid/network/admin/listener.ora

Listener Log File         /u01/11.2.0/grid/log/diag/tnslsnr/rac2/listener_mgr/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_MGR)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=3.3.3.6)(PORT=1523)))

Services Summary...

Service "prod" has 1 instance(s).

  Instance "prod2", status READY, has 1 handler(s) for this service...

The command completed successfully


8 连接测试

节点1通过VIP mgr1_vip连接测试

[oracle@rac1 ~]$ sqlplus system/oracle@mgr1_vip:1523/prod

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Real Application Clusters and Automatic Storage Management options


SQL> 


节点1通过VIP mgr2_vip连接测试

[oracle@rac1 ~]$ sqlplus system/oracle@mgr2_vip:1523/prod


Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Real Application Clusters and Automatic Storage Management options


SQL> 


试验测试完毕!


相关文章