【OracleDatabase】OracleRAC(九):SCAN-创新互联
SCAN的作用是简化客户端连接数据库的配置,无论集群增加还是删除节点SCAN名称会一直保持不变,客户端不需要做任何的修改。SCAN是一个名称,通过DNS被解析成最多3个IP地址(SCAN VIP)
贵南ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为成都创新互联的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:18982081108(备注:SSL证书合作)期待与您的合作!SCAN VIP的作用是接收客户端连接,SCAN VIP必须与集群的公网资源处于相同的子网,每一个SCAN VIP都会有对应的SCAN LISTENER,并且SCAN LISTENER只会监听对应的SCAN VIP,而且它们必须运行在同一个节点。SCAN VIP会均匀地分布在集群的各个节点,例如:一个包含了8个节点的集群,会选择其中3个节点运行SCAN VIP,当运行SCAN VIP的节点出现问题时,SCAN VIP会漂移到其他正常节点,对于一个两节点的集群,如果配置了3个SCAN VIP,一定会有一个节点存在两个SCAN VIP ,另一个节点存在一个SCAN VIP。
SCAN VIP和SCAN LISTENER以集群资源的形式存在,由集群的代理进程进行统一管理,SCAN VIP依赖于集群的公网资源,而SCAN LISTENER依赖于对应的SCAN VIP资源,当本地节点出现问题SCAN VIP漂移到其他节点后,对应的SCAN LISTENER也需要随着SCAN VIP一起漂移。
通过SCAN连接到数据库
阶段1:每个节点的PMON进程通过访问数据库信息将本地实例提供的服务注册到本地节点的监听程序和每一个SCAN监听程序。其中local_listener指定了PMON需要注册的本地监听程序位置,而remote_listener指定了需要注册的SCAN监听程序位置,之后,无论是本地节点的监听程序,还是SCAN监听程序都已经为接收客户端的连接做好准备。
阶段2:客户端通过tnsnames.ora中的别名向SCAN监听程序发起连接,由于SCAN监听程序分布在集群的不同节点,连接到哪个节点取决于DNS将SCAN名解析成哪一个节点的SCAN VIP(DNS使用轮询的方式返回SCAN对应的IP地址)。
阶段3:SCAN监听程序在收到了客户端发送的请求后,根据每个节点的负责情况,将客户端连接转发给负载最低的节点本地监听程序,之后对应节点的本地监听程序完成与客户端的连接。
服务器端负载均衡
数据库实例的PMON进程会将本地实例的服务信息和工作负载信息注册到SCAN LISTENER上,每个服务在每个节点的工作负载信息在SCAN LISTENER层面就存在了,SCAN LISTENER已经能够完成服务器端负载均衡的工作,将收到的连接直接发送给负载最低的节点的本地监听程序。
阶段1:客户端通过指定SCAN的tnsnames.ora别名连接到某一个SCAN监听程序。
阶段2:SCAN监听程序分析包含申请服务的每个节点的最新工作负载信息,选择负载最低的节点,并将客户端连接分发给对应节点的监听程序。
阶段3:本地节点的监听程序接收到了连接后,检查是否有对应的服务注册,并通知客户端重新连接本地节点监听程序。
阶段4:客户端接收到服务器对应节点的监听程序发送的信息后,重新连接新的位置。
阶段5:本地节点监听程序在接收到连接信息之后,完成对数据库的连接。
查询SCAN的配置 [root@wallet01 ~]# su - grid [grid@wallet01 ~]$ srvctl config scan SCAN name: wallet.gscaifu.com, Network: 1/192.168.40.0/255.255.255.0/eth0 SCAN VIP name: scan1, IP: /wallet.gscaifu.com/192.168.40.103 SCAN VIP name: scan2, IP: /wallet.gscaifu.com/192.168.40.101 SCAN VIP name: scan3, IP: /wallet.gscaifu.com/192.168.40.102 查询SCAN的状态 [grid@wallet01 ~]$ srvctl status scan SCAN VIP scan1 is enabled SCAN VIP scan1 is running on node wallet01 SCAN VIP scan2 is enabled SCAN VIP scan2 is running on node wallet03 SCAN VIP scan3 is enabled SCAN VIP scan3 is running on node wallet02 查询SCAN LISTENER的配置 [grid@wallet01 ~]$ srvctl config scan_listener SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521 SCAN Listener LISTENER_SCAN2 exists. Port: TCP:1521 SCAN Listener LISTENER_SCAN3 exists. Port: TCP:1521 查询SCAN LISTENER的状态 [grid@wallet01 ~]$ srvctl status scan_listener SCAN Listener LISTENER_SCAN1 is enabled SCAN listener LISTENER_SCAN1 is running on node wallet01 SCAN Listener LISTENER_SCAN2 is enabled SCAN listener LISTENER_SCAN2 is running on node wallet03 SCAN Listener LISTENER_SCAN3 is enabled SCAN listener LISTENER_SCAN3 is running on node wallet02 查询本地LISTENER的状态 [grid@wallet01 ~]$ lsnrctl status LISTENER LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-MAY-2019 15:36:20 Copyright (c) 1991, 2013, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production Start Date 07-MAY-2019 13:20:31 Uptime 0 days 2 hr. 15 min. 48 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/11.2.0.4/grid/network/admin/listener.ora Listener Log File /u01/app/grid/diag/tnslsnr/wallet01/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.40.34)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.40.134)(PORT=1521))) Services Summary... Service "+ASM" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "gspublic" has 1 instance(s). Instance "wallet1", status READY, has 1 handler(s) for this service... Service "wallet" has 1 instance(s). Instance "wallet1", status READY, has 1 handler(s) for this service... Service "walletXDB" has 1 instance(s). Instance "wallet1", status READY, has 1 handler(s) for this service... The command completed successfully 查询LISTENER_SCAN1的状态 [grid@wallet01 ~]$ lsnrctl status LISTENER_SCAN1 LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-MAY-2019 15:36:57 Copyright (c) 1991, 2013, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1))) STATUS of the LISTENER ------------------------ Alias LISTENER_SCAN1 Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production Start Date 07-MAY-2019 13:20:31 Uptime 0 days 2 hr. 16 min. 26 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/11.2.0.4/grid/network/admin/listener.ora Listener Log File /u01/app/11.2.0.4/grid/log/diag/tnslsnr/wallet01/listener_scan1/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.40.103)(PORT=1521))) Services Summary... Service "SYS$SYS.SCHEDULER$_EVENT_QUEUE.WALLET" has 1 instance(s). Instance "wallet2", status READY, has 1 handler(s) for this service... Service "gspublic" has 1 instance(s). Instance "wallet1", status READY, has 1 handler(s) for this service... Service "wallet" has 3 instance(s). Instance "wallet1", status READY, has 1 handler(s) for this service... Instance "wallet2", status READY, has 1 handler(s) for this service... Instance "wallet3", status READY, has 1 handler(s) for this service... Service "walletXDB" has 3 instance(s). Instance "wallet1", status READY, has 1 handler(s) for this service... Instance "wallet2", status READY, has 1 handler(s) for this service... Instance "wallet3", status READY, has 1 handler(s) for this service... The command completed successfully另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
网站名称:【OracleDatabase】OracleRAC(九):SCAN-创新互联
路径分享:http://scyanting.com/article/ccjigj.html