本文重点:

  1. WLST在线模式配置现有的domains。
  2. WLST离线模式配置现有的domains。

 
 

 
 

1、WLST在线模式配置现有的domains

由于和一个活动的domain进行交互,所有的在线更改必须由weblogic变更管理的进程来做控制。

 
 

例1:wlst脚本创建一个受管服务器

connect("username", "password", "0.0.0.0:port) # 连接一个运行中的实例

edit() # 进入可更改的树

startEdit() # 开启一个start session,获取一个配置锁

svr = cmo.createServer("managedServer") # 创建一个受管服务器

svr.setListenPort(8001) # 设置受管服务器端口

svr.setListenAddress("my-address") # 设置监听地址

save() # 保存更改,类似控制台中点击保存按钮

activate(block="true") # 激活所有更改,类似控制台中应用更改按钮,block参数代表是否等待activate操作完成才进入下一步操作,true代表等待。

 
 

# get the server mbean to target it

tBean = getMBean("Servers/managedServer") # 判断是否创建成功

if tBean != None:

print "Found our target"

 
 

disconnect() # 断开连接

exit() # 退出脚本

 
 

例2:修改至生产模式

wls:/offline> connect('weblogic', '!QAZ2wsx', '127.0.0.1:7001')

Connecting to t3://127.0.0.1:7001 with userid weblogic ...

Successfully connected to Admin Server 'AdminServer' that belongs to domain 'base_domains'.

 
 

Warning: An insecure protocol was used to connect to the

server. To ensure on-the-wire security, the SSL port or

Admin port should be used instead.

 
 

wls:/base_domains/serverConfig> edit()

Location changed to edit tree. This is a writable tree with

DomainMBean as the root. To make changes you will need to start

an edit session via startEdit().

 
 

For more help, use help(edit)

 
 

wls:/base_domains/edit> startEdit()

Starting an edit session ...

Started edit session, please be sure to save and activate your

changes once you are done.

wls:/base_domains/edit !> cmo.setProductionModeEnabled(false)

wls:/base_domains/edit !> activate()

Activating all your changes, this may take a while ...

The edit lock associated with this edit session is released

once the activation is completed.

 
 

The following non-dynamic attribute(s) have been changed on MBeans

that require server re-start:

MBean Changed : com.bea:Name=AdminServer,Type=WebServerLog,Server=AdminServer,WebServer=AdminServer

Attributes changed : RotateLogOnStartup

 
 

MBean Changed : com.bea:Name=Server-0,Type=WebServerLog,Server=Server-0,WebServer=Server-0

Attributes changed : RotateLogOnStartup

 
 

MBean Changed : com.bea:Name=AdminServer,Type=Log,Server=AdminServer

Attributes changed : RotateLogOnStartup

 
 

MBean Changed : com.bea:Name=AdminServer,Type=DataSourceLogFile,DataSource=AdminServer,Server=AdminServer

Attributes changed : RotateLogOnStartup

 
 

MBean Changed : com.bea:Name=base_domains,Type=Log

Attributes changed : RotateLogOnStartup

 
 

MBean Changed : com.bea:Name=base_domains,Type=Domain

Attributes changed : ProductionModeEnabled

 
 

MBean Changed : com.bea:Name=Server-0,Type=Log,Server=Server-0

Attributes changed : RotateLogOnStartup

 
 

MBean Changed : com.bea:Name=Server-0,Type=DataSourceLogFile,DataSource=Server-0,Server=Server-0

Attributes changed : RotateLogOnStartup

 
 

Activation completed

wls:/base_domains/edit> exit()

 
 

 
 

Exiting WebLogic Scripting Tool.

例3:跟踪配置更改

wls:/offline> connect('weblogic', '!QAZ2wsx', '127.0.0.1:7001')

Connecting to t3://127.0.0.1:7001 with userid weblogic ...

Successfully connected to Admin Server 'AdminServer' that belongs to domain 'base_domains'.

 
 

Warning: An insecure protocol was used to connect to the

server. To ensure on-the-wire security, the SSL port or

Admin port should be used instead.

 
 

wls:/base_domains/serverConfig> edit()

Location changed to edit tree. This is a writable tree with

DomainMBean as the root. To make changes you will need to start

an edit session via startEdit().

 
 

For more help, use help(edit)

 
 

wls:/base_domains/edit> startEdit()

Starting an edit session ...

Started edit session, please be sure to save and activate your

changes once you are done.

wls:/base_domains/edit !> cmo.createServer('managed2')

[MBeanServerInvocationHandler]com.bea:Name=managed2,Type=Server

wls:/base_domains/edit !> cd('Servers/managed2')

wls:/base_domains/edit/Servers/managed2 !> cmo.setListenPort(7702)

wls:/base_domains/edit/Servers/managed2 !> showChanges()
# 查看未提交更改

 
 

All changes that are made but not yet activated are:

 
 

MBean Changed : com.bea:Name=base_domains,Type=Domain

Operation Invoked : create

Attribute Modified : Servers

Attributes Old Value : null

Attributes New Value : managed2

Server Restart Required : false

 
 

 
 

MBean Changed : com.bea:Name=managed2,Type=Server

Operation Invoked : modify

Attribute Modified : ListenPort

Attributes Old Value : null

Attributes New Value : 7702

Server Restart Required : false

 
 

wls:/base_domains/edit/Servers/managed2 !> save()

Saving all your changes ...

Saved all your changes successfully.

wls:/base_domains/edit/Servers/managed2 !> activate()

Activating all your changes, this may take a while ...

The edit lock associated with this edit session is released

once the activation is completed.

Activation completed

例4:另两个重要的命令undo和cancelEdit

undo:可以反转没有保存或者没有激活的更改。

cancelEdit:直接退出edit(),会反转没有保存或者没有激活的更改,还会释放编辑锁。

 
 

更多的属性操作和更改:

上一节中描述的标准change-management命令是用于调用configurationManagerMBean中操作的便捷命令。 除了这些操作之外,configurationManagerMBean还包含描述编辑会话的属性和操作。

 
 

有关详细信息,请参阅Oracle WebLogic Server MBean Reference中的"configurationManagerMBean"。

 
 

要访问此MBean,请使用WLST getConfigManager命令。

 
 

示例中的WLST联机脚本以管理员身份将WLST连接到服务器实例,检查进行更改的当前编辑器是否是特定的运算符,然后取消配置编辑。 该脚本还会清除所有已完成的激活任务。

 
 

  1. WLST离线模式配置现有的domains(本文略,详见:03-07_创建域自定义模版)

     
     

最新文章

  1. 最全面的百度地图JavaScript离线版开发
  2. 约瑟夫问题(java实现)
  3. 安装Oracle问题总结
  4. ecshop show_message
  5. OC基础(8)
  6. 导入导出Excel
  7. Dubbo服务重载方法在JDK1.8上调用出错的问题(待解决)
  8. C#基于AE组件二次开发常见问题
  9. Moving Tables
  10. SSL交互和握手过程
  11. PHP计算一个目录文件大小方法
  12. 比赛F-F Perpetuum Mobile
  13. Python3 操作Excel--openpyxl
  14. chapter11_2 Lua链表与队列
  15. UVA11636-Hello World!-水题
  16. Ubuntu版本更替所引发的“血案”
  17. Java编程语言下Selenium 利用Robot自己编写截屏方法
  18. iOS HTML特殊字符转译
  19. SPOJ-CLEANRBT-状压dp
  20. SQL Server ->> 间接实现COUNT(DISTINCT XXX) OVER(PARTITION BY YYY)

热门文章

  1. redis pipeline 独占链接
  2. 【leetcode】20.有效的括号
  3. [Leetcode]827.使用回溯+标记解决最大人工岛问题
  4. 13-02 Java 数组高级算法,Arrays类
  5. dart之旅(二)- 内建类型
  6. Java NIO中的缓冲区Buffer(二)创建/复制缓冲区
  7. 高可用Hadoop平台-Oozie工作流之Hadoop调度
  8. LearnOpenGL学习笔记(三)——VBO,VAO,EBO理解
  9. NIO Channel和Buffer
  10. Java 8 新特性-菜鸟教程 (9) -Java8 Base64