SAP HANA Express Edition in Docker (End to End Example)

May 2020 Update: Check this updated article https://www.dhirubhai.net/pulse/sap-hana-express-edition-windows-10-pc-vadim-zaripov to run HXE in Windows Docker Desktop with WSL2 natively.

Over the years SAP and other big enterprise software vendors were not too keen to embrace open source and commonly accepted DevOps practices when it came to installation, maintenance, distribution and development of software. Containerisation, virtualisation, version control – all of the common DevOps practices were unknown to big enterprise players such as SAP. With HANA it all started to change slowly, now we have Git and Gerrit in HANA XSA, Eclipse as IDE for HANA and SAP ABAP, virtualisation of SAP systems and now the time has come to adopt containerisation concepts as well.

What is containerisation with Docker, why do we think it matters a lot and how is it different from virtualisation?

Well, in short – containerisation is the method of packaging, distributing and running applications. Each container encapsulates not only the application itself in the pre-set state, but also the required environment for the application to run. For example, in order to run HANA DB we usually have to install Linux in the VM environment, set it up correctly, so it meets all the prerequisites, then we have to acquire HANA binaries and then perform the HANA installation. It all takes time and resources.

In a nut shell containerisation is another type of virtualisation, just not requiring hypervisor and guest OS for our software to run. A single powerful host with Docker could handle many containers with many different applications in it.

Docker significantly decreases time to create new environments for testing, development or even production purposes. After a container no longer needed, it can be stopped and deleted, releasing resources and space.

Here is Docker architecture from Docker web page:

No alt text provided for this image

(read more at https://docs.docker.com/engine/docker-overview)

So far SAP provides Docker images only for SAP HANA Express Edition (database services) and SAP HANA Express Edition (database and application services). The second option with XSA makes HANA XSA environment easily available for developers to train and explore new development tools for HANA platform without hours of tiresome and complicated Basis tasks. We feel that this model of distributing and running development versions of modern application is the future and by entering this field SAP would undoubtedly get a wider set of developer communities interested in developing for the SAP HANA Platform.

We hope that in future SAP will offer additional products based on HANA as Docker images. However we currently only have HXE, SAP HANA Vora and SAP Data Hub available as Docker images with SAP Data Hub requiring Kubernetes for the process orchestration.

In this blog we would like to showcase end to end Docker deployment of HANA Express Edition (database services) from provisioning the virtual machine to running multiple HXE containers. The main idea - you can get your very own functioning HXE up and running in under an hour and also have ability to spin up other containers on the same host VM.

Important note: we are using completely free software for all the steps in this tutorial.

If you are running Linux OS as your primary PC OS then the whole process would actually take roughly 20 minutes.

Pre-configured Virtual Machine

We will build our environment on the Ubuntu VM sourced from osboxes.org. Therefore we can have multiple flavours of it – VMWare Image or Virtual Box image. In this blog we will use Virtual Box for our VM.

Osboxes.org is a great source of pre-configured VM Images saving developers hours of setting up custom environment.

Go to osboxes.org, choose “Virtual Box” images and download Ubuntu image:

No alt text provided for this image
No alt text provided for this image

Extract 7z archive into the dedicated folder (preferably on SSD drive) :

No alt text provided for this image

Open Virtual Box and click “New” to add new virtual machine, choosing the downloaded VDI image:

No alt text provided for this image
No alt text provided for this image

Choose the downloaded VDI image as the drive on the next step:

No alt text provided for this image

Change network settings mode to “Bridged” and start your newly created VM.

No alt text provided for this image

Login with the username oxboxes.org and password osboxes.org:

No alt text provided for this image

Open terminal and let’s run some commands to install docker and SSH server for us to connect from our Windows host machine.

Update the list of package:

sudo apt update 

Next install openssh-server to connect to Ubuntu VM via the Putty from the host machine:

sudo apt install openssh-server 

Issue the next command to check the status of the server:

sudo systemctl status ssh

You should see something like this:

No alt text provided for this image

Check VM’s IP address by running command:

ip address

Connect to it via the SSH (we’ll be using Putty) with username osboxes and password osboxes.org

Let’s install Docker by issuing simple command:

sudo apt install docker.io
No alt text provided for this image

Let’s test Docker installation by running the hello-world container:

sudo docker run hello-world
No alt text provided for this image

Ok. Our Docker installation seems to be working fine. Now let’s continue to the fun part – getting up and running the HXE container.

SAP HANA Express Edition Container 

Find the latest version of HXE on docker store here: https://store.docker.com/images/sap-hana-express-edition

Before you can start the container, ensure that the following parameters are set in your host's /etc/sysctl.conf file. 

fs.file-max=20000000

fs.aio-max-nr=262144

vm.memory_failure_early_kill=1

vm.max_map_count=135217728

net.ipv4.ip_local_port_range=40000 60999
No alt text provided for this image

Update hosts file with the current ip address of your virtual machine by running the following (replacing with your VM's IP):

sudo sh -c 'echo 192.168.0.46  hxehost >> /etc/hosts'

Create new directory for the HXE container:

sudo mkdir -p /data/HXE_DOCKER1

Apply permissions to it:

sudo chmod 757 /data/HXE_DOCKER1

Create settings.json file in /data/HXE_DOCKER1 and place the following code in there (setting master password, use your own):

{

        "master_password" : "HXEDocker2019"

}

The next set of commands we package into a script so that we can have them preserved for future and can easily modify for new containers (change the location and ports bind). Please check the latest version of HXE image in Docker store and include it in the relevant line ( /store/saplabs/... ).

In addition, we are not running the container in foreground mode, this avoids exiting the container every time the process window is closed. Therefore, we have added -d parameter to docker run. We suggest you try both ways to see which one you like more, and which one covers your requirements.

docker run -p 39013:39013 -p 39017:39017 -p 39041-39045:39041-39045 -p 1128-1129:1128-1129 -p 59013-59014:59013-59014 \

 -v /data/HXE_DOCKER1:/hana/mounts \

-d \

--ulimit nofile=1048576:1048576 \

--sysctl kernel.shmmax=1073741824 \

--sysctl net.ipv4.ip_local_port_range='40000 60999' \

--sysctl kernel.shmmni=524288 \

--sysctl kernel.shmall=8388608 \

--name HXE_DOCKER1 \

store/saplabs/hanaexpress:2.00.036.00.20190223.1 \

--passwords-url file:///hana/mounts/settings.json \

--agree-to-sap-license

Save the script and make it executable with:

sudo chmod +x setup_script.sh

If you haven’t logged into Docker store before, please do so now by issuing the command and entering your credentials. Otherwise the HXE image won’t be pulled:

sudo docker login 
No alt text provided for this image

Now let’s start our new script from the command line with:

sudo ./setup_script.sh 

The process starts:

No alt text provided for this image

After a couple of minutes, the process should successfully finish (the screenshot below is the foreground version of container, with -d argument in the detached version this won’t be visible in console - use docker logs HXE_DOCKER1 to check what's going on).

No alt text provided for this image

The process in this case is running in a foreground mode meaning closing the process window will stop the container.

Run sudo docker ps command to check what’s running:

No alt text provided for this image

To log into the running container, use the following command:

sudo docker exec -it HXE_DOCKER1 bash

Issue command HDB info:

No alt text provided for this image

Now let’s try to connect to our new container with Eclipse the usual way we do for HANA systems (we just need to specify the ports from the mapping above).

Open Eclipse (or HANA Studio) and in SAP HANA Administration perspective add new system:

No alt text provided for this image

Log in with SYSTEM and HXEDocker2019 password (master password we have pre-set)

For SYSTEMDB:

No alt text provided for this image

For HXE tenant:

No alt text provided for this image

The system is up and running, it needs a bit of time to become fully functional (depending on the host CPU and RAM):

No alt text provided for this image

As you can see - the OS is SUSE Linux Enterprise Server 12 SP2 inside the docker container, while the actual host OS in this example is Ubuntu.

So - here it is, your own personal SAP HANA Express Edition instance which you created in under an hour and which you can play with, break, tweak, delete, start again from scratch - do whatever you like, with Docker you can afford the agile flexibility!

Now... If you got to this stage, you can read more about upgrading the image when the new version gets released over here:

https://hub.docker.com/_/sap-hana-express-edition/plans/f2dc436a-d851-4c22-a2ba-9de07db7a9ac?tab=instructions

Next time I will take you through XSA advanced container installation and the basics of XSA/HDI development for HANA.

Brant Hwang

Founder & CEO @ QueryPie | YC W20

3 年

Thanks so much Vadim! I resolved my hana studio issue!!

Achal Kansal

Developer & Data Privacy Expert - SAP Cloud Platform Master Data at SAP

4 年

Getting error "FAIL: process hdbdaemon HDB Daemon not running" on HDB start. Please help

回复
Ali Imran Uppal

Principal SAP ABAP/Fiori/BTP/CPI Consultant @ Systems Limited

4 年

That's Amazing! How much RAM do we need to install SAP HANA express edition in Docker?

回复
Darren Mallette

Experienced Solutions Architect | Passionate About Data, AI, Cyber Security, and Customer Success | Canadian Powerlifting Record Holder and Zwift Enthusiast

5 年

Nice post Vadim. In the sap.com tutorial, there is step 12 to run additional containers. Have you found a way in Express to change the SAP System name from HXE to something else? The system I'm testing doesn't like multiple HANA systems with the same name.

回复
Jeff Hubbs

Owner/Consultant at Mid-Atlantic Consulting: research, modeling, and analysis in the areas of energy systems and climate change. Electronics. Information technology. Music performance and production.

5 年

Vadim - Great job with this. I found this posting via Google after having trouble using SAP's own online docs.? Here's where I'm stuck: # docker run -p 39013:39013 -p 39017:39017 -p 39041-39045:39041-39045 -p 1128-1129:1128-1129 -p 59013-59014:59013-59014 -v /hana/:/hana/mounts --ulimit nofile=1048576:1048576 --sysctl kernel.shmmax=1073741824 --sysctl net.ipv4.ip_local_port_range='40000 60999' --sysctl kernel.shmmni=524288 --sysctl kernel.shmall=8388608 --name hana_express store/saplabs/hanaexpress:2.00.036.00.20190223.1 --passwords-url file:///hana/.json ======== Starting HANA container run script ======== Started at: Fri May 3 03:39:36 UTC 2019 Script parameters: --passwords-url file:///hana/.json HANA version: 2.00.036.00.1547699771 Linux kernel version: 4.19 ERROR: Unknown host '3955af2877b9'. The container must be started with one of these host names: ERROR: a3dbc985001b Big difference between SAP doc and you is that you add a line to /etc/hosts and they don't. I've got docker running fine (it will run the hello and helloWorld containers) on a physical Gentoo Linux machine and I tried using the machine's IP address and the name "hxehost" in a new line in my /etc/hosts but I'm still getting the same error and I'm not seeing how or where the name "hxehost" is getting used anywhere. Also tried /etc/hosts with the docker0 interface's IP address instead of the machine's; no change.

要查看或添加评论,请登录

Vadim Zaripov的更多文章

社区洞察

其他会员也浏览了