weblogic命令行操作

启动和停止子节点:

[root@oud bin]# cd /sotware/oracle_ldap/Middleware/user_projects/domains/base_domain/bin/
[root@oud bin]# ./startManagedWebLogic.sh Server-0 http://192.168.63.129:7001 -Dweblogic.management.username=weblogic -Dweblogic.management.password=weblogic123 -Dweblogic.system.StoreBootIdentity=true
.
.
JAVA Memory arguments: -Xms256m -Xmx512m  -XX:MaxPermSize=512m
.
WLS Start Mode=Production
.
CLASSPATH=/sotware/oracle_ldap/Middleware/oracle_common/modules/oracle.jdbc_11.1.1/ojdbc6dms.jar:/sotware/oracle_ldap/Middleware/patch_wls1036/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/sotware/oracle_ldap/Middleware/patch_ocp371/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/usr/java/jdk1.7.0_76/lib/tools.jar:/sotware/oracle_ldap/Middleware/wlserver_10.3/server/lib/weblogic_sp.jar:/sotware/oracle_ldap/Middleware/wlserver_10.3/server/lib/weblogic.jar:/sotware/oracle_ldap/Middleware/modules/features/weblogic.server.modules_10.3.6.0.jar:/sotware/oracle_ldap/Middleware/wlserver_10.3/server/lib/webservices.jar:/sotware/oracle_ldap/Middleware/modules/org.apache.ant_1.7.1/lib/ant-all.jar:/sotware/oracle_ldap/Middleware/modules/net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contrib.jar:/sotware/oracle_ldap/Middleware/oracle_common/modules/oracle.jrf_11.1.1/jrf.jar:/sotware/oracle_ldap/Middleware/wlserver_10.3/common/derby/lib/derbyclient.jar:/sotware/oracle_ldap/Middleware/wlserver_10.3/server/lib/xqrl.jar:.:/usr/java/jdk1.7.0_76/lib/dt.jar:/usr/java/jdk1.7.0_76/lib/tools.jar
.
PATH=/sotware/oracle_ldap/Middleware/wlserver_10.3/server/bin:/sotware/oracle_ldap/Middleware/modules/org.apache.ant_1.7.1/bin:/usr/java/jdk1.7.0_76/jre/bin:/usr/java/jdk1.7.0_76/bin:/usr/lib64/qt-3.3/bin:/root/perl5/bin:/usr/local/sbin:/usr/java/jdk1.7.0_76/bin:/usr/bin:/bin:/usr/sbin:/sbin:


[root@oud bin]# ./stopManagedWebLogic.sh Server-0  t3://192.168.63.129:7001
Stopping Weblogic Server...

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

Connecting to t3://192.168.63.129:7001 with userid weblogic ...
Successfully connected to Admin Server 'AdminServer' that belongs to domain 'base_domain'.

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.

Shutting down the server Server-0 with force=false while connected to AdminServer ...


Exiting WebLogic Scripting Tool.

Done
Stopping Derby Server...

第一次时会在节点下的security里会生成个boot.properties文件,会保存账户密码,可以通过下面命令找到这个文件

- Dweblogic.system.BootIdentityFile=/weblogic/user_projects/domains/test_domain/servers/AdminServer/security/boot.properties  

weblogic.Deployer命令
基于weblogic.Deployer可以进行应用部署相关操作。

java [ SSL参数 ] weblogic.Deployer [ 连接参数 ] 
     [ 用户凭据参数 ] COMMAND-NAME  命令选项  
     [ Common Arguments ]

SSL参数
java [-Dweblogic.security.TrustKeyStore = DemoTrust] 
     [-Dweblogic.security.JavaStandardTrustKeyStorePassPhrase = password] 
     [-Dweblogic.security.CustomTrustKeyStoreFileName = filename 
       -Dweblogic.security.TrustKeystoreType = jks 
       [-Dweblogic.security.CustomTrustKeyStorePassPhrase = password] 
     ] 
     [ -Dweblogic.security.SSL.hostnameVerifier = classname] 
     [-Dweblogic.security.SSL.ignoreHostnameVerification = true] 
weblogic.Deployer 
     [ 用户凭据参数 ] 
      COMMAND-NAME  命令参数 
 

-Dweblogic.security.TrustKeyStore = DemoTrust

导致weblogic.Deployer证明信任密钥库(WL_HOME\server\lib\DemoTrust.jks)中的CA证书信任。

如果要连接的服务器实例正在使用演示身份和证书,则此参数是必需的。

默认情况下,weblogic.Deployer仅信任Java标准信任密钥库(SDK_HOME\jre\lib\security\cacerts)中的CA证书。
 

-Dweblogic.security.JavaStandardTrustKeyStorePassPhrase = 密码

用于保护Java Standard Trust密钥库的密码。

如果Java Standard Trust密钥库受密码保护,并且如果要信任其CA证书,则必须使用此参数。

默认情况下,Java Standard Trust密钥库不受密码保护。

-Dweblogic.security.CustomTrustKeyStoreFileName = filename  
-Dweblogic.security.TrustKeystoreType = jks
导致weblogic.Deployer在位于文件名的自定义密钥库中信任CA证书。您必须使用这两个参数来信任自定义密钥库。该文件名完全匹配,必须ServerMBean.CustomTrustKeyStoreFileName在坚持价值config.xml; 如果属性中指定的值CustomTrustKeyStoreFileName是相对路径名,则还必须在此参数中指定相同的相对路径名
-Dweblogic.security.CustomTrustKeyStorePassPhrase = 密码

用于保护自定义密钥库的密码。

只有在自定义密钥库受密码保护的情况下,才必须使用此参数

-Dweblogic.security.SSL.hostnameVerifier = classname
自定义主机名验证者类的名称。该类必须实现该weblogic.security.SSL.HostnameVerifier接口。
-Dweblogic.security.SSL.ignoreHostnameVerification =真
禁用主机名验证。

连接参数

java [ SSL参数 ] weblogic.Deployer 
     [-adminurl protocol:// listen_address:port_number ] 
     [ 用户凭据参数 ] COMMAND-NAME  命令选项 [ Common Arguments ]
大多数weblogic.Deployer命令要求您指定-adminurl中所描述的参数连接到管理服务器实例

-adminurl [ protocol://] Admin-Server-listen-address:listen-port 

监听管理服务器的地址和监听端口。

要使用不受SSL保护的端口,格式为-adminurl [protocol]Admin-Server-listen-address:port其中t3,http,iiop,和iiops有效的协议。

为了使用具有HTTP协议的管理员,必须在WebLogic Server管理控制台中启用HTTP隧道选项。有关详细信息,请参阅在Oracle WebLogic Server的管理服务器环境中设置WebLogic Server进行HTTP隧道。有关启用在WebLogic Server管理控制台HTTP隧道的说明,请参阅配置HTTP协议中的Oracle WebLogic Server管理控制台联机帮助。

要使用由SSL保护的端口,格式是-adminurl secure-protocol://Admin-Server-listen-address:port哪里t3s并且https是有效的安全协议。

要通过配置的管理通道连接到管理服务器,您必须指定有效的管理端口号: -adminurl secure-protocol://Admin-Server-listen-address:domain-wide-admin-port

此参数没有默认值。

用户证书参数
java [ SSL参数 ] weblogic.Deployer [ 连接参数 ] 
     [{-username username [-password password ]} | 
     [-userconfigfile config-file [-userkeyfile admin-key ]]]
      COMMAND-NAME  command-options [ Common Arguments ]
大多数weblogic.Deployer命令要求您提供WebLogic Server管理员的用户凭据。

-username 用户名 
管理员用户名。如果您提供该-username选项但不提供相应的-password选项,则weblogic.Deployer提示您输入密码。
-password 密码 

管理员用户的密码。

为了避免在脚本或进程实用程序中显示纯文本密码,例如ps首先使用WebLogic Sc​​ripting Tool(WLST)storeUserConfig命令在配置文件中存储用户名和加密密码,如WLST“WebLogic Server命令参考”中所述。省略-username和-password选项以weblogic.Deployer使用存储在默认配置文件中的值。

如果要使用特定的配置文件和密钥文件,而不是默认文件,请使用-userconfigfile和-userkeyfile选项weblogic.Deployer。

-userconfigfile 配置文件 
用于管理用户名和密码的用户配置文件的位置。使用此选项,而不是-user和-password选项,在自动化脚本或者在你不希望有密码屏幕上或进程级实用工具,如所示的情况ps。在指定-userconfigfile属性之前,必须首先使用WebLogic脚本工具(WLST)storeUserConfig命令生成文件,如WLST“WebLogic Server命令参考”中所述。
-userkeyfile admin-key 
指定用户密钥文件用于加密和解密用户配置文件(-userconfigfile选项)中存储的用户名和密码信息的位置。在指定-userkeyfile属性之前,必须首先使用WebLogic脚本工具(WLST)storeUserConfig命令生成文件,如WLST“WebLogic Server命令参考”中所述。


 

帮助及示例命令
#查看weblogic.Deployer帮助
java -cp ${wls_jar_dir}/weblogic.jar weblogic.Deployer -help

#查看weblogic.Deployer更多参数

[root@oud bin]# java -cp /sotware/oracle_ldap/Middleware/wlserver_10.3/server/lib/weblogic.jar weblogic.Deployer -advanced
Usage: java weblogic.Deployer [options] [action] [Deployment units(s)]

where options include:
    -help             Print the standard usage message.            
    -version          Print version information.                   
    -adminurl <<protocol>://<server>:<port>> [option] Administration     
                      server URL: default t3://localhost:7001      
    -username <username> [option] user name                           
    -password <password> [option] password for the user               
    -userconfigfile <userconfigfile> [option] The user config file       
                      contains the user security credentials; it   
                      is administered by the weblogic.Admin tool   
    -userkeyfile <keyConfigFile> [option] The users key file; it is      
                      administered by the weblogic.Admin tool.     
    -distribute       [action] Distribute application to the       
                      targets.                                     
    -start            [action] Makes an already distributed        
                      application available on a target.           
    -stop             [action] Makes an application unavailable on 
                      targets.                                     
    -redeploy         [action] Replace a running application       
                      partially or entirely.                       
    -undeploy         [action] Take an application out of service. 
    -deploy           [action] Make an application available for   
                      service.                                     
    -update           [action] Update an application configuration 
                      in place.                                    
    -cancel           [action] Attempts to cancel the task <id> if 
                      it is has not yet completed.                 
    -list             [action] Lists the target status of each     
                      task <id>.                                   
    -listtask         [action] Lists the target status of each     
                      task <id>.                                   
    -listapps         [action] Lists all the deployed applications 
                      in the domain.                               
    -purgetasks       Flush out deployment tasks that are retired  
                      java weblogic.Deployer -adminurl url         
                      -username username -password password        
                      -purgetasks                                  
    -examples         [option] Displays example usage of this tool.
    -name <application name> [option] Defaults to the basename of the    
                      deployment file or directory.                
    -targets <<target(s)>> [option] A comma separated list of targets   
                      for the current operation. If not specified, 
                      all configured targets are used. For a new   
                      application, the default target is the       
                      administration server.                       
    -plan <Deployment plan path> [option] Specifies location of          
                      deployment plan                              
    -library          [option] Indicates that the unit being       
                      deployed is a library. This option is        
                      required when the application is a library.  
    -verbose          Displays additional status during the        
                      deployment process, 
including notifications 
                      when the application is prepared and 
       
                      activated on each target.                    
    -output <raw>     [deprecated option] raw|formatted            
    -debug            [option] Displays debug level messages to    
                      the standard output.                         
    -upload           [option] Causes the specified source file(s) 
                      to be transferred to the administration      
                      server. This is used when the Deployer tools 
                      is not being used on the same machine as the 
                      administration server or the user does not   
                      otherwise have access to place the targeted  
                      files on the administration server.          
    -delete_files     [option] Causes the server to remove the     
                      files that are specified in the file list    
                      and leave the application activated. This    
                      option is valid only for unarchived Web      
                      applications.                                
    -remote           [option] Indicates that the tool is not      
                      running on the same machine as the admin     
                      server and the "-source" path is the actual  
                      path on the server. By default, this tool    
                      assumes any "-source" path to be valid on    
                      the local machine. In that case, the         
                      "-upload" option must be used if the tool    
                      needs to copy the application over to the    
                      admin server.                                
    -nostage          [option] This application will not be staged 
                      and deployed from the source location. When  
                      specified, the application must be available 
                      at the location provided in the "-source"    
                      option on all target servers. Default:       
                      "nostage" for admin server and "stage" for   
                      managed server targets.                      
    -external_stage   [option] Indicates that the user wants to    
                      copy the application in the server staging   
                      area externally or using a third-party tool. 
                      When specified, WebLogic Server looks for    
                      the application under "StagingDirectoryName  
                      (of target server)/applicationName".         
    -stage            [option] Indicates that the application      
                      needs to be copied into the target server    
                      staging area before deployment. Default:     
                      "nostage" for admin server and "stage" for   
                      managed server targets.                      
    -nowait           [option] Once the action is initiated, the   
                      tool prints the task ID and exits. This is   
                      used to initiate multiple tasks and then     
                      monitor them later using the -list action.   
    -timeout <seconds> [option] The maximum time in seconds to wait 
                      for the completion of the deployment task.   
                      When the time expires, the current status is 
                      printed and the program exits.               
    -deploymentorder <deployment order> [option] The deployment order    
                      for the application.                         
    -source <archive file or directory> [option] Location of the file    
                      source.                                      
    -altappdd <File Path> [option] Location of the alternate           
                      application deployment descriptor on the     
                      admin server.                                
    -altwlsappdd <File Path> [option] Location of the alternate WebLogic 
                      application deployment descriptor on the     
                      admin server.                                
    -appversion <application version> [option] The version identifier of 
                      the application. If not specified, the       
                      currently active version of the application  
                      is assumed.                                  
    -planversion <deployment plan version> [option] The version          
                      identifier of the deployment plan. If not    
                      specified, the currently active version of   
                      the applications deployment plan is assumed. 
    -noversion        Notifies the deployment system that this     
                      application has no version associated with   
                      it, and thus the version checks on the       
                      source of the application are no performed.  
    -retiretimeout <The retirement timeout in seconds> [option] The      
                      retirement timeout in seconds for timeout    
                      retirement policy. If not specified,         
                      graceful retirement policy is assumed.       
    -id <task identifier> [option] Optional client supplied unique     
                      identifier for the deployment task.          
    -adminmode        [option] The administration mode. If not     
                      specified, production mode is assumed.       
    -graceful         [option] Graceful shutdown. If not           
                      specified, force shutdown is assumed.        
    -ignoresessions   [option] Ignore pending HTTP sessions during 
                      graceful shutdown. Can be used with          
                      -graceful option only. Default is false.     
    -rmigraceperiod <The RMI grace period in seconds> [option] Grace     
                      period for RMI requests during graceful      
                      shutdown. Can be used with -graceful option  
                      only. Default is no grace period.            
    -allversions      [option] Force undeploy all application      
                      versions irrespective of in-flight work. Can 
                      be used with -allversions option only.       
                      Default is false.                            
    -submoduletargets <submod@mod-jms.xml@target | submoduleName@target> [option] SubModule level targets for JMS Modules.
    -securityModel <DDOnly|CustomRoles|CustomRolesAndPolicies|Advanced> [option] Security model to be used for this deployment.
    -enableSecurityValidation [option] Enables validation of security    
                      data.                                        
    -libspecver <library specification version> [option] Specifies the   
                      specification version of the library, if it  
                      is not present in the manifest. Requires the 
                      -library option.                             
    -libimplver <library implementation version> [option] Specifies the  
                      implementation version of the library, if it 
                      is not present in the manifest. Requires the 
                      -library option.                             
    -usenonexclusivelock [option] Used to indicate the deployment     
                      operation will utilize an existing lock on   
                      the domain already acquired by the same      
                      user. This is useful when the user is        
                      employing multiple deployment tools          
                      simultaneously and one of them has acquired  
                      a lock on the domain configuration.          
    -advanced         Print advanced usage options.                

The optional trailing arguments are deployment units and may 
represent the archive being deployed, the name of a previously 
deployed application or a list of files for a partial redeploy operation.

#查看weblogic.Deployer使用例子
java -cp ${wls_jar_dir}/weblogic.jar weblogic.Deployer -examples
 web应用操作命令
查看部署web应用命令
#查看部署的web应用
java -cp ${wls_jar_dir}/weblogic.jar weblogic.Deployer -adminurl t3://localhost:7001 -user weblogic -password 12345678  -listtask
 启动web应用命令  停止web应用命令
#停止web应用
java -cp ${wls_jar_dir}/weblogic.jar weblogic.Deployer -adminurl t3://localhost:7001 -user weblogic -password 12345678 -name hi-11 -stop -adminmode

默认情况下,WebLogic Server立即停止应用程序,而不考虑挂起的HTTP会话或进程内工作。如果要等待待处理的HTTP会话来完成工作,然后停止应用程序到客户端请求并将其置于管理模式下,请添加以下 -graceful 选项
#停止web应用前处理完请求
java -cp ${wls_jar_dir}/weblogic.jar weblogic.Deployer -adminurl t3://localhost:7001 -user weblogic -password 12345678 -name hi-11 -stop -adminmode  -graceful

如果没有使用该 -appversion 选项显式指定应用程序版本,则该 -stop 命令将仅停止应用程序的活动版本。如果还有其他版本的应用程序,您也想停止(或者你想停止代替或活动版本),您必须使用该 -appversion 选项指定它们。
要重新启动先前已停止的应用程序,使其可用于外部客户端,请使用该-start命令并指定部署名称。您不需要重新部署已停止的应用程序来使其普遍可用:
java -cp ${wls_jar_dir}/weblogic.jar weblogic.Deployer -adminurl t3://localhost:7001 -user weblogic -password 12345678 -name hi-11 -start

 war包操作命令
 部署war包命令
#部署war包并启动web应用
java -cp ${wls_jar_dir}/weblogic.jar weblogic.Deployer -adminurl t3://localhost:7001 -user weblogic -password 12345678 -name hi-12 -deploy ${war_path} -targets Server-1
 重新部署war命令
#重新部署war包并启动web应用
java -cp ${wls_jar_dir}/weblogic.jar weblogic.Deployer -adminurl t3://localhost:7001 -user weblogic -password 12345678 -name hi-12 -redeploy
 更新部署war包命令
#更新部署war包并启动web应用
java -cp ${wls_jar_dir}/weblogic.jar weblogic.Deployer -adminurl t3://localhost:7001 -user weblogic -password 12345678 -name hi-12 -redeploy -source ${war_one_path}
 更新部署war服务器命令
#更新部署war的服务器(多个服务用英文逗号分隔),此旧服务器服务不会停
java -cp ${wls_jar_dir}/weblogic.jar weblogic.Deployer -adminurl t3://localhost:7001 -user weblogic -password 12345678 -name hi-12 -redeploy -targets Server-2

将新应用程序或独立模块部署到域中的服务器后,部署名称将与您选择的部署文件保持关联。即使在所有服务器上停止部署后,仍可使用WebLogic Server管理控制台或weblogic.Deployer实用程序重新部署文件。

如果要从域中删除部署名称及其关联的部署文件,则必须明确取消部署应用程序或独立模块。要从域中取消部署部署单位weblogic.Deployer,请指定以下-undeploy命令:

java weblogic.Deployer -adminurl http:// localhost:7001 -user weblogic
   -password weblogic -name mymodule -undeploy

使用 -undeploy 不带 -targets 和 -submoduletargets 标志的命令可以完全从所有WebLogic Server实例中删除应用程序或独立模块,并对所有JMS子模块资源进行目标定位。

取消部署部署单元不会删除用于部署的原始源文件。它仅从域中删除部署的配置,以及WebLogic Server在部署期间创建的任何部署文件(例如,使用阶段部署模式复制的文件和上传到管理服务器的文件

cd /app/war/;mv console.war /app/war/warbak/console/console.war`date +"%Y%m%d-%H%M%S"`;cd /app/war/remote/;mv console.war /app/war/;chown -R weblogic:weblogic /app/war/*;source /etc/profile;java -Djava.security.egd=file:/dev/./urandom -Xms512M -Xmx1024M  -cp /app/weblogic/oralce_home/wlserver/server/lib/weblogic.jar  weblogic.Deployer -adminurl t3://10.246.152.133:7001 -username weblogic -password TestSiam#20210419 -deploy -name console -targets console -source /app/war/console.war


source /etc/profile;java -Djava.security.egd=file:/dev/./urandom -Xms512M -Xmx1024M  -cp /app/weblogic/oracle_home/wlserver/server/lib/weblogic.jar  weblogic.Deployer -adminurl t3://10.246.152.110:7001 -username weblogic -password TestSiam#20210419 -undeploy -name console -targets console;kill -9 `ps -ef |grep /app/weblogic/oracle_home |grep -v grep`
WLS_HOME='*'
username='*'
password='*'
#shengli
#password='*'

RESULT=$(/app/jdk1.7.0_76/bin/java -cp ${WLS_HOME}/lib/weblogic.jar weblogic.Admin -adminurl ${url} -username ${username}  -password ${password} GET -pretty -type ServerRuntime -property OverallHealthState |grep -i OverallHealthState |grep HEALTH_WARN |wc -l

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

凤舞飘伶

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值