本文重點:
- Mbeans層次結構與WLST關係介紹
- WebLogic Mbeans的類型
- weblogic服務器的MBeans生命週期
- Mbeans層次結構與WLST關係介紹:
- WLST online提供對MBeans的簡化訪問,WLST使您能夠以類似於瀏覽文件系統中文件層次結構的方式瀏覽MBeans層次結構。
- MBeans的類型和實例,都看作是目錄,MBean的屬性,都看作文件。
- 當定位到MBean實例之後,使用WLST命令與MBean進行交互。
- 在配置層次結構中,根目錄是Domain Mbean,MBean類型的每個實例都是MBean類型目錄下的子目錄;而MBean屬性是MBean所屬實例的子節點(如文件),每個MBean實例名稱與MBean的名稱屬性的值是一致的。
如圖,MBeans層次結構:
- WebLogic Mbeans的類型
MBeans的類型分爲兩種:配置的MBeans和運行的Mbeans
- 運行MBeans:包含有關服務器及其資源的運行時狀態的信息,它們通常只包含有關資源服務器當前狀態的數據,並且不會保存這些數據。當關閉服務器實例時,運行時的MBean的所有運行時統計信息和指標都將被銷燬。
- 配置MBeans:配置MBeans包含有關服務器和資源配置的信息,它們變更都會存儲在域的XML配置文件中。
- weblogic服務器的MBeans生命週期
- 運行MBean的生命週期:
運行MBean的生命週期開始於一個server的啓動, 跟隨server的停止而終止。例如,當您啓動一個server時,server實例化一個運行MBean,並且用當前運行時的數據填充MBean的層次, 每個資源在其運行時更新MBean中的數據,作爲其狀態更改。 該server停止時將銷燬其運行時MBean。
- 配置MBean的生命週期
1、配置MBean的生命週期也開始於一個server的啓動,然後將domain配置信息加載至內存中,然後實例化MBean,它的根節點也就是Domain Mbean,來展示其內存版本。如圖: 配置文件與運行MBean層次結構一一對應。
2、當要更改域配置文件的時候,JMX客戶端對這些MBean配置只有只讀訪問權限(包括web控制檯也只是JMX客戶端的一種),而對於管理服務器來講,它維護着一份單獨的、可編輯的域配置文件副本,存放在域的pending目錄下,利用它來實例化一系列化的MBean提供給JMX的客戶端用來更改。在JMX客戶端更改這些配置MBean之後,客戶端請示管理服務器將修改持久化保存在配置文件中,那麼管理服務器將啓動一個事務進程,更新域中所有服務器實例的只讀配置文檔和配置MBean,並通知其他客戶端來更新這些配置Mbean。
3、配置MBeans會隨着Server實例的關閉而銷燬。但是其提交的更改在第二步驟就已經持久化保存在配置文件中了。
- WebLogic Server Mbean 數據模型
weblogic服務器將其MBeans組織成反映XML文檔結構的層次模型。
例如:domain配置文檔的根是<domain>,它的二級節點就是<server>和<cluster>等,每個domain單獨的維護着一個DomainMBean。
- MBean Servers
任何JMX客戶端的核心都是MBean Server,它做爲MBeans的容器。
管理服務器的JVM的虛擬機包含了3個Oracle提供的MBean Server,另外還有一個可選的由JDK本身提供的MBean Server。Managed Server(受管服務器)僅維護一個Oracle提供的MBean Server。
- Domain Runtime MBean Server:Domain運行時MBean,記錄運行時信息。
- Runtime MBean Server:運行時MBean,記錄當前Server運行時的信息。如果在管理服務器上,那麼就和Domain Runtime MBean Server數據相同。受管服務器中僅有Runtime MBean Server。
- Edit MBean Server:配置MBean,用來配置weblogic服務器域的配置。 它暴露了一個ConfigurationManagerMBean用來來鎖定、保存和激活更改配置。 只有管理服務器纔有這個MBean Server。
- The JVM's platform MBean server:JDK提供的包含JVM自身監視信息的MBean。
- MBean命令
命令 | 描述 | WLST |
custom | navigate to the root of custom MBEANS that are registered in the server. 訪問其他BEA MBean和自定義MBean的根 | 在線模式 |
domainConfig | navigate to the last MBean to which you navigated in the domain configuration hierarchy or to the root of the hierarchy. domainMBean. 訪問到域配置層次中您上一次訪問的MBean,或訪問到DomainMBean根 | 在線模式 |
domainQustom | navigate to the root of custom mbeans that are registered in the domain runtime mbean server. 導航到在域運行時mbean服務器中註冊的自定義mbeans的根目錄 | 在線模式 |
domainRuntime | navigate to the last mbean to which you navigated in the domain runtime hierarchy or to the root of the hierarchy, domainRuntimeMBean 導航到您在域運行時層次結構中導航到的最後一個mbean,或導航到層次結構的根domainRuntimeMBean | 在線模式 |
edit | navigate to the last MBean to which you navigated in the edit configuration mbean hierarchy or to the root of the hierarchy, domainMBean. 導航到編輯配置 MBean 層次中您上一次導航到的 MBean,或導航到層次的根 DomainMBean。此可寫層次可存儲表示當前域的所有配置 MBean。 | 在線模式 |
jndi | navigate to the JNDI tree for the server to which WLST is currently connected 導航到 WLST 當前所連接的服務器的 JNDI 樹。 | 在線模式 |
serverConfig | navigate to the last MBean to which you navigated in the configuration mbean hierarchy or to the root of the hierarchy. domainMBean. 導航到配置 MBean 層次中您上一次導航到的 MBean,或導航到層次的根 DomainMBean。 | 在線模式 |
serverRuntime | navigate to the last MBean to which you navigated in the runtime MBean hierarchy or to the root of the hierarchy, serverRuntimeMBean 導航到運行時 MBean 層次中您上一次導航到的 MBean,或導航至此層次的根 ServerRuntimeMBean。 | 在線模式 |
MBean切換關係:
本文官方文檔:https://docs.oracle.com/cd/E13222_01/wls/docs100/config_scripting/nav_edit.html