Here is quick reference of commands to start/stop instances and deploy applications supported by Payara Server and Payara Micro. The old commands and options only for compatibility with GlassFish are omitted.
Payara Server
1. Start, stop and check the status of standalone instances
Start a standalone instance
asadmin start-local-instance [--node node_name] instance_name
Stop a standalone instance
asadmin stop-local-instance [--node node_name] instance_name
Restart a standalone instance
asadmin restart-local-instance [--node node_name] instance_name
You may skip the --node option if there's only one node on the server. These commands are available even if DAS is not running.
Check the status of standalone instances
asadmin list-instances --standaloneonly=true
2. Start, stop and check the status of cluster instances
Start all instances in a cluster
asadmin start-cluster cluster_name
Stop all instances in a cluster
asadmin stop-cluster cluster_name
Check the status of all instances in a cluster
asadmin list-instances cluster_name
Start any instance (in cluster or standalone)
asadmin start-instance instance_name
Stop any instance (in cluster or standalone)
asadmin stop-instance instance_name
Restart any instance (in cluster or standalone)
asadmin restart-instance instance_name
Check the status of all instances (in cluster and standalone)
asadmin list-instances
3. Enable or disable Hazelcast instance and check the status
Enable or disable Hazelcast
asadmin set-hazelcast-configuration [--enabled={false|true}] [--dynamic={false|true}]
- --enabled : In Payara Server 4.x Hazelcast is disabled by default
- --dynamic : Restart is not required if to set true
Check the status of Hazelcast cluster member
asadmin list-hazelcast-cluster-members [--type {server|micro}]
Show all members if not specified --type option. Otherwise, show Payara Server or Payara Micro.
4. Create and delete a deployment group (Payara 5)
Create a deployment group
asadmin create-deployment-group deployment_group_name
- deployment_group_name : deployment group name
asadmin delete-deployment-group deployment_group_name
- deployment_group_name : deployment group name
5. Start, stop and check status of deployment groups (Payara 5)
Start a deployment group
asadmin start-deployment-group [--verbose={true|false}] deployment_group_name
- --verbose : verbose mode (true in default)
Stop a deployment group
asadmin stop-deployment-group [--verbose={true|false}] [--kill={false|true}] deployment_group_name
- --verbose : verbose mode (true in default)
- --kill : Kills instances if they do not stop gracefully (false in default)
- deployment_group_name : deployment group name
asadmin restart-deployment-group [--verbose={true|false}] [--rolling={true|false}] [--delay=delay] deployment_group_name
- --verbose: verbose mode (true in default)
- --rolling: Performs a rolling restart which each instance restarted in turn (true in default)
- --delay: Delay in (ms) between each instance restart in a rolling restart (5000 in default)
- deployment_group_name : deployment group name
Check the status of deployment groups
asadmin list-deployment-groups
6. Manage deployment group membership (Payara 5)
Add a instance to a deployment group
asadmin add-instance-to-deployment-group --instance instance_name --deploymentgroup deployment_group_name
- --instance : instance name
- --deployment-group-name : deployment group name
Remove a instance from a deployment group
asadmin remove-instance-from-deployment-group --instance instance_name --deploymentgroup deployment_group_name
- --instance : instance name
- --deployment-group-name : deployment group name
7. Deploy a module
deploy [--force={false|true}] [--virtualservers virtual_servers] [--contextroot context_root] [--precompilejsp={false|true}] [--name component_name] [--deploymentorder deployment_order] [--libraries jar_files] [--target {server|domain_name|cluster_name|deployment_group_name|instance_name}] [--type {car|ear|ejb|osgi|rar|war}] file_archive|filepath
- --force : force deploy (false in default)
- --virtualservers : Virtual servers deployed Web application, not mandatory
- --contextroot : context root
- --precompilejsp : Set true to pre-compile JSPs (false in default)
- --name : To set specified module name
- --deploymentorder : To set deployment order if needed (100 in default)
- --libraries : Libraries deployed at once
- --target : server: current server (default), domain_name: specified domain, cluster_name: cluster, deployment_group_name: deployment group (Payara 5), instance_name: specified instance
- --type : car (Java EE Application Client, recently little-used)、ear、ejb (EJB-JAR)、osgi (OSGI bundle, recently little-used), rar (JCA resources), war
- file_archive: archived module
- filepath: no-archived module
8. Undeploy a module
undeploy [--target {server|domain_name|cluster_name|deployment_group_name|instance_name}] [--cascade={false|true}]
component_name
- --target : server: current server (default), domain_name: specified domain, cluster_name: cluster, deployment_group_name: deployment group (Payara 5), instance_name: specified instance
- --cascade : Remove all the relational modules if to set true
- component_name : module name
Payara Micro
1. Start, stop and check the status of instances
Start an instance
$ java -jar payara-micro.jar [options]
Payara Micro doesn't have Shoal cluster and enables Hazelcast by default. If to set --nocluster option, you may run a standalone instance of Payara Micro. However, this option is all the feature
of Hazelcast - clustering, JCache and etc. Obtaining the status of instances is also limited.It is important to set the --rootdir parameter to a non temporary directory of your OS to avoid automatic cleanup of its contents.
Stop an instance
Ctrl+C or kill signal.
Check the status of instances
- Admin Console of Payara Server within same Hazelcast cluster
- asadmin of Payara Server within same Hazelcast cluster (show above)
- Using list of instances in console/log
- ps -ef (limited)
2. Deploy module
(Path to WAR or RAR files)
$ java -jar payara-micro.jar --deploy file_archive
(Path to a directory contains WAR or RAR files)
$ java -jar payara-micro.jar --deploydir file_archive_dir
(URL of Maven repository uploaded WAR or RAR files)
$ java -jar payara-micro.jar --deployfromgav groupId:artifactId:version [--additionalrepository repo-url]
You use multiple deploy flags on the command line. For examples, use --deploy option twice to deploy WAR and RAR files at once, use --deploy and --deployfromgav
When deploying multiple archives the order of deployment is the order of the command line arguments.
3. Additional deployment to UberJAR
Payara Micro's UberJAR is not only a packaging module with stored options you can also specify additional options at runtime. This way you can provide additional deployments to the UberJAR.
(Create UberJAR)
$ java -jar payara-micro.jar --deploy file_archive --outputuberjar uberjar_file
(Run UberJAR with additional module)
$ java -jar uberjar_file --deploy another_file_archive
4. Undeploy module
Payara Micro doesn't have undeploy command. But Payara Server can send asadmin commands if it is in the same cluster, so you can undeploy a module from the administration console or via a script.
asadmin send-admin-command --command undeploy component_name
Add Comment
Comments
Please sign in to leave a comment.