Skip to content

Commit

Permalink
Merge pull request #6 from dabberpk/master
Browse files Browse the repository at this point in the history
SAP Hana Express integration
  • Loading branch information
koppor authored Aug 17, 2017
2 parents 14251d7 + 332a156 commit 3d2fb2a
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.HANA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
To test SAP HANA Express Edition some extra steps are necessary.
You will need the JDBC driver from the Hana studio program (ngdbc.jar), make some adjustments to the generator VM and create an own image for the database itself.

Prepare virtual machine images
1. Put ngdbc.jar to /home/vagrant/YCSB-TS/ngdbc.jar in the generator VM image.
2. Create a new VM image and install HANA express edition onto the image.(It is advised to use the same password for all password prompts.)
3. add the data of the created image file to vagrant_files/hana1/files/vagrantconf_db.rb .
4. Substitute <PASSWORD> in databases/hana1.py with the actual password set in step two. And if needed change the user in the same file.
optional:
5.If you want to test different sorts of tables, change vagrant_files/hana1/files/create_table.mysql

While interpreting the results please keep in mind that SAP HANA is an inmemory database,so disk space values alone are not really comparable.
69 changes: 69 additions & 0 deletions vagrant_files/generator/files/databases/hana1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/usr/bin/env python2
# -*- coding: utf-8 -*-

__author__ = 'Patrick Dabbert'
__version__ = "0.01"

# db_folders -> List of DB Folder (for space check)
# db_client -> name of ycsb client
# db_args -> special ycsb arguments for this db
# db_name -> name of this db (e.g. for workload file)
# db_desc -> more detailed name/description
# jvm_args -> special jvm_args for this db and ycsb
# prerun_once -> list of commands to run local once before ycsb (%%IP%% uses first db vm) (without ycsb, sync or space diff or poweroff commands!)
# postrun_once -> list of commands to run local once after ycsb (%%IP%% uses first db vm) (without ycsb, sync or space diff or poweroff commands!)
# prerun -> list of commands to run before ycsb (all vms or local) (without ycsb, sync or space diff or poweroff commands!)
# postrun -> list of commands to run after ycsb (all vms or local) (without ycsb, sync or space diff or poweroff commands!)
# prerun_master -> list of commands to run before ycsb (only on master(first=ID 0) vm or local)) (without ycsb, sync or space diff or poweroff commands!)
# postrun_master -> list of commands to run after ycsb (only on master(first=ID 0) vm or local)) (without ycsb, sync or space diff or poweroff commands!)
# prerun_slaves -> list of commands to run before ycsb (only on slave (all without master(=ID 0)) vms or local)) (without ycsb, sync or space diff or poweroff commands!)
# postrun_slaves -> list of commands to run after ycsb (only on slave (all without master(=ID 0)) vms or local)) (without ycsb, sync or space diff or poweroff commands!)
# prerun_dict -> list of commands to run before ycsb for each db vm (key=number of vm) (without ycsb, sync or space diff or poweroff commands!) (%%SSH%% not needed)
# postrun_dict -> list of commands to run after ycsb for each db vm (key=number of vm) (without ycsb, sync or space diff or poweroff commands!) (%%SSH%% not needed)
# check -> list of commands to run after prerun (all vms or local) for checking if everything runs correctly (systemctl start xyz oftern returns true even if start failed somehow. Check that here!)
# check_master -> list of commands to run after prerun (all vms or local) for checking if everything runs correctly (only on master(first=ID 0) vm or local))
# check_slaves -> list of commands to run after prerun (all vms or local) for checking if everything runs correctly (all without master(=ID 0)) vms or local))
# check_dict -> list of commands to run after prerun for each db vm (key=number of vm) (without ycsb, sync or space diff or poweroff commands!) (%%SSH%% not needed)
# basic -> True/False, if True this is a basic database, so no need to ssh for space checking
# sequence -> which vm should be provisioned first? (for all postrun/prerun dicts/lists. First number is considered master db vm, rest are slaves.)
# include -> which base modules should be imported and added to the dictionary (standard functions that are reusable). Warning: infinite import loop possible!
# the following variables are possible in prerun_once, postrun_once, prerun, prerun_master, prerun_slaves, check, check_master, check_slaves, postrun, postrun_master, postrun_slaves, prerun_dict, postrun_dict, check_dict, db_args:
# %%IP%% -> IP of (actual) db vm
# %%IPgen%% -> IP of (actual) generator vm (on which this script runs)
# %%IPn%% -> IP of db vm number n (e.g. %%IP2%%)
# %%IPall%% -> give String with IP of all vms)
# %%HN%% -> Hostname of (actual) db vm
# %%HNgen%% -> Hostname of (actual) generator vm (on which this script runs)
# %%HNn%% -> Hostname of db vm number n (e.g. %%HN2%%)
# %%HNall%% -> give String with Hostname of all vms)
# %%SSH%% -> if SSH should be used (set at the beginning)
# Order of Preruns/Postruns:
# 1. prerun/postrun/check, 2. prerun_master/postrun_master/check_master, 3. preun_skaves/postrun_slaves/check_slaves, 4.prerun_dict/postrun_dict/check_dict
# General Order:
# prerun -> check -> ycsb -> postrun

def getDict():
dbConfig={}
dbConfig["db_folders"]=["/hana"]
dbConfig["db_client"]="jdbc"
dbConfig["db_args"]="-cp /home/vagrant/YCSB-TS/ngdbc.jar -p db.driver=com.sap.db.jdbc.Driver -p db.url=jdbc:sap://%%IP%%:30013/?databaseName=SYSTEMDB -p db.user=SYSTEM -p db.passwd=<PASSWORD>"
dbConfig["db_name"]="hana1"
dbConfig["db_desc"]="SAP Hana Express on 1 VM."
dbConfig["jvm_args"]="-jvm-args='-Xmx4096m'"
dbConfig["prerun_once"]= []
dbConfig["postrun_once"]= []
dbConfig["prerun"]= ["cd ~"]
dbConfig["postrun"]= []
dbConfig["prerun_master"]= [ "%%SSH%%sudo -u hxeadm /usr/sap/HXE/HDB00/HDB start","%%SSH%%sudo -u hxeadm /usr/sap/HXE/HDB00/exe/hdbsql -i 00 -n localhost:30013 -u SYSTEM -p <PASSWORD> -I /home/vagrant/files/create_table.mysql" ]
dbConfig["postrun_master"]= []
dbConfig["prerun_slaves"]= []
dbConfig["postrun_slaves"]= []
dbConfig["prerun_dict"]= {}
dbConfig["postrun_dict"]= {}
dbConfig["check"]= []
dbConfig["check_master"]= []
dbConfig["check_slaves"]= []
dbConfig["check_dict"]= {}
dbConfig["basic"]= False
dbConfig["sequence"]=[0]
return dbConfig
5 changes: 5 additions & 0 deletions vagrant_files/hana1/files/create_table.mysql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CREATE ROW TABLE "SYSTEM"."USERMETRIC" ( "YCSB_KEY" LONGDATE CS_LONGDATE NOT NULL,
"VALUE" DOUBLE CS_DOUBLE,
"TAG0" VARCHAR(255) CS_STRING,
"TAG1" VARCHAR(255) CS_STRING,
"TAG2" VARCHAR(255) CS_STRING );
26 changes: 26 additions & 0 deletions vagrant_files/hana1/files/vagrantconf_db.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provider :vsphere do |vsphere, override|
vsphere.template_name = ''
end
config.vm.provider :openstack do |openstack, override|
openstack.flavor = ''
openstack.image = ''

end
config.vm.provider :virtualbox do |virtualbox, override|
virtualbox.customize ["modifyvm", :id, "--memory", "1024"]
end
config.vm.provider :digital_ocean do |digitalocean, override|
digitalocean.image = "debian-8-x64"
digitalocean.size = "16gb"
end
config.vm.provider :aws do |aws, override|
aws.instance_type = "t2.micro"
aws.ami = "ami-ccc021a3" # Debian Jessie
aws.block_device_mapping = [{ 'DeviceName' => '/dev/xvda', 'Ebs.VolumeSize' => 20, 'Ebs.VolumeType' => 'gp2' }]
end
end

# 512mb is not enough for cassandra
# 4096mb is not enough for cassandra + blueflood
# 8096mb is not enough for druid (single)
15 changes: 15 additions & 0 deletions vagrant_files/hana1/hana1.vagrant
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = "2"

HOSTNAME = "vm0"

load 'vagrantconf.rb'
load 'vagrantconf_db.rb'
load 'files/vagrantconf_db.rb' #this file has the overrides for hana
load 'basic/provider_specific.rb'
load 'basic/change_hostname.rb'
load 'basic/update.rb'
load 'basic/copy_files.rb'
load 'basic/provider_specific_end.rb'

0 comments on commit 3d2fb2a

Please sign in to comment.