File transfer in a Liberty collective
The FileTransfer and FileService MBeans can be used 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 those configured as collective members.
See Collective architecture for more information on collective controllers and members.
When we establish a remote JMX connection to a collective controller, we can use the RoutingContext MBean to direct the 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, we 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, we can upload and expand a Liberty archive to push out Liberty profiles 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.
- A small Liberty-built jar file is temporarily pushed into the target host.
- 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
- The custom Java jar file is invoked to extract the original archive.
- The custom Java jar file is deleted from the target host.
- 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. 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.
The FileService MBean operates on Liberty profiles (not only on host computers) and uses the authorization configurations from the Liberty profiles. It does not use host-computer authorization information.
Concepts:
Collective architecture Collective security File transfer Liberty collective troubleshooting Tasks:
Set the default host name of a Liberty server Configure a Liberty collective Register host computers with a Liberty collective Set the JAVA_HOME variable for Liberty collective members Configure Liberty collective replica sets Reference:
Example of setting up a JMX routing environment List of provided MBeans Overriding Liberty server host information