安装时,IBM WebSphere Application Server (WAS) 中包含超过 125 个 shell 脚本文件。
并非所有这些都是有用的,如果您是学习者,您可能不知道在日常工作中使用的一些强大的脚本。
我列出了一些最有用的脚本,以减轻您作为 WebSphere 管理员的生活。
以下脚本在 IBM WAS ND 8.5.5 环境中进行了测试,看不出有任何理由在任何其他环境中都不起作用。
目录
停止和启动部署管理器、节点代理和 JVM
停止管理器.sh
您可以使用上述命令停止部署管理器。
[[email protected] bin]# ./stopManager.sh ADMU0116I: Tool information is being logged in file /opt/IBM/WebSphere/AppServer/profiles/Dmgr01/logs/dmgr/stopServer.log ADMU0128I: Starting tool with the Dmgr01 profile ADMU3100I: Reading configuration for server: dmgr ADMU3201I: Server stop request issued. Waiting for stop status. ADMU4000I: Server dmgr stop completed. [[email protected] bin]#
注意:这必须在 DMGR 配置文件路径中执行。
启动管理器.sh
您可以使用上述命令启动部署管理器。
[[email protected] bin]# ./startManager.sh ADMU0116I: Tool information is being logged in file /opt/IBM/WebSphere/AppServer/profiles/Dmgr01/logs/dmgr/startServer.log ADMU0128I: Starting tool with the Dmgr01 profile ADMU3100I: Reading configuration for server: dmgr ADMU3200I: Server launched. Waiting for initialization status. ADMU3000I: Server dmgr open for e-business; process id is 9183 [[email protected] bin]#
注意:这必须在 DMGR 配置文件路径中执行。
启动服务器.sh
要启动 JVM,您可以使用带有服务器名称的 startServer.sh,如下所示。
[[email protected] bin]# ./startServer.sh server1 ADMU0116I: Tool information is being logged in file /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/server1/startServer.log ADMU0128I: Starting tool with the AppSrv01 profile ADMU3100I: Reading configuration for server: server1 ADMU3200I: Server launched. Waiting for initialization status. ADMU3000I: Server server1 open for e-business; process id is 10633 [[email protected] bin]#
注意:必须在启动 JVM 之前启动 Node Agent。
停止服务器.sh
您可以通过执行上述命令以及 JVM 名称来关闭 JVM。
[[email protected] bin]# ./stopServer.sh server1 ADMU0116I: Tool information is being logged in file /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/server1/stopServer.log ADMU0128I: Starting tool with the AppSrv01 profile ADMU3100I: Reading configuration for server: server1 ADMU3201I: Server stop request issued. Waiting for stop status. ADMU4000I: Server server1 stop completed. [[email protected] bin]#
停止节点.sh
要停止相应的节点代理,您必须转到该配置文件并执行 stopNode.sh 以停止节点代理。
[[email protected] bin]# ./stopNode.sh ADMU0116I: Tool information is being logged in file /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/nodeagent/stopServer.log ADMU0128I: Starting tool with the AppSrv01 profile ADMU3100I: Reading configuration for server: nodeagent ADMU3201I: Server stop request issued. Waiting for stop status. ADMU4000I: Server nodeagent stop completed. [[email protected] bin]#
启动节点.sh
转到相应的配置文件并执行 startNode.sh 以启动节点代理。
[[email protected] bin]# ./startNode.sh ADMU0116I: Tool information is being logged in file /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/nodeagent/startServer.log ADMU0128I: Starting tool with the AppSrv01 profile ADMU3100I: Reading configuration for server: nodeagent ADMU3200I: Server launched. Waiting for initialization status. ADMU3000I: Server nodeagent open for e-business; process id is 11363 [[email protected] bin]#
服务器状态.sh
要查明 JVM 的状态,您可以将此脚本与 –all 参数一起使用。
这必须在相应的配置文件级别执行。 如果您在 DMGR 配置文件级别执行此操作,它将仅显示 DMGR 的状态。
[[email protected] bin]# ./serverStatus.sh -all ADMU0116I: Tool information is being logged in file /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/serverStatus.log ADMU0128I: Starting tool with the AppSrv01 profile ADMU0503I: Retrieving server status for all servers ADMU0505I: Servers found in configuration: ADMU0506I: Server name: nodeagent ADMU0506I: Server name: server1 ADMU0508I: The Node Agent "nodeagent" is STARTED ADMU0508I: The Application Server "server1" is STARTED [[email protected] bin]#
备份和恢复
备份配置文件
在生产支持中工作时要学习的第一件事就是如何进行备份。 当没有任何效果时 – 备份会有所帮助。
您可以使用此脚本来备份您的 WebSphere 环境配置。 作为最佳实践,您可以使用“–nostop”参数,以便在不停止 Deployment Manager 的情况下进行备份。
[[email protected] bin]# ./backupConfig.sh -nostop ADMU0116I: Tool information is being logged in file /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/backupConfig.log ADMU0128I: Starting tool with the AppSrv01 profile ADMU5001I: Backing up config directory /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/config to file /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/WebSphereConfig_2015-04-12.zip .................................................................................................................................................................................................................................................................... ADMU5002I: 933 files successfully backed up [[email protected] bin]#
恢复配置文件
如果您更改了配置并且事情与预期不符,则需要时间来恢复您的配置。 好了,您可以使用备份文件来恢复配置。
[[email protected] bin]# ./restoreConfig.sh WebSphereConfig_2015-04-12.zip -nostop ADMU0116I: Tool information is being logged in file /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/restoreConfig.log ADMU0128I: Starting tool with the AppSrv01 profile ADMU5502I: The directory /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/config already exists; renaming to /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/config.old ADMU5504I: Restore location successfully renamed ADMU5505I: Restoring file WebSphereConfig_2015-04-12.zip to location /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/config ......................................................................................................................................................................... ADMU5506I: 933 files successfully restored ADMU6001I: Begin App Preparation - ADMU6009I: Processing complete. ADMU6002I: Begin Asset Preparation - ADMU6009I: Processing complete. [[email protected] bin]#
到目前为止你还喜欢吗? 向下滚动以获得更多乐趣!
获取版本和修复包信息
版本信息.sh
找出您的服务器上安装的 WAS 版本、构建级别、包、架构和已安装的功能。
[[email protected] bin]# ./versionInfo.sh WVER0010I: Copyright (c) IBM Corporation 2002, 2012; All rights reserved. WVER0012I: VersionInfo reporter version 1.15.1.48, dated 2/8/12 -------------------------------------------------------------------------------- IBM WebSphere Product Installation Status Report -------------------------------------------------------------------------------- Report at date and time April 12, 2015 3:18:41 AM PDT Installation -------------------------------------------------------------------------------- Product Directory /opt/IBM/WebSphere/AppServer Version Directory /opt/IBM/WebSphere/AppServer/properties/version DTD Directory /opt/IBM/WebSphere/AppServer/properties/version/dtd Log Directory /var/ibm/InstallationManager/logs Product List -------------------------------------------------------------------------------- NDTRIAL installed Installed Product -------------------------------------------------------------------------------- Name IBM WebSphere Application Server Network Deployment Version 8.5.5.0 ID NDTRIAL Build Level gm1319.01 Build Date 5/14/13 Package com.ibm.websphere.NDTRIAL.v85_8.5.5000.20130514_1044 Architecture x86-64 (64 bit) Installed Features IBM 64-bit WebSphere SDK for Java WebSphere Application Server Full Profile EJBDeploy tool for pre-EJB 3.0 modules Embeddable EJB container Stand-alone thin clients and resource adapters -------------------------------------------------------------------------------- End Installation Status Report -------------------------------------------------------------------------------- [[email protected] bin]#
注意:您可能对以下受支持的参数感兴趣。
- -fixpacks:显示修订包信息
- -long:显示所有修订包和 ifix
- -ifixes:显示 ifixes 信息
获取历史报告.sh
如果您正在执行审计或只是想列出组件、修复、刷新包的日期,您可以运行此命令,该命令将在当前工作目录(通常是 bin 文件夹)中生成 historyReport.html。
获取版本报告.sh
显示 WebSphere 安装的构建版本和构建日期。 IBM 支持人员经常要求调查特定版本是否存在任何可疑问题。
清除缓存
清除缓存可能有多种原因,最明显的原因是升级后。 您应该考虑清除两个缓存 1) JVM 2) OSGi。
clearClassCache.sh
要清除 JVM 的类缓存,您可以执行上述脚本。
注意:在清除类缓存之前必须停止 JVM。
osgiCfgInit.sh
执行上述命令以清除 OSGi 配置文件和服务器缓存。
[[email protected] bin]# ./osgiCfgInit.sh OSGi profile cache successfully cleaned for /opt/IBM/WebSphere/AppServer/profiles/Dmgr01. OSGi server cache successfully cleaned for /opt/IBM/WebSphere/AppServer/profiles/Dmgr01/servers/dmgr. [[email protected] bin]#
注意:不要忘记在清除缓存之前停止正在运行的进程。
管理配置文件
管理dk.sh
如果您安装了多个 SDK,您可以切换版本。 您还可以使用此脚本查找与您的配置文件相关联的可用 SDK。 下面的示例显示了可用 SDK 的列表。
[[email protected] bin]# ./managesdk.sh -listAvailable CWSDK1003I: Available SDKs : CWSDK1005I: SDK name: 1.6_64 CWSDK1001I: Successfully performed the requested managesdk task. [[email protected] bin]#
pmt.sh
PMT(配置文件管理工具)可用于在 GUI 模式下创建 WebSphere 配置文件。 使用 PMT 创建配置文件非常简单——您所要做的就是创建所需级别的配置文件并按照向导进行操作。 你得试试看!
同步节点.sh
出于某种原因,如果您无法通过管理控制台执行节点同步,您可以从配置文件级别使用 syncNode.sh。 使用此脚本前必须停止节点代理。
您必须为 DMGR 主机和 SOAP 端口号传递参数。
[[email protected] bin]# ./syncNode.sh localhost 8879 ADMU0116I: Tool information is being logged in file /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/syncNode.log ADMU0128I: Starting tool with the AppSrv01 profile ADMU0401I: Begin syncNode operation for node localhostNode01 with Deployment Manager localhost: 8879 ADMU0016I: Synchronizing configuration between node and cell. ADMU0402I: The configuration for node localhostNode01 has been synchronized with Deployment Manager localhost: 8879 [[email protected] bin]#
- localhost = 部署管理器主机名
- 8879 = DMGR SOAP 端口号
我希望以上脚本对您的日常工作有用。 学习云计算,让您的职业生涯更上一层楼。