溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

【Oracle Database】Oracle RAC(九):SCAN

發(fā)布時間:2020-06-03 23:27:08 來源:網(wǎng)絡(luò) 閱讀:381 作者:NOGYMS 欄目:關(guān)系型數(shù)據(jù)庫

SCAN的作用是簡化客戶端連接數(shù)據(jù)庫的配置,無論集群增加還是刪除節(jié)點SCAN名稱會一直保持不變,客戶端不需要做任何的修改。SCAN是一個名稱,通過DNS被解析成最多3個IP地址(SCAN VIP)

SCAN VIP的作用是接收客戶端連接,SCAN VIP必須與集群的公網(wǎng)資源處于相同的子網(wǎng),每一個SCAN VIP都會有對應(yīng)的SCAN LISTENER,并且SCAN LISTENER只會監(jiān)聽對應(yīng)的SCAN VIP,而且它們必須運行在同一個節(jié)點。SCAN VIP會均勻地分布在集群的各個節(jié)點,例如:一個包含了8個節(jié)點的集群,會選擇其中3個節(jié)點運行SCAN VIP,當(dāng)運行SCAN VIP的節(jié)點出現(xiàn)問題時,SCAN VIP會漂移到其他正常節(jié)點,對于一個兩節(jié)點的集群,如果配置了3個SCAN VIP,一定會有一個節(jié)點存在兩個SCAN VIP ,另一個節(jié)點存在一個SCAN VIP。

SCAN VIP和SCAN LISTENER以集群資源的形式存在,由集群的代理進(jìn)程進(jìn)行統(tǒng)一管理,SCAN VIP依賴于集群的公網(wǎng)資源,而SCAN LISTENER依賴于對應(yīng)的SCAN VIP資源,當(dāng)本地節(jié)點出現(xiàn)問題SCAN VIP漂移到其他節(jié)點后,對應(yīng)的SCAN LISTENER也需要隨著SCAN VIP一起漂移。

通過SCAN連接到數(shù)據(jù)庫

階段1:每個節(jié)點的PMON進(jìn)程通過訪問數(shù)據(jù)庫信息將本地實例提供的服務(wù)注冊到本地節(jié)點的監(jiān)聽程序和每一個SCAN監(jiān)聽程序。其中l(wèi)ocal_listener指定了PMON需要注冊的本地監(jiān)聽程序位置,而remote_listener指定了需要注冊的SCAN監(jiān)聽程序位置,之后,無論是本地節(jié)點的監(jiān)聽程序,還是SCAN監(jiān)聽程序都已經(jīng)為接收客戶端的連接做好準(zhǔn)備。

階段2:客戶端通過tnsnames.ora中的別名向SCAN監(jiān)聽程序發(fā)起連接,由于SCAN監(jiān)聽程序分布在集群的不同節(jié)點,連接到哪個節(jié)點取決于DNS將SCAN名解析成哪一個節(jié)點的SCAN VIP(DNS使用輪詢的方式返回SCAN對應(yīng)的IP地址)。

階段3:SCAN監(jiān)聽程序在收到了客戶端發(fā)送的請求后,根據(jù)每個節(jié)點的負(fù)責(zé)情況,將客戶端連接轉(zhuǎn)發(fā)給負(fù)載最低的節(jié)點本地監(jiān)聽程序,之后對應(yīng)節(jié)點的本地監(jiān)聽程序完成與客戶端的連接。

服務(wù)器負(fù)載均衡

數(shù)據(jù)庫實例的PMON進(jìn)程會將本地實例的服務(wù)信息和工作負(fù)載信息注冊到SCAN LISTENER上,每個服務(wù)在每個節(jié)點的工作負(fù)載信息在SCAN LISTENER層面就存在了,SCAN LISTENER已經(jīng)能夠完成服務(wù)器端負(fù)載均衡的工作,將收到的連接直接發(fā)送給負(fù)載最低的節(jié)點的本地監(jiān)聽程序。

階段1:客戶端通過指定SCAN的tnsnames.ora別名連接到某一個SCAN監(jiān)聽程序。

階段2:SCAN監(jiān)聽程序分析包含申請服務(wù)的每個節(jié)點的最新工作負(fù)載信息,選擇負(fù)載最低的節(jié)點,并將客戶端連接分發(fā)給對應(yīng)節(jié)點的監(jiān)聽程序。

階段3:本地節(jié)點的監(jiān)聽程序接收到了連接后,檢查是否有對應(yīng)的服務(wù)注冊,并通知客戶端重新連接本地節(jié)點監(jiān)聽程序。

階段4:客戶端接收到服務(wù)器對應(yīng)節(jié)點的監(jiān)聽程序發(fā)送的信息后,重新連接新的位置。

階段5:本地節(jié)點監(jiān)聽程序在接收到連接信息之后,完成對數(shù)據(jù)庫的連接。

查詢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的狀態(tài)
[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的狀態(tài)
[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的狀態(tài)
[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的狀態(tài)
[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


向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI