Há mais de 125 arquivos de scripts de shell incluídos no IBM WebSphere Application Server (WAS) ao instalá-lo.
Nem todos eles são úteis e, se você é um aprendiz, pode não estar ciente de alguns dos scripts poderosos para usar no trabalho diário.
Listei alguns dos scripts mais úteis para facilitar sua vida como Administrador do WebSphere.
Os scripts a seguir são testados no ambiente IBM WAS ND 8.5.5 e não vejo nenhum motivo para não funcionar em nenhum outro ambiente.
Parando e iniciando o Deployment Manager, Node Agent e JVM
stopManager.sh
Você pode parar o Deployment Manager usando o comando acima.
[[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]#
Nota: isso deve ser executado no caminho do perfil DMGR.
startManager.sh
Você pode iniciar o Deployment Manager usando o comando acima.
[[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]#
Nota: isso deve ser executado no caminho do perfil DMGR.
startServer.sh
Para iniciar a JVM, você pode usar startServer.sh com o nome do servidor como abaixo.
[[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]#
Nota: O Node Agent deve ser iniciado antes de iniciar a JVM.
stopServer.sh
Você pode encerrar a JVM executando o comando acima junto com o nome da 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]#
stopNode.sh
Para parar o respectivo Node Agent, você deve acessar esse perfil e executar stopNode.sh para parar o Node Agent.
[[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]#
startNode.sh
Vá para o respectivo perfil e execute startNode.sh para iniciar o Node Agent.
[[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]#
serverStatus.sh
Para descobrir o status da JVM, você pode usar este script com o argumento –all.
Isso deve ser executado no respectivo nível de perfil. Se você executar isso no nível do perfil DMGR, ele mostrará apenas o status do 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]#
Restauração de backup
backupConfig.sh
Uma das primeiras coisas a aprender enquanto trabalha no suporte à produção é como fazer um backup. Quando nada funciona – o backup ajuda.
Você pode usar este script para fazer um backup da configuração do ambiente WebSphere. Como prática recomendada, você pode usar o argumento “–nostop”, para que seja feito um backup sem interromper o 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]#
restoreConfig.sh
Se você alterou a configuração e as coisas não estão conforme o esperado e há um tempo para restaurar sua configuração. Bem, você pode usar o arquivo de backup para restaurar a configuração.
[[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]#
Você gosta disso tão longe? Role para baixo para mais diversão!
Obtendo informações de versão e fix pack
versionInfo.sh
Para descobrir a versão do WAS, nível de compilação, pacote, arquitetura e recursos instalados instalados em seu servidor.
[[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]#
Nota: você pode estar interessado em seguir os argumentos suportados.
- -fixpacks: Para exibir informações sobre fix packs
- -long: Para exibir todos os fix packs e ifixes
- -ifixes: Para exibir informações de ifixes
getHistoryReport.sh
Se você estiver realizando auditoria ou apenas quiser listar componentes, correções, atualizar o pacote com datas, você pode executar este comando, que gerará historyReport.html no diretório de trabalho atual, que geralmente é a pasta bin.
getVersionReport.sh
Para exibir a versão de construção e a data de construção da instalação do WebSphere. Frequentemente solicitado pelo pessoal de suporte da IBM para investigar se há algum problema suspeito com uma versão específica.
Limpando o Cache
Pode haver vários motivos para limpar o cache, o mais óbvio seria após uma atualização. Há dois caches que você deve considerar limpar 1) JVM 2) OSGi.
clearClassCache.sh
Para limpar o cache de classe da JVM, você pode executar o script acima.
Nota: As JVMs devem ser interrompidas antes de limpar os caches de classe.
osgiCfgInit.sh
Execute o comando acima para limpar o perfil OSGi e o cache do servidor.
[[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]#
Nota: não se esqueça de parar os processos em execução antes de limpar os caches.
Gerenciando Perfis
gerenciadk.sh
Você pode alternar a versão se tiver instalado vários SDKs. Você também pode usar este script para descobrir o SDK associado disponível ao seu perfil. O exemplo abaixo mostra uma lista de SDKs disponíveis.
[[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 (Profile Management Tool) pode ser usado para criar perfis do WebSphere no modo GUI. Criar perfis usando o PMT é muito fácil – tudo o que você precisa fazer é criar o nível de perfil desejado e seguir o assistente. Você tem que experimentar!
syncNode.sh
Por algum motivo, se você não puder executar o Node Sync por meio do Console de administração, poderá usar syncNode.sh no nível do perfil. O agente do nó deve ser interrompido antes de usar este script.
Você precisa passar um argumento para o host DMGR e o número da porta 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 = nome do host do Deployment Manager
- 8879 = Número da porta SOAP DMGR
Espero que os scripts acima sejam úteis para o seu trabalho diário. Leve sua carreira para um nível superior aprendendo computação em nuvem.