Nohup & hdblcm: how to update SAP HANA over an unreliable network
After Stephanie Lewellen introduced hdblcm and hdblcmgui in her blog last month, I decided to test one of my favorite linux tools “nohup” with hdblcm. Nohup is a lesser known Linux utility that can make the daily life of a system administrator a lot easier.
I do like and use GUI’s, but I prefer using command line – and hdblcm has proven to be very useful! When I update any SAP HANA instance I am rarely closer than 1000 miles from the server, whether it is a customer, partner, cloud, or internal system. Sometimes the network is OK, sometimes it is horribly slow and I get disconnected a lot. This depends of course on lots of factors, but none that I have any influence on. So why do I like hdblcm? First of all I like that it is simple to use, very much like hdbupd was in early versions of SAP HANA. And second, it makes is easier for me to use a linux tool like “nohup” and execute the SAP HANA update without being affected by network disconnects.
There are many ways to update SAP HANA, but below procedure is an option to consider for unreliable networks (e.g. geographic location, hotel room, airplane, some public clouds, multiple vpn’s) and/or longer running SAP HANA updates (e.g. large scale out with large row store, disk elasticity in public cloud). My goal is that after I start the actual update a network disconnection will not interrupt the SAP HANA update process. To achieve this I have to run hdblcm in a way that it needs no inputs during its execution (batch), which is documented in the latest SAP HANA Server Installation Guide on http://help.sap.com/hana.
Note: I use this method only if I do not trust the network to stay connected. If I can trust the network then I simply use hdblcm interactively as documented in the SAP HANA Server Installation Guide.
First let’s check the SAP HANA version for my instance P15:
(readability improves when you click on the image)
As documented in the official guide extract downloaded media in same base directory, in my case /hana/Rev70:
- SAPCAR -xvf IMC_STUDIO100_70_0-10009662.SAR
- SAPCAR -xvf IMDB_CLIENT100_70_0-10009663.SAR
- SAPCAR -xvf IMDB_SERVER100_70_0-10009569.SAR
Now I run hdblcm from the SAP_HANA_DATABASE directory to look at the options. Note that it shows the component directories it is reading for the update:
To run hdblcm as a batch process I create a template file:
For this simple example I change some values in the template file and save it:
# Select the action to be either installation or update (Default: install)
# SAP HANA System ID
# System Administrator Password
# Database User (SYSTEM) Password
Note: In the template file you can choose whether to update the saphostagent as part of the SAP HANA update (default = yes). The saphostagent gets updated with the version packaged in the extracted SAP_HANA_DATABASE directory.
Now, as root, I use nohup to execute the update and use & to send the process to the background:
nohup ./hdblcm –action=update –batch –configfile=template.txt > nohup.log &
Once the process is started I can disconnect my putty session, but it is better to do some quick checks. To monitor the process I simply use “tail –f nohup.log”. I always do this right way after executing nohup to ensure there are no immediate errors that I need to fix before I choose to disconnect or forcefully get disconnected.
The result in nohup.log:
A quick check to verify the updated version:
Recommendation: For security either delete the template file, or at least remove the passwords from it.
Note that nohup can also be used for other processes. For example I have used it for scp copy and mass start/stops in cloud landscapes for training instances.
Example mass start executed as root:
root@host: /hana/Rev70/SAP_HANA_DATABASE # cat start.sh
nohup su – p10adm -c “HDB start” &
nohup su – p11adm -c “HDB start” &
nohup su – p12adm -c “HDB start” &
nohup su – p13adm -c “HDB start” &
nohup su – p14adm -c “HDB start” &
nohup su – p15adm -c “HDB start” &
I hope this was helpful, let me know if you have any comment/questions!