您好,登錄后才能下訂單哦!
SCAN的作用是簡化客戶端連接數據庫的配置,無論集群增加還是刪除節點SCAN名稱會一直保持不變,客戶端不需要做任何的修改。SCAN是一個名稱,通過DNS被解析成最多3個IP地址(SCAN VIP)
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
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。