目录
1.概述
Oracle官方从12.2.0.1版本开始,RAC集群Private network心跳网络支持使用IPV6。
本文,主要描述在Oracle RAC 12.2.0.1版本,Private network IPV4转IPV6的操作过程,Private network IPV6转IPV4的操作过程。
2.环境信息
2.1.数据库环境信息
项目 | 值 |
GI_VERSION | 12.2.0.1 |
RDBMS_VERSION | 12.2.0.1 |
GRID_HOME | /oracle/app/grid_home |
ORACLE_HOME | /oracle/app/oracle/product/12.2/db_1 |
OS_VERSION | Red Hat Enterprise Linux Server release 6.7 (Santiago) |
2.2.IP地址信息
网卡信息 | IP | IPV4 | IPV6 |
eth1-private | rac1-priv | 192.168.2.10 | 2001:0db8:85a3:0002::10/64 |
rac2-priv | 192.168.2.20 | 2001:0db8:85a3:0002::20/64 |
3.服务器确认开启IPV6
3.1.确认网络没有禁用IPV6
[root@rac1 ~]# sysctl -a |grep -i disable_ipv6
net.ipv6.conf.all.disable_ipv6 = 0
net.ipv6.conf.default.disable_ipv6 = 0
net.ipv6.conf.lo.disable_ipv6 = 0
net.ipv6.conf.eth0.disable_ipv6 = 0
net.ipv6.conf.eth1.disable_ipv6 = 0
3.2.确认网卡可以支持IPV6
[root@rac1 ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:34:70:86 brd ff:ff:ff:ff:ff:ff
inet 172.20.10.200/24 brd 172.20.10.255 scope global eth0
inet 172.20.10.203/24 brd 172.20.10.255 scope global secondary eth0:1
inet 172.20.10.201/24 brd 172.20.10.255 scope global secondary eth0:2
inet6 2001:db8:85a3:1::201/64 scope global --->IPV6地址
valid_lft forever preferred_lft forever
inet6 2001:db8:85a3:1::203/64 scope global
3.3.确认IPV6防火墙关闭
[root@rac1 ~]# service ip6tables status
ip6tables: Firewall is not running.
4.PRIVATE心跳网络:IPV4 TO IPV6
4.1.备份ocr和profile文件
--备份profile.xml文件。
(grid)$ cp -p /oracle/app/grid_home/gpnp/rac1/profiles/peer/profile.xml /home/grid/profile.xml.bak.rac1
(grid)$ cp -p /oracle/app/grid_home/gpnp/rac2/profiles/peer/profile.xml /home/grid/profile.xml.bak.rac2
--备份ocr配置。
(root)$ /oracle/app/grid_home/bin/ocrconfig -manualbackup
4.2.关闭节点二集群
--关闭节点二,避免等下调整心跳网卡信息被驱逐。
(root)$ /oracle/app/grid_home/bin/crsctl stop crs
4.3.更新集群PRIVATE网段的网络配置信息
--查看集群网络配置信息。
(grid)$ oifcfg getif
eth1 192.168.2.0 global cluster_interconnect,asm
eth0 172.20.10.0 global public
--直接设置会出现以下错误,IPV4和IPV6不能一同使用,需要先强制删除心跳网卡。
PRIF-38: Both IPv4 and IPv6 address types are not supported for cluster interconnect.
--在节点一执行删除心跳网卡信息eth1,需要加force,否则会提示PRIF-31: Failed to delete the specified network interface because it is the last private interface。
(grid)$ oifcfg delif -global eth1/192.168.2.0 -force
--在节点一执行添加新的ipv6 private网络配置信息,对于IPV6全0这里不能使用::写法,可能会出现语法错误。
(grid)$ oifcfg setif -global eth1/2001:db8:85a3:0002:0:0:0:0:cluster_interconnect,asm
--查看集群网络配置信息,确认private已经更新。
(grid)$ oifcfg getif
eth0 2001:db8:85a3:0001:0:0:0:0 global public
eth0 172.20.10.0 global public
eth1 2001:db8:85a3:0002:0:0:0:0 global cluster_interconnect,asm
4.4.更新asmlistener的网络配置信息
--由于asm监听依赖心跳网,所以这里也需要更新asmlistener,通过新建一个新的IPV6网段的asm listener进行替换。
--在节点一执行添加一个IPV6网段的asm监听。
(grid)$ srvctl add listener -asmlistener -l ASMNEWLSNR_ASM -subnet 2001:db8:85a3:0002:0:0:0:0
--确认添加成功。
(grid)$ srvctl config listener -asmlistener
Name: ASMNET1LSNR_ASM
Type: ASM Listener
Owner: grid
Subnet: 192.168.2.0
Home: <CRS home>
End points: TCP:1526
Listener is enabled.
Listener is individually enabled on nodes:
Listener is individually disabled on nodes:
Name: ASMNEWLSNR_ASM
Type: ASM Listener
Owner: grid
Subnet: 2001:db8:85a3:0002:0:0:0:0
Home: <CRS home>
End points: TCP:1527
Listener is enabled.
Listener is individually enabled on nodes:
Listener is individually disabled on nodes:
(grid)$ srvctl config asm
ASM home: <CRS home>
Password file: +OCR/orapwASM
Backup of Password file:
ASM listener: LISTENER
ASM instance count: 3
Cluster ASM listener: ASMNET1LSNR_ASM,ASMNEWLSNR_ASM
--在节点一执行删除旧的ASM监听ASMNET1LSNR_ASM以及依赖。
(grid)$ srvctl update listener -listener ASMNET1LSNR_ASM -asm -remove -force
(grid)$ lsnrctl stop ASMNET1LSNR_ASM
--确认当前配置已经切换到新的ASMNEWLSNR_ASM。
(grid)$ srvctl config listener -asmlistener
Name: ASMNEWLSNR_ASM
Type: ASM Listener
Owner: grid
Subnet: 2001:db8:85a3:0002:0:0:0:0
Home: <CRS home>
End points: TCP:1527
Listener is enabled.
Listener is individually enabled on nodes:
Listener is individually disabled on nodes:
(grid)$ srvctl config asm
ASM home: <CRS home>
Password file: +OCR/orapwASM
Backup of Password file:
ASM listener: LISTENER
ASM instance count: 3
Cluster ASM listener: ASMNEWLSNR_ASM
4.5.关闭节点一集群
--闭节点一集群 。
(root)$ /oracle/app/grid_home/bin/crsctl stop crs
4.6.更新网卡信息为IPV6
--更新两个节点的网卡信息为IPV6。
IPV6INIT=yes
IPV6_AUTOCONF=no
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6ADDR="2001:0db8:85a3:0002::10/64"
IPV6_DEFAULTGW="2001:0db8:85a3:0002::1"
4.7.更新hosts文件
--备份hosts文件。
(root)$ cp /etc/hosts /etc/hosts.bak.20240627
--更新两个节点的hosts文件,更新IPV6地址。
2001:0db8:85a3:0002::10 rac1-priv
2001:0db8:85a3:0002::20 rac2-priv
4.8.启动集群
--两个节点启动集群。
(root)$ /oracle/app/grid_home/bin/crsctl start crs
--启动数据库。
(oracle)$ srvctl start database -d orcl
4.9.验证private网IPV6配置
--检查两个节点的心跳网卡配置,都为IPV6。
(grid)$ oifcfg getif
eth0 2001:db8:85a3:0001:0:0:0:0 global public
eth0 172.20.10.0 global public
eth1 2001:db8:85a3:0002:0:0:0:0 global cluster_interconnect,asm
--检查asm的监听,使用ipv6。
(grid)$ lsnrctl status ASMNEWLSNR_ASM
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 01-JUL-2024 14:41:29
Copyright (c) 1991, 2016, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=ASMNEWLSNR_ASM)))
STATUS of the LISTENER
------------------------
Alias ASMNEWLSNR_ASM
Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date 01-JUL-2024 14:22:18
Uptime 0 days 0 hr. 19 min. 10 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/app/grid_home/network/admin/listener.ora
Listener Log File /oracle/app/grid_base/diag/tnslsnr/rac1/asmnewlsnr_asm/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=ASMNEWLSNR_ASM)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=2001:db8:85a3:2::10)(PORT=1527)))
Services Summary...
Service "+ASM" has 2 instance(s).
Instance "+ASM1", status READY, has 2 handler(s) for this service...
Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "+ASM_ARCH" has 2 instance(s).
Instance "+ASM1", status READY, has 2 handler(s) for this service...
Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "+ASM_DATA" has 2 instance(s).
Instance "+ASM1", status READY, has 2 handler(s) for this service...
Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "+ASM_MGMT" has 2 instance(s).
Instance "+ASM1", status READY, has 2 handler(s) for this service...
Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "+ASM_OCR" has 2 instance(s).
Instance "+ASM1", status READY, has 2 handler(s) for this service...
Instance "+ASM2", status READY, has 1 handler(s) for this service...
The command completed successfully
--检查haip为ipv6。
select * from gv$cluster_interconnects;
INST_ID NAME IP_ADDRESS IS_PUB SOURCE CON_ID
---------- ------------------------------ -------------------------------------------------------------------------------------------- ------ -------------------------------------------------------------- ----------
1 fd2a:1a21:628e:1:0:c:2934:7090 NO 0
2 fd2a:1a21:628e:1:0:c:29dd:8389 NO 0
5.PRIVATE心跳网络:IPV6 TO IPV4
5.1.备份ocr和profile文件
--备份profile.xml文件。
(grid)$ cp -p /oracle/app/grid_home/gpnp/rac1/profiles/peer/profile.xml /home/grid/profile.xml.bak.rac1
(grid)$ cp -p /oracle/app/grid_home/gpnp/rac2/profiles/peer/profile.xml /home/grid/profile.xml.bak.rac2
--备份ocr配置。
(root)$ /oracle/app/grid_home/bin/ocrconfig -manualbackup
5.2.关闭节点二集群
--关闭节点二,避免等下调整心跳网卡信息被驱逐。
/oracle/app/grid_home/bin/crsctl stop crs
5.3.更新集群PRIVATE网段的网络配置信息
--查看集群网络配置信息。
(grid)$ oifcfg getif
eth1 2001:db8:85a3:0002:0:0:0:0 global cluster_interconnect,asm
eth0 172.20.10.0 global public
--直接设置会出现以下错误,IPV4和IPV6不能一同使用,需要先强制删除心跳网卡。
PRIF-38: Both IPv4 and IPv6 address types are not supported for cluster interconnect.
--在节点一执行删除心跳网卡信息eth1,需要加force,否则会提示PRIF-31: Failed to delete the specified network interface because it is the last private interface
(grid)$ oifcfg delif -global eth1/2001:db8:85a3:0002:0:0:0:0 -force
--在节点一执行添加ipv4 private网络配置信息。
(grid)$ oifcfg setif -global eth1/192.168.2.0:cluster_interconnect,asm
--查看集群网络配置信息,确认private已经更新。
(grid)$ oifcfg getif
eth0 172.20.10.0 global public
eth1 192.168.2.0 global cluster_interconnect,asm
eth0 2001:db8:85a3:0001:0:0:0:0 global public
5.4.更新asmlistener的网络配置信息
--由于asm监听依赖心跳网络,所以这里也需要更新asmlistener,通过新建一个新的IPV4网段的asm listener进行替换。
--在节点一执行添加一个IPV4网段的asm监听。
(grid)$ srvctl add listener -asmlistener -l ASMNET1LSNR_ASM -subnet 192.168.2.0
--确认添加成功。
(grid)$ srvctl config listener -asmlistener
Name: ASMNET1LSNR_ASM
Type: ASM Listener
Owner: grid
Subnet: 192.168.2.0
Home: <CRS home>
End points: TCP:1526
Listener is enabled.
Listener is individually enabled on nodes:
Listener is individually disabled on nodes:
Name: ASMNEWLSNR_ASM
Type: ASM Listener
Owner: grid
Subnet: 2001:db8:85a3:0002:0:0:0:0
Home: <CRS home>
End points: TCP:1527
Listener is enabled.
Listener is individually enabled on nodes:
Listener is individually disabled on nodes:
--在节点一执行删除旧的ASM监听ASMNEWLSNR_ASM以及依赖。
(grid)$ srvctl update listener -listener ASMNEWLSNR_ASM -asm -remove -force
(grid)$ lsnrctl stop ASMNEWLSNR_ASM
--确认当前配置已经切换到新的ASMNET1LSNR_ASM。
(grid)$ srvctl config listener -asmlistener
Name: ASMNET1LSNR_ASM
Type: ASM Listener
Owner: grid
Subnet: 192.168.2.0
Home: <CRS home>
End points: TCP:1526
Listener is enabled.
Listener is individually enabled on nodes:
Listener is individually disabled on nodes:
5.5.关闭节点一集群
--关闭集群 。
(root)$ /oracle/app/grid_home/bin/crsctl stop crs
5.6.更新网卡信息为IPV4
--两节点更新网卡信息为IPV4
IPADDR=192.168.2.10
NETMASK=255.255.255.0
GATEWAY=192.168.2.1
DEFROUTE=yes
5.7.更新hosts文件
--备份hosts文件。
(root)$ cp /etc/hosts /etc/hosts.bak.20240627
--更新hosts文件,更新IPV4地址
192.168.2.10 rac1-priv
192.168.2.20 rac2-priv
5.8.启动集群
(root)$ /oracle/app/grid_home/bin/crsctl start crs
--启动数据库。
(oracle)$ srvctl start database -d orcl
5.9.验证private网IPV4配置
--检查两个节点的心跳网卡配置,都为IPV4。
(grid)$ oifcfg getif
eth0 172.20.10.0 global public
eth1 192.168.2.0 global cluster_interconnect,asm
--检查asm的监听,使用IPV4。
(grid)$ lsnrctl status ASMNET1LSNR_ASM
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 01-JUL-2024 16:49:35
Copyright (c) 1991, 2016, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=ASMNET1LSNR_ASM)))
STATUS of the LISTENER
------------------------
Alias ASMNET1LSNR_ASM
Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date 01-JUL-2024 16:48:23
Uptime 0 days 0 hr. 1 min. 11 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/app/grid_home/network/admin/listener.ora
Listener Log File /oracle/app/grid_base/diag/tnslsnr/rac1/asmnet1lsnr_asm/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=ASMNET1LSNR_ASM)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.2.10)(PORT=1526)))
--检查haip为IPV4
select * from gv$cluster_interconnects;
INST_ID NAME IP_ADDRESS IS_PUB SOURCE CON_ID
---------- ------------------------------ -------------------------------------------------------------------------------------------- ------ -------------------------------------------------------------- ----------
1 eth1:1 169.254.136.171 NO 0
2 eth1:1 169.254.4.11 NO
Tip:欢迎关注公众号:勇敢牛牛的笔记,超140+的原创内容,每周不定期更新数据库技术文章。