绑定完请刷新页面
取消
刷新

分享好友

×
取消 复制
如何为RAC增加管理IP地址
2020-08-23 21:18:33

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

 在生产实践中,往往需要一个集群的维护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> 


试验测试完毕!


分享好友

分享这个小栈给你的朋友们,一起进步吧。

Oracle运维新鲜事-技术与管理各占半边天
创建时间:2020-08-04 11:34:57
本技术栈旨在分享技术心得,运维趣事,故障处理经验,调优案例,故障处理涉及集群,DG,OGG,大家生产中遇到的问题基本都会囊括了,我会发布生产库遇到的故障,希望在交流中互助互益,共同提高,也希望大家讨论,如果您有生产中遇到的集群问题,也可以在这里提出来,一起讨论,现实中也帮助不少同学解决了生产库的故障。
展开
订阅须知

• 所有用户可根据关注领域订阅专区或所有专区

• 付费订阅:虚拟交易,一经交易不退款;若特殊情况,可3日内客服咨询

• 专区发布评论属默认订阅所评论专区(除付费小栈外)

栈主、嘉宾

查看更多
  • Abraham林老师
    栈主
  • 小雨滴
    嘉宾
  • hawkliu
    嘉宾
  • u_97a59a25246404
    嘉宾

小栈成员

查看更多
  • 栈栈
  • dapan
  • 小菜鸟___
  • hwayw
戳我,来吐槽~