使用WSAdmin和ANT自动部署websphere6.1
来源:互联网 发布:分开旅行 知乎 编辑:程序博客网 时间:2024/05/29 04:36
[was1@dmgr ~]$ sh /wasprofiles/uatdmgr/bin/wsadmin.sh -conntype SOAP -host 10.10.7.9 -port 8881 -user 11111 -password 1111111 -c '$AdminApp install /ceshi1.war { -cluster c01 -contextroot ceshi1 -appname ceshi1 -usedefaultbindings }'
WSAdmin是websphere6.1的管理控制台命令行工具,可以使用它与Websphere application server进行交互,或通过Jacl脚本运行管理命令。工具位于$WAS_HOME/bin目录下。
二、连接部署管理服务器
定位集群的部署管理服务器地址和端口号,我们测试环境的CellManager地址为192.168.20.38,端口为8879。
使用默认的SOAP方式连接。
wsadmin -conntype SOAP -host 192.168.20.38 -port 8879 -user admin -password ******
三、日常维护脚本
1、列出集群节点
$AdminConfig list Node
2、列出集群应用服务器
$AdminConfig list Server
3、列出应用服务
$AdminApp list
4、启动单个服务器
$AdminControl invoke [$AdminControl queryNames type=NodeAgent,node=test-95Node01,*] launchProcess server35
5、停止单个服务器
$AdminControl invoke [$AdminControl queryNames type=Server,node=test-95Node01,name=server35,*] stop
6、安装服务到集群
$AdminApp install e:/hello.war {-cluster b2bpool -contextroot hello -appname hello -usedefaultbindings}
$AdminControl save
7、开启服务
$AdminControl invoke [$AdminControl queryNames type=ApplicationManager,node=test-38Node01,*] startApplication hello
$AdminControl invoke [$AdminControl queryNames type=ApplicationManager,node=test-95Node01,*] startApplication hello
8、停止服务
$AdminControl invoke [$AdminControl queryNames type=ApplicationManager,process=server1,*] stopApplication hello
$AdminControl invoke [$AdminControl queryNames type=ApplicationManager,process=server35,*] stopApplication hello
9、更新服务(war包)到集群
$AdminApp update hello app {-operation update -cluster b2bpool -contextroot hello -contents e:/hello.war}
$AdminControl save
10、更新服务(单个文件)到集群
$AdminApp update hello file {-operation update -cluster b2bpool -contextroot hello -contents e:/hello.jar -contenturi hello.war/WEB-INF/lib/hello.jar}
$AdminControl save
11、更新服务到节点
$AdminApp update hello app {-operation update -node test-95Node01 -contextroot hello -contents e:/hello.war}
$AdminControl save
四、使用ant自动部署websphere
1、websphere6.1的ws_ant工具在$WAS_HOME/bin下。
使用的是$WAS_HOME/plugins/com.ibm.ws.runtime_6.1.0.jar中的任务,也可以自定义任务,更新任务com.ibm.websphere.ant.tasks.UpdateApplication就是自定义的。
2、编写builder.xml部署文件
<project name="wasant" basedir="." default="updateAndStart">
<property name="was.root" value="E:/IBM/WebSphere/AppServer" />
<property name="wsanttasks.jar" value="${was.root}/plugins/com.ibm.ws.runtime_6.1.0.jar"/>
<property name="app.name" value="hello"/>
<property name="ear.file" value="E:/hello.war"/>
<property name="contextroot" value="hello"/>
<property name="cluster" value="b2bpool"/>
<!--登录信息 192.168.20.38 8879-->
<property name="username" value="admin"/>
<property name="password" value="******"/>
<property name="host" value="192.168.20.38"/>
<property name="port" value="8879"/>
<property name="conntype" value="SOAP"/>
<!-- 使用到的任务 -->
<taskdef name="wsStartServer" classname="com.ibm.websphere.ant.tasks.StartServer" classpath="${wsanttasks.jar}" />
<taskdef name="wsStopServer" classname="com.ibm.websphere.ant.tasks.StopServer" classpath="${wsanttasks.jar}" />
<taskdef name="wsInstallApp" classname="com.ibm.websphere.ant.tasks.InstallApplication" classpath="${wsanttasks.jar}" />
<taskdef name="wsUpdateApp" classname="com.ibm.websphere.ant.tasks.UpdateApplication" classpath="${wsanttasks.jar}" />
<taskdef name="wsUninstallApp" classname="com.ibm.websphere.ant.tasks.UninstallApplication" classpath="${wsanttasks.jar}" />
<taskdef name="wsStartApp" classname="com.ibm.websphere.ant.tasks.StartApplication" classpath="${wsanttasks.jar}" />
<taskdef name="wsStopApp" classname="com.ibm.websphere.ant.tasks.StopApplication" classpath="${wsanttasks.jar}" />
<taskdef name="wsListApps" classname="com.ibm.websphere.ant.tasks.ListApplications" classpath="${wsanttasks.jar}" />
<taskdef name="wsAdmin" classname="com.ibm.websphere.ant.tasks.WsAdmin" classpath="${wsanttasks.jar}" />
<!-- 更新应用-->
<target name="wsUpdateApp" description="Update Application ${app.name}">
<wsUpdateApp user="${username}" password="${password}" host="${host}"
ear="${ear.file}" appname="${app.name}" port="${port}" conntype="${conntype}" washome="${was.root}"
options="-operation update -cluster ${cluster} -contextroot ${contextroot} -contents ${ear.file}">
</wsUpdateApp>
</target>
<!-- 实际的任务组合 -->
<target name="updateAndStart" description="Update and Save ${app.name}">
<antcall target="wsUpdateApp"/>
</target>
</project>
3、编写shell定时运行ant实现部署
- 使用WSAdmin和ANT自动部署websphere6.1
- 使用WSAdmin和ANT自动部署websphere6.1
- 使用WSAdmin和ANT自动部署websphere6.1
- 使用Ant自动完成部署(1)
- WebSphere6.1 安装 部署
- ant或者说wsadmin远程部署websphere异常
- 用Ant实现Java项目的自动构建和部署/Eclipse下使用Ant
- 基于ssh和wsadmin的远程websphere部署
- websphere6.1部署的程序启动顺序
- Ant+Tomcat自动部署
- IBM websphere6.1 不支持泛型、int-Integer类型的自动装箱和拆箱问题
- 4.8.3 使用Ant自动完成部署(2)
- 使用ANT+SVN在Linux上实现自动部署项目
- eclipse使用Ant组件自动部署项目到tomcat6.0
- 用Ant实现Java项目的自动构建和部署
- 用Ant实现Java项目的自动构建和部署
- 用Ant实现Java项目的自动构建和部署
- 用Ant实现Java项目的自动构建和部署
- hznu 1441 Greatest Number(选出4个数,使值最接近m)
- openfire启动问题
- android(6) 扇形菜单实现
- awk命令详解
- 第六届ACM省赛总结--乔璐
- 使用WSAdmin和ANT自动部署websphere6.1
- hibernate防止sql注入对参数赋值传参数实例
- memcached完全剖析
- C++ Primer Plus (第6版)编程练习 代码-----第九章
- ROM与RAM性能的常用测试方法
- kendo Grid控件不分页查询大量数据卡死(虚拟分页解决)
- 黑马程序员-----曾经遇到的几题面试题详解
- GsonUtil
- Spring的注解