Since I published Part 1 of the Resin Command Line Overview we’ve added a few more commands. The added commands allows to enable or disable a server, add a license, deploy new configuration files and generate admin password. Today I hope to cover commands I did not cover in part on and the new commands. List of new commands:
|Command||Description||Resin / Resin Pro|
|start-all||starts all servers listening to the machine’s IP interfaces||Resin|
|license-add||adds a Resin-Professional license to an installation||Resin Pro|
|enable||enable a Resin server to receive load-balance requests||Resin Pro|
|disable||disables a server for load-balancing||Resin Pro|
|disable-soft||allows existing sessions to finish and disables the server||Resin Pro|
|generate-password||generates an administrator user and password||Resin|
The command simply starts all Resin servers that bind to machine’s interfaces. Before explaining in detail what this command does I have to delve into explaining new feature of Resin Pro 4.0.24. Starting version 4.0.24 Resin introduces a new configuration tag that allows to configure multiple servers at once. The tag works with resin.properties that allows specifying the list of addresses that the new servers will bind to. Using resin.properties allows to localize the changes to a single short file and makes editing configuration a bit easier compared to XML based files. The new server-multi tag will look as below:
Property app_tier is imported from resin.properties:
Command start-all will examine the IPs and if they are assigned to any of the local interfaces will start appropriate server. The server names are assigned dynamically by adding an index to id-prefix of the server-multi tag. The index is derived from position of a particular IP in address-list. Such, for the two IPs defined in the example above app-0 and app-1 will be started.
Once the servers are started you can shut them down with a resin shutdown command (bin/resin.sh shutdown). Don’t forget about status command to check on status of the servers.
Commands enable, disable and disable-soft
When a need arises to take a server out of rotation with the load-balancer or bring the server back into rotation commands disable(-soft) or enable come into play. Resin’s Load-Balancer (configured in resin.xml with web-tier attributes) integrates with the app-tier’s dynamic capabilities. Web-tier and app-tier’s knowing of each other allow for Resin’s Cloud Elasticity (growing or shrinking). Taking a server out is can be done with either disable or disable-soft commands. Disable-soft allows server to finish sessions that it’s serving. Once the disable-soft command is issued web-tier will no longer distribute any new client’s requests to a that server. The commands take the exact same list of arguments at the moment, available with bin/resin.sh help enable|disable|disable-soft
Command jmx-dump, jmx-list, jmx-set and jmx-call
The set of Jmx commands helps query and execute actions on objects that are published via JMX. The easiest of the set is jmx-dump command. It only accepts the standart arguments and prints all registered MBeans with attributes and values. After executing the command you will see output similar to below:
If you’d like to query for a specific MBean or a set of MBeans you might want to use command jmx-list. This command accepts a pattern that queries only the MBeans that match the pattern. On the other hand, jmx-list command with *:* argument can be quite helpful when you don’t really know what you are looking for. Piping the output to grep makes combing through a vast amount of data a breeze. The jmx-list command can also print MBeans attributes and values, and, operatons. e.g.
Command’s distinct options include the following:
Command jmx-set allows to change a value of a MBean attribute at run time. So the command options will include pattern, attribute and value. If the pattern matches multiple beans it will not perform updating of an attribute.
The command will perform necessary conversions converting attribute from String to type of the attribute. Command jmx-call invokes MBean’s operation. Similarly to jmx-set, the command accepts a pattern that must uniquely identify MBean, operation name and a list of values that will be passed to the operation as parameters.
Example of using jmx-call command to obtain a heap-dump
After the method completes you can view the heap dump with jvisualvm
This command can be very instrumental in collecting various information from JVM and Resin into one document. I’ve uploaded a sample file for you to download and examine. The report is truly more then one can cover in one blog post, but here is a short list of info that it provides.
The command writes the pdf report into Resin’s log directory.
You can take a look at the report produced with the following command:
You can open the report for viewing by clicking on a link: Resin PDF Report.
This command allows to quickly generate password for inserting into a resin.properties file or admin-users.xml file.
This command deploys a license to resin server and restarts the server if -restart option is specified.
Command log-level is used to change the logging level at runtime. The logging level can be set to return to previous value automatically, after specified period of time.
Be cautious setting a log level to finer logging permanently, as it may cause the logs to fill up the disk space very quickly! Especially on servers under load. Set -active-time option to make sure you don’t forget to reset logging level.
Commands user-add, user-list and user-remove
The commands help with Resin administration. The users managed by these commands are Resin administrators. This is not a facility that you can use to add users to your particular application.
E.g. adding a foo user identified by ’secret’ password
E.g. listing users
E.g. removing a user:
Resin 4.0.25 will introduce new commands and we hope that the upcoming release finishes changes to CLI and at that point the CLI can be called ’stable’.