啟動和停止子節點:
[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 ShellType help() for help on available commandsConnecting 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證書。 |
| 用于保護Java Standard Trust密鑰庫的密碼。 如果Java Standard Trust密鑰庫受密碼保護,并且如果要信任其CA證書,則必須使用此參數。 默認情況下,Java Standard Trust密鑰庫不受密碼保護。 |
| 導致weblogic.Deployer在位于文件名的自定義密鑰庫中信任CA證書。您必須使用這兩個參數來信任自定義密鑰庫。該文件名完全匹配,必須ServerMBean.CustomTrustKeyStoreFileName在堅持價值config.xml;?如果屬性中指定的值CustomTrustKeyStoreFileName是相對路徑名,則還必須在此參數中指定相同的相對路徑名 |
| 用于保護自定義密鑰庫的密碼。 只有在自定義密鑰庫受密碼保護的情況下,才必須使用此參數 |
| 自定義主機名驗證者類的名稱。該類必須實現該weblogic.security.SSL.HostnameVerifier 接口。 |
| 禁用主機名驗證。 |
連接參數
java [ SSL參數 ] weblogic.Deployer?
? ? ?[-adminurl protocol:// listen_address:port_number ]?
? ? ?[ 用戶憑據參數 ] COMMAND-NAME ?命令選項 [ Common Arguments ]
大多數weblogic.Deployer
命令要求您指定-adminurl
中所描述的參數連接到管理服務器實例
| 監聽管理服務器的地址和監聽端口。 要使用不受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 選項但不提供相應的-password 選項,則weblogic.Deployer 提示您輸入密碼。 |
| 管理員用戶的密碼。 為了避免在腳本或進程實用程序中顯示純文本密碼,例如ps首先使用WebLogic Sc??ripting Tool(WLST)storeUserConfig命令在配置文件中存儲用戶名和加密密碼,如WLST“WebLogic Server命令參考”中所述。省略-username和-password選項以weblogic.Deployer使用存儲在默認配置文件中的值。 如果要使用特定的配置文件和密鑰文件,而不是默認文件,請使用-userconfigfile和-userkeyfile選項weblogic.Deployer。 |
| 用于管理用戶名和密碼的用戶配置文件的位置。使用此選項,而不是-user和-password選項,在自動化腳本或者在你不希望有密碼屏幕上或進程級實用工具,如所示的情況ps。在指定-userconfigfile屬性之前,必須首先使用WebLogic腳本工具(WLST)storeUserConfig命令生成文件,如WLST“WebLogic Server命令參考”中所述。 |
| 指定用戶密鑰文件用于加密和解密用戶配置文件(-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.warsource /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