How to setup GlusterFS for using with IBM MQ MFT - ibm-messaging/mq-mft GitHub Wiki
IBM MQ Managed File Transfer can be used for transferring files from one point to another in an IBM MQ network. Apart from moving files, MFT can also move messages from a queue and write them as files at the destination i.e. Message-to-File transfer. MFT can also do other way round i.e. turn file(s) to message(s). MFT can also send/receive files to/from FTP, FTPS and SFTP server as well Sterling Connect:Direct.
MFT can read/write files from/to number of file systems like FAT32, NTFS, GPFS etc., In this article we describe steps to setup GlusterFS and MFT so that MFT agent writes files to GlusterFS file system.
GlusterFS is a scalable network filesystem suitable for data-intensive tasks such as cloud storage and media streaming. GlusterFS is free and open source software and can utilize common off-the-shelf hardware. More on GlusterFS is here: https://docs.gluster.org/en/latest/
GlusterFS supports five types of content distribution in volume namely Distributed, Replicated, Striped, Distributed Striped and Distributed Replicated. More details here: https://docs.gluster.org/en/latest/Quick-Start-Guide/Architecture/
In Replicated type, a file gets replicated across multiple nodes of GlusterFS. However in case of GlusterFS Distributed content distribution, a file does not get replicated, instead a file can be sent any of the GlusterFS nodes. The distributed type content distribution is not suitable for MFT because in case of an agent restart, the file data might be written to a different GlusterFS node instead of the node the agent was writing to before restart. In such cases transfer will restart instead of resuming, a .part file will remain in one of the node and the other node will have complete file. Hence in this article we choose GlusterFS Replicated type of content distribution.
Here is the architecture of the setup.
There are two distinct parts in this setup. GlusterFS setup and MFT. We use two nodes for setting up GlusterFS server. The third server is used to mount GlusterFS as client as well as to setup an MFT agent. The two nodes of GlusterFS server run Ubuntu 16.04 Linux while the GlusterFS client and MFT agent will also be on Ubuntu 16.04 Linux system.
We use a single queue manager as agent, command and coordination queue managers. The queue manager will be on a Windows 2012 R2 server. Another agent that we use as source agent will be on the same Windows 2012 R2 server.
We use MQ v9.1 queue manager and MFT Redistributable Agent package for setting up agents. Agents will connect to queue manager in clients mode.
The first part of the setup is to install and configure GlusterFS on two nodes. We will use GlusterFS version 5. The two nodes are named as glusterfsn1 (glusterfn1.xx.ibm.com) and glusterfsn2 (glusterfsn2.xx.ibm.com).
Setup on glusterfsn1:
-
Login to glusterfsn1 using SSH.
-
Install python software properties using:
apt-get install python-software-properties
- Download GlusterFS 5
add-apt-repository ppa:gluster/glusterfs-5
- Do an update
apt-get update
- Now install GlusterFS
apt-get install glusterfs-server
Repeat the above steps on second node glusterfsn2.
- Run the following on glusterfsn1
gluster peer probe glusterfsn2.xx.ibm.com
The response should be:
Probe successful.
- Check for peers by running on glusterfsn1
gluster peer status
The response would be something like
Number of Peers: 1
Hostname: glusterfsn2.xx.ibm.com
Uuid: 0f3aa4f4-f9dd-4cd2-a7a5-126606fbab33
State: Peer in Cluster (Connected)
The same command can be run on glusterfsn2 node as well to test the peer status.
Next we create directories on both GlusterFS servers. These will be used as mounting volumes on third node. As mentioned earlier we use Replicated type content distribution.
- Run the following on glusterfsn1. The command will create two directories
/mnt/mftrepl1
and/mnt/mftrepl2
.
mkdir /mnt/mftrepl{1,2}
- Run the following on glusterfsn2. The command will create two directories
/mnt/mftrepl3
and/mnt/mftrepl4
.
mkdir /mnt/mftrepl{3,4}
- Now create volumes for the directories created above. Run the following on glusterfsn1 node
gluster volume create mftreplicated replica 4 transport tcp glusterfsn1.xx.ibm.com:/mnt/mftrepl1 glusterfsn2.xx.ibm.com:/mnt/mftrepl3 glusterfsn1.xx.ibm.com:/mnt/mftrepl2 glusterfsn2.xx.ibm.com:/mnt/mftrepl4 force
The output of the command would be as below if the command succeeds
volume create: mftreplicated: success: please start the volume to access data
- Now start the volume by running the following command on glusterfsn1.
gluster volume start replicated
The output of the command would be on the following lines
volume start: replicated: success
This completes the GlusterFS server setup.
The following commands must be run on the third machine to mount GlusterFS volume. We will name the machine as glustermnt.xx.ibm.com
- Run the following command to install python.
apt-get install python-software-properties
- Run the following to download GlusterFS 5
add-apt-repository ppa:gluster/glusterfs-5
- Do an update
apt-get update
- Now install the GlusterFS client
apt-get install glusterfs-client
- Create a directory and mount the volume
mkdir /mnt/replica
mount.glusterfs glusterfsn1.xx.ibm.com:/ mftreplicated /mnt/replica/
Now test it by
df –h /mnt/replica
The output would be something like:
Filesystem Size Used Avail Use% Mounted on
glusterfsn1.xx.ibm.com:/mftreplicated 116G 2.3G 114G 2% /mnt/replica
This completes the GlusterFS client setup. Now it’s time to setup MQ and MFT Agents.
1)Create and start a queue manager QM_ALL
crtmqm QM_ALL
strmqm QM_ALL
2)Run MQSC
runmqsc QM_ALL
3)Run the following to setup a listener, server connection channel and channel authentication for user ‘mftuser.
DEF LISTENER('MFT_LISTENER') TRPTYPE(TCP) PORT(1414) CONTROL(QMGR)
START LISTENER(MFT_LISTENER)
DEF CHANNEL('MFT_CHANNEL') CHLTYPE (SVRCONN)
ALTER AUTHINFO (SYSTEM.DEFAULT.AUTHINFO.IDPWOS) AUTHTYPE (IDPWOS) ADOPTCTX(YES)
SET CHLAUTH('MFT_CHANNEL') TYPE(USERMAP) CLNTUSER(mftuser) USERSRC(CHANNEL) ACTION(ADD)
REFRESH SECURITY TYPE(AUTHSERV)
REFRESH SECURITY TYPE(CONNAUTH)
END
Queue manager setup is complete now. Next setup MFT agents.
We will one agent called AG_WIN on the same Windows box as the queue manager and other agent, AG_GLUS on Ubuntu 16.04 Linux box where GlusterFS volume is mounted.
First download the following MFT Redistributable packages
9.1.0.0-IBM-MQFA-Redist-Win64 on to Windows box
9.1.0.0-IBM-MQFA-Redist-LinuxX64 onto Linux box.
-
On Windows box unzip the 9.1.0.0-IBM-MQFA-Redist-Win64 to a directory using 7-zip or any other extraction tool. We will unzip the package to C:\MFTREDIST.
-
Once unzipped, the C:\MFTREDIST will have all the required binaries and other files of MFT. Open a command shell and change directory to C:\MFTREDIST.
cd C:\MFTREDIST\bin
- Create a data directory for storing MFT configuration and log files.
md C:\MFTADATA
- Setup the environment for MFT by running
fteCreateEnvironment –d C:\MFTDATA
- Setup coordination queue manager configuration
fteSetupCoordination -coordinationQMgr QMALL -coordinationQMgrHost qmwin.xx.ibm.com -coordinationQMgrPort 1414 -coordinationQMgrChannel MFT_CHANNEL
- Setup commands configuration
fteSetupCommands -p QM_ALL -connectionQMgrHost qmwin.xx.ibm.com -connectionQMgrPort 1414 -connectionQMgrChannel MFT_CHANNEL -connectionQMgr QM_ALL –f
- At this point MQMFTCredentials.xml file must be created in user’s home directory as the agent will be configured to connect in clients mode. Create the file with following contents:
<?xml version="1.0" encoding="UTF-8"?> <tns:mqmftCredentials xmlns:tns="http://wmqfte.ibm.com/MQMFTCredentials" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://wmqfte.ibm.com/MQMFTCredentials MQMFTCredentials.xsd"> <tns:qmgr name="QM_ALL" user="<replace this with logged in user>" mqUserId="mftuser" mqPassword="Passw0rd" useMQCSPAuthentication="true"/> </tns:mqmftCredentials>
Note: Replace the value of attribute user with your logged in user name.
- Setup agent AG_WIN
fteCreateAgent -p QM_ALL -agentQMgrHost qmwin.xx.ibm.com -agentQMgrPort 1414 -agentQMgrChannel MFT_CHANNEL -agentName AG_WIN -agentQMgr QM_ALL –f
- Start the agent
fteStartAgent AG_WIN
- Verify the status of agent by running
fteListAgents
- Untar the 9.1.0.0-IBM-MQFA-Redist-LinuxX64 package to directory
mkdir /MFTREDIST
cd /MFTREDIST
gunzip 9.1.0.0-IBM-MQFA-Redist-LinuxX64.tar.gz
- Once unzipped, the /MFTREDIST will have all the required binaries and other files of MFT. Open a command shell and change directory to /MFTREDIST.
cd /MFTREDIST/bin
- Create a data directory for storing MFT configuration and log files.
mkdir /MFTADATA
- Setup the environment for MFT by running
fteCreateEnvironment –d /MFTDATA
- Setup coordination queue manager configuration
fteSetupCoordination -coordinationQMgr QMALL -coordinationQMgrHost qmwin.xx.ibm.com -coordinationQMgrPort 1414 -coordinationQMgrChannel MFT_CHANNEL
- Setup commands configuration
fteSetupCommands -p QM_ALL -connectionQMgrHost qmwin.xx.ibm.com -connectionQMgrPort 1414 -connectionQMgrChannel MFT_CHANNEL -connectionQMgr QM_ALL –f
- At this point
MQMFTCredentials.xml
file must be created in user’s home directory as the agent will be configured to connect in clients mode. Create the file with following contents:
<?xml version="1.0" encoding="UTF-8"?> <tns:mqmftCredentials xmlns:tns="http://wmqfte.ibm.com/MQMFTCredentials" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://wmqfte.ibm.com/MQMFTCredentials MQMFTCredentials.xsd"> <tns:qmgr name="QM_ALL" user="<logged in user>" mqUserId="mftuser" mqPassword="Passw0rd" useMQCSPAuthentication="true"/> </tns:mqmftCredentials>
Note: Replace the value of attribute user with your logged in user name.
- Create agent AG_GLUS
fteCreateAgent -p QM_ALL -agentQMgrHost qmwin.xx.ibm.com -agentQMgrPort 1414 -agentQMgrChannel MFT_CHANNEL -agentName AG_GLUS -agentQMgr QM_ALL –f
- Start the agent
fteStartAgent AG_GLUS
- Verify the status of agent by running
fteListAgents
The output should both AG_WIN and AG_GLUS in READY state
Now test the setup by transferring a file from Windows box to GlusterFS and verify the file is present on GlusterFS servers.
fteCreateTransfer -rt -1 -sa AG_WIN -sm QM_ALL -da AGGLUS -dm QM_ALL -de overwrite -df "/mnt/replica/onebigfile.txt" C:\Temp\onebigfile.txt
Once the transfer completes verify that the file is present on both nodes of GlusterFS server. On glusterfsn1.xx.ibm.com and glusterfsn2.xx.ibm.com, do the following.
cd /mnt/mftrepl1
ls –l
The output on both nodes would be something like this:
-rw-r--r-- 2 root root 143689776 Nov 1 00:09 onebigfile.txt.
The output verifies the setup is completed successfully.
Try it!!!