Using TSMPIPE as a Docker Microservice.
TSMPIPE works really well as a Docker microservice. While there are probably many use case scenarios for this, the simplest would be to backup all your Database Microservices (like MySQL).
To build TSMPIPE for Docker
-
Checkout TSMPIPE and build it.
Download and install the TSM (SP) Clients from
ftp://public.dhe.ibm.com/storage/tivoli-storage-management/maintenance/client/
.Checkout and make the
tsmpipe
binarymake -f Makefile.linux64
If you built it, you should have a
tsmpipe
binary after the compile completes. -
Create this Docker file
NAME leenooks/tsmpipe
VERSION 8.1.0
FROM centos:7
#RUN curl -SL ftp://public.dhe.ibm.com/storage/tivoli-storage-management/maintenance/client/v8r1/Linux/LinuxX86/BA/v812/8.1.2.0-TIV-TSMBAC-LinuxX86.tar | tar -C /tmp/ -xf - gskcrypt64-8.0.50.78.linux.x86_64.rpm gskssl64-8.0.50.78.linux.x86_64.rpm TIVsm-API64.x86_64.rpm && yum install -y /tmp/*rpm && rm -f /tmp/*rpm
RUN curl -SL http://{YOUR WEB SERVER}/CentOS/7/8.1.2.0-TIV-TSMBAC-LinuxX86.tar | tar -C /tmp/ -xf - gskcrypt64-8.0.50.78.linux.x86_64.rpm gskssl64-8.0.50.78.linux.x86_64.rpm TIVsm-API64.x86_64.rpm && yum install -y /tmp/*rpm && rm -f /tmp/*rpm
RUN ln -s /tsm/dsm.sys /opt/tivoli/tsm/client/api/bin64/
&& ln -s /tsm/dsm.opt /opt/tivoli/tsm/client/api/bin64/
&& ln -s /tsm/dsmcert.kdb /opt/tivoli/tsm/client/api/bin64/
&& ln -s /tsm/dsmcert.sth /opt/tivoli/tsm/client/api/bin64/
COPY tsmpipe/tsmpipe /usr/bin
VOLUME [ "/tsm" ]
Starting
ENTRYPOINT [ "/usr/bin/tsmpipe" ] ```
**NOTE**: If you can, place your downloaded TSM (SP) Client tar file (from step 1) on a local web server - it'll save you downloading it a second time. If you dont have a local webserver, uncomment the first line `RUN curl ...` line, and comment out the second one above.
-
Build your Docker image
docker build -t leenooks/tsmpipe:8.1.0 .
-
Create a directory to hold your
dsm.opt
,dsm.sys
and if required, your SSL configuration. This will need to be mapped to the container when it starts using Docker's-v
option. EG:-v /tmp/tsmpipe:/tsm
-
Check connectivity to your TSM (SP) Server
docker run --rm=true --hostname={NODE NAME} -iv /tmp/tsmpipe:/tsm leenooks/tsmpipe:8.1.0 -i
NOTE: You may need to set your password, use the
-p
switch. You'll need to use the-t
option todocker run
as well. -
If it all works OK, you should see a session dump starting with:
Application Version: TSMPIPE Version: 1.6.6 TSMPIPE API Version: 8.1.0.0 TSM Library: 8.1.2.0 ... ``` 7. You can now STDOUT pipe from one container to another.
For example:
```
docker exec -it 2fbdec51b6c0 mysqldump --all-databases -FlK --skip-extended-insert --skip-dump-date | docker run --rm=true --hostname=test -iv /tmp/tsmpipe:/tsm leenooks/tsmpipe:8.1.0 -Bcs /test/test -f test -l 30000 -m md5 ```
Dont want to build?
You can pull my image docker pull registry.leenooks.net/deon/tsmpipe:8.1.0
.
Then, create a directory and place in your dsm.opt
, dsm.sys
and ssl configuration files.
Then, docker run {options} registry.leenooks.net/deon/tsmpipe:8.1.0 {ARGUMENTS}
where options are:
--rm=true
so that the container is deleted after running--hostname=HOSTNAME
which is what will default to NODE_NAME in TSM-i
to pipe to the container, you need this docker flag-v /SOURCE:/tsm
map your directory with the configurations to :/tsm inside the containerregistry.leenooks.net/deon/tsmpipe:8.1.0
the container image{ARGUMENTS}
start with-h
If you need to change your password, you need to use argument -p
, but you'll also need to use docker argument -t
with it.
You could even customise the container to have your configuration already inside!
-
Here is a Dockerfile
FROM registry.leenooks.net/deon/tsmpipe:8.1.0 COPY config/* /opt/tivoli/tsm/client/api/bin64/
-
Put inside the
config/
directory all your config itemsdsm.sys
,dsm.opt
and your SSL config -
Run
docker build -t MY/tsmipe:8.1.0 .
, then you have a container with all your config inside. The only thing needed is the TSM password file, which you'll need to pass to it every time you invoke it with-v /DIRECTORY/TO/PASSWDFILE:/tsm
.NOTE: Make sure your dsm.sys file has
PASSWORDDIR /tsm
Also, you cannot put your password file in the container, because if you or the node changes the NODEs password, while the change will work, when the container ends, the updated password file will be lost.