3. Admin CLI - asadmin
• Command Line Administration tool
> Administers domains, nodeagents, instances
> Deploys applications
> Configures and manages resources
> Monitors resources
• Everything you do in Admin console, you can do it
with asadmin and much more!
• To get a list of all the commands, “asadmin help”.
4. Syntax
asadmin command-name options operands
> command-name: start-domain, create-domain stop-domain etc.
> options: boolean, short-options, long-options
> operands
To get the syntax for a command, “asadmin command-name –help” or “asadmin
help command-name”
• Compliant with OpenSolaris CLIP Standards:
http://www.opensolaris.org/os/community/arc/caselo
g/2006/062/
5. Tip 1 - multi-mode
• Execution of many commands in asadmin shell
• Environment Variables are preserved in the
asadmin session.
• Execution of many commands specified in a file
> asadmin multimode –file <file contains commands>
• Faster performance since commands are executed
in the same Java VM.
6. Tip 2 - Environment Variables
• AS_ADMIN_<option-name>
e.g. AS_ADMIN_USER, AS_ADMIN_HOST etc.
> In SingleMode:
> Set environment variables in the shell
> In MultiMode:
> export AS_ADMIN_<option-name>=<options-value>
> unset AS_ADMIN_<option-name>
• You don't need to specify the options on the
command line when it's set in the environment
variable.
7. Tip 3 - Password Handling
• Interactive
> If true (by default), passwords are prompted
• Passwordfile
> Save passwords in a file and pass it as –passwordfile
option
> Passwords are saved in the file with the format:
AS_ADMIN_<password-name>=<password-value>
• login command / create-domain --savelogin
> admin passwords are encrypted in
$HOME/.asadminpass file.
> No need to provide passwordfile option on command line
8. Tip 4 - Closest Matching
• Finding commands in asadmin
> Accepts wildcards
> asadmin jdbc – returns all the commands with jdbc
> asadmin ^create* - returns all the command that starts with
create.
• Catches typos and return the closest matching
commands
> asadmin create-domian – returns the correct command
“asadmin create-domain”
9. Tip 5 – Dotted Name Commands
• get
> Gets the names and values of attributes
> Use wildcard character: “asadmin get ”, “asadmin get
server.”
> Use –monitor option for monitoring. Don't forget to
update the monitoring-level for the resource you want to
monitor.
• set
> Sets the values of one or more configurable attribute.
> e.g. “asadmin set <name1>=<value1>
<name2>=<value2>
• List
> Lists configuration elements
10. Tip 6 -Debug
• V2
> Add -DDebug in asadmin
• V3
> Set AS_DEBUG in environment
11. V2 vs V3
• V2
> Command classes are executed on client side
> Commands are bundled in admin-cli.jar and appserv-
ser.jar
> Uses JMX connector to communicate with the server
• V3
> Command classes are executed on server side
> Uses REST-like HTTP protocol to communicate with the
server.
10