Saturday, 23 June 2018

HANA Express and XS Advanced: When you cannot modify the hosts file…

Use the IP address to access the applications


SAP HANA Express, SAP XS, SAP HANA Study Materials, SAP HANA Tutorials and Materials


Nothing like having administration rights over your computers and servers, especially when you are using HANA Express with XS Advanced (the “server + applications” image) and need to change the hosts file to map the IP with the default name of the host, hxehost to connect.

SAP HANA Express, SAP XS, SAP HANA Study Materials, SAP HANA Tutorials and Materials

The instructions tell you that you need to either edit the file in C:\Windows\System32\drivers\etc or in /etc/ for Mac… some people, try this and find that they have:

No administration rights to edit the hosts file


So what happens when you have a powerful virtual machine on a cloud environment but you do not have permissions or the possibility to edit the hosts file? You stay out of XS Advanced apps in your HXE Virtual Machine? Do you miss all the fun and tooling? No, you have the option to rename the system to the DNS or, better yet, the external IP address.

So this makes sense/applies to:

◈ Pre-configured cloud virtual machines (the ones you can deploy on Google Cloud Platform, Amazon Web Services or Microsoft Azure )
◈ HANA 2.0 SPS03, express edition: Why? Because I’ve tried this only on this version

This works in other pre-configured flavors of HXE installations, like the downloadable HXE VM. However, most of the other methods will not throw exceptions when performing a full rename of the system as documented in the administration guide. I’ll spare you those gory details and continue to the quickest solution I have found (so far).

Renaming the XSA domain name only


I will be using the IP address as the XSA domain name, but you can replace it with a proper, working DNS name.

Get a static IP address


Whatever platform you are using, make sure the IP address that was assigned to your machine will stay there. By default, the virtual machines in cloud providers are configured with an ephemeral IP address. Make sure you switch it to static so that you do not get a new one when the machine is rebooted.

Modify the xscontroller.ini file


I am using vi for this.

It’s OK if you haven’t used it before, I won’t tell anyone. Here are the very basics: the arrows will move you around, when you are ready to modify a line press “i”, when you are done editing press Esc + “:” + “wq”. If you panic, need to exit and not save, press Esc + “:” + “q!”.

sudo vi /hana/shared/HXE/global/hdb/custom/config/xscontroller.ini

In the file, replace `hxehost`  with your external IP address or domain name:

SAP HANA Express, SAP XS, SAP HANA Study Materials, SAP HANA Tutorials and Materials

Create a file with passwords


This is to avoid the renaming program to ask you for passwords. Again, “vi pwd.xml” will open an editor.

Don’t feel offended by the following note, but the devil is in the details: make sure you replace Password123 and HXHana4 with your own passwords if you are copying the file.

<?xml version="1.0" encoding="UTF-8"?>
<Passwords>
<password><![CDATA[Password123]]></password>
<source_password><![CDATA[Password123]]></source_password>
<system_user_password><![CDATA[Password123]]></system_user_password>
<sapadm_password><![CDATA[HXEHana4]]></sapadm_password>
<system_user_password><![CDATA[Password123]]></system_user_password>
</Passwords>

Renaming time!


Switch to hxeadm and stop the database (the exit piece is not necessary in the downloadable VM, in case you are doing that there):

sudo su – hxeadm
HDB stop
exit

Now replace the IP_ADDRESS with your own external IP address (or domain name, HANA likes it if you call her smart, for example)  and cast this spell in your console:

cat ./pwd.xml | sudo /hana/shared/HXE/hdblcm/hdblcm --action=rename_system --nostart --skip_hostagent_calls --certificates_hostmap=hxehost=IP_ADDRESS --xs_domain_name=IP_ADDRESS --read_password_from_stdin=xml -b

Let the magic happen and wait for the success message:

SAP HANA Express, SAP XS, SAP HANA Study Materials, SAP HANA Tutorials and Materials

Turn the database on, give it like… 5 minutes, log in to the the XS CLI and voilá!

HDB start
xs-admin-login
xs a

SAP HANA Express, SAP XS, SAP HANA Study Materials, SAP HANA Tutorials and Materials

Are you getting an error?


If you are getting something like the following:

Could not connect to authorization endpoint https://hxehost:39032/uaa-security: Error executing request GET https://hxehost:39032/uaa-security/login: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No name matching hxehost found Don’t panic and be patient. The renaming needs the database to be up and running before it can finish the process. Go, get some coffee or beverage of your choice and try the xs-admin-login piece again in a couple of minutes.

If you need to see some progress while you are waiting, tail this file: /usr/sap/HXE/HDB90/hxehost/trace/xscontroller_0.log

No comments:

Post a Comment