简体   繁体   English

运行记录的WLST Python文件以设置WebLogic域配置

[英]Running a recorded WLST Python file to setup WebLogic domain configuration

In our project, we have numerous steps to create different configurations on WebLogic server. 在我们的项目中,我们有许多步骤可在WebLogic服务器上创建不同的配置。 I have created a local domain and I have recorded my steps in a Python file (by pressing 'Record' button on top, followed by manual steps to configure) 我已经创建了本地域,并已将步骤记录在Python文件中(按顶部的“记录”按钮,然后进行手动配置)

The configuration includes creation of Generic Data Source/s, security realms, changes to AdminServer and so on. 该配置包括创建通用数据源,安全领域,对AdminServer的更改等。

The purpose of recording the steps is obvious, to ease and speed up the process for others. 记录步骤的目的是显而易见的,以简化和加快其他人的过程。 I would like to know the steps on how I should run the recorded script? 我想知道如何运行录制的脚本的步骤? Shall I simply create a new domain, login to it and simply run the script? 我是否只需创建一个新域,然后登录并运行脚本即可? Or something else is also required? 还是还需要其他东西?

Here's a snippet from .py file: 这是.py文件的片段:

startEdit()
cd('/')
cmo.createJDBCSystemResource('test')
cd('/JDBCSystemResources/test/JDBCResource/test')
cmo.setName('test')
cd('/JDBCSystemResources/test/JDBCResource/test/JDBCDataSourceParams/test')
set('JNDINames',jarray.array([String('test')], String))
cd('/JDBCSystemResources/test/JDBCResource/test/JDBCDriverParams/test')
cmo.setUrl('jdbc:db2://server:port/DBNAME')
cmo.setDriverName('com.ibm.db2.jcc.DB2Driver')
.
.

I have referred to some questions: How to run wlst script by .py file , Record WLST Scripts for Adapter Settings for creating Outbound Connection Pools but those didn't help. 我提到了一些问题: 如何通过.py文件运行wlst脚本, 为创建出站连接池的适配器设置记录WLST脚本,但是这些操作无济于事。

The simple answer to your question is yes, just create a new domain, start it and then run the script. 您问题的简单答案是,只需创建一个新域,启动它,然后运行脚本即可。 Remember that your script needs to connect to your server before making any changes. 请记住,您的脚本需要在进行任何更改之前连接到服务器。 To do that just add connect command at the beginning of your script. 为此,只需在脚本开头添加connect命令。

[connect('adminuser','adminpass','t3://localhost:8001')][1] 

to launch your script simply go to the folder containing wlst.cmd (Windows) or wlst.sh (Linux) and run 要启动脚本,只需转到包含wlst.cmd(Windows)或wlst.sh(Linux)的文件夹并运行

wlst.sh your_script.py

Keep in mind that if you are targeting resources to clusters or particular server instances you have to make sure that cluster/server names on the new domain match those on the instance you've recorded your script. 请记住,如果要将资源定向到群集或特定服务器实例,则必须确保新域上的群集/服务器名称与您记录脚本的实例上的群集/服务器名称匹配。

Offline domain editing is also possible and there are plenty articles and blog posts on about it. 离线域编辑也是可能的,并且有很多关于它的文章和博客文章。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM