Transferring files in a Liberty collective

A Liberty controller enables special file transfer capabilities within a Liberty collective. The most advanced such functionality is file transfer for multiple hosts within a single REST call. You can use the FileTransfer and FileService MBeans in a Liberty collective to perform file actions on any Liberty server in the collective. This includes both Liberty servers configured as collective controllers and as collective members.

About this task

When you establish a remote JMX connection to a collective controller, you can use the RoutingContext MBean to direct your FileTransfer and FileService MBean calls to execute on any Liberty server in the collective. The collective controller takes care of routing the request and creating authorized connections between the collective controller and the target collective member.

By routing file operations to specific collective members, you can perform configuration-file updates and install applications on any Liberty server in the collective.

The FileTransfer MBean additionally can perform operations on a host computer in a collective whether or not there is a collective member on that host. By registering the host computer with the Liberty collective and specifying a RoutingContext that specifies that host, the FileTransfer command can be used to upload or download files to or from that host system. For example, you can upload and expand a Liberty archive to push out Liberty to new hosts.

The upload and extract operation in a routing environment has a more complex logic than that in the non-routing environment:
  • If the target host machine has access to an unzip command on its path, that command is invoked to extract the archive.
  • If an unzip command is not found, the process uses a Java-based archive extraction.
    1. A small Liberty-built jar file is temporarily pushed into the target host.
    2. A path to Java™ is found by checking the following:
      • Configured Java-home value that was setup during host registration
      • Configured JAVA_HOME variable visible to RXA
      • Configured JRE_HOME variable visible to RXA
      • Java home found on the path
    3. The custom Java jar file is invoked to extract the original archive.
    4. The custom Java jar file is deleted from the target host.
    5. If the archive being expanded by the custom Java jar file is a Liberty archive, the process recursively sets the permissions of its wlp/bin folder to 755 to allow for remote management of that Liberty instance.

The FileTransfer MBean uses authorization information stored in the collective controller for either the target host computer or collective member. This information was stored when the host computer or collective member was registered. See Registering host computers with a Liberty collective for more information on setting up this information for the host computer.

File-transfer operations directed at the host computer use the authorization information stored for the host computer. File-transfer operations directed at a collective member use the authorization overridden by the collective member, if any, or use the information stored for the host computer by default. See Overriding Liberty server host information for more information on overriding host information.

The FileService MBean operates on Liberty (not only on host computers) and uses the authorization configurations from Liberty. It does not use host-computer authorization information.