Exposing HTTP Access to Multitenant Database Containers in SAP HANA SPS11
I have a HANA XS application that can be deployed to separate tenant databases when my HANA system is setup as Multitenant Database Containers (MDC). Naturally, I require HTTP access to those tenant databases and I was running into problems configuring this for both my SystemDB and my tenant databases.
I found the excellent post by Wenjun Zhou Exposing HTTP access to multitenant database containers in SAP HANA SPS09 and although the procedure is different for HANA SPS11, it pointed me in the right direction. The documentation also has a section on this topic (Configure HTTP(S) Access to Multitenant Database Containers – SAP HANA Administration Guide – SAP Library) that was useful, but there were a few steps that needed extra attention to complete the process, which I’ll describe in this blog post.
Note: I’ll only discuss HTTP access here, but the procedure is similar to configure HTTPS access.
- The HANA databases in your system should already be set up for access via DSN alias hostnames.
- The Web Dispatcher is set for automatic configuration.
- You have already created one or more tenant databases in your HANA MDC system.
There are a few other prerequisites and the list is found in the documentation link above.
Accessing the XS Engine
By default, you can access the XS engine for the SystemDB by opening the URL http://<fqdn_hostname>:80<instance>, where “fqdn” is the fully qualified domain name (FQDN). For example, if my HANA system is “mdc.internal.sap.com” and instance number is 00, then the XS engine URL for the SystemDB is http://mdc.internal.sap.com:8000.
Now, if you try to access the XS engine for one of your tenant databases (assuming you’ve set up its DSN alias hostname), you’ll immediately get the following error:
503 Service not available
For example, if you created a tenant database called “TN1” with alias “mdc-tn1”, then the XS engine for that database is http://mdc-tn1.internal.sap.com:8000 – however you’ll get that 503 error when you try to open this URL.
Configure HTTP Access for the Tenant Database
What you must do now is specify the public URLs for all your tenant databases. Here’s how you do this in HANA Studio (example with SQL is below as well):
- Connect to the SYSTEMDB (not the tenant database) as SYSTEM and open Administration.
- Switch to the Configuration tab and expand xsengine.ini | public_urls. Double-click on “public_urls” to invoke the Change Configuration Values dialog.
- Click the Databases drop-down box, select the tenant database(s) you want to configure and click OK.
- Provide the new URL using the alias hostname and click Save.
You are now able to XS engine for the tenant database (e.g. http://mdc-tn1.internal.sap.com:8000) without getting the 503 error.
If you want to use SQL instead of HANA Studio, you can execute the following statement in a SQL Console. Don’t forget to connect to the SYSTEMDB (not the tenant database!) as the SYSTEM user.
ALTER SYSTEM ALTER CONFIGURATION ('xsengine.ini', 'database', 'TN1') SET ('public_urls', 'http_url') = 'http://mdc-tn1.internal.sap.com:8000' WITH RECONFIGURE;
Re-Configure HTTP Access for the SystemDB
If you now try to access the SystemDB XS engine using the same URL as before (e.g. http://mdc.internal.sap.com:8000), you’ll find that you’ll get (oh no!):
503 Service not available
The documentation clearly states that the URL for the SystemDB changes once you’ve configured the URLs for the tenant databases. Instead of using the FQDN, the SystemDB XS engine is available under http//<localhost>:80<instance>. In our example, this means that the XS engine would now be found at http//mdc:8000.
What you need to do now is execute the following SQL statement to re-configure the SystemDB URL to use the alias host name:
ALTER SYSTEM ALTER CONFIGURATION ('nameserver.ini', 'system') SET('public_urls', 'http_url') = 'http://mdc.internal.sap.com:8000' WITH RECONFIGURE;
Note that if you try to make this change in HANA Studio by editing the xsengine.ini configuration file, the change will not take effect.
Voila! You now have access to the XS engines for the SystemDB and tenant databases using the alias hostnames.
You can spend a lot of time trying to figure out how to enable HTTP access to your SystemDB and tenant databases. Usually once you configure the tenant databases properly, you scratch your head determining why the SystemDB URL no longer works. The procedure to fix this is quite straightforward, once you know where to look. At a minimum, following these steps will allow you to open each tenant database’s HANA Cockpit, as that’s also a HANA XS application.