Skip to content

Commit

Permalink
Merge pull request #141 from yeoldegrove/scale-out_addhosts
Browse files Browse the repository at this point in the history
allow to disable shared HANA basepath and rework add_hosts code
  • Loading branch information
yeoldegrove authored May 23, 2022
2 parents a368b7f + 08bb881 commit c42ce7c
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 26 deletions.
30 changes: 21 additions & 9 deletions hana/enable_cost_optimized.sls
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,27 @@ failure:
{% endif %}
configure_ha_dr_provider_srCostOptMemConfig:
ini.options_present:
- name: /hana/shared/{{ node.sid.upper() }}/global/hdb/custom/config/global.ini
- separator: '='
- strict: False # do not touch rest of file
- sections:
ha_dr_provider_srCostOptMemConfig:
provider: 'srCostOptMemConfig'
path: '/hana/shared/srHook'
execution_order: '2'
module.run:
- hana.set_ini_parameter:
- ini_parameter_values:
- section_name: 'ha_dr_provider_srCostOptMemConfig'
parameter_name: 'provider'
parameter_value: 'srCostOptMemConfig'
- section_name: 'ha_dr_provider_srCostOptMemConfig'
parameter_name: 'path'
parameter_value: '/hana/shared/srHook'
- section_name: 'ha_dr_provider_srCostOptMemConfig'
parameter_name: 'execution_order'
parameter_value: '2'
- database: SYSTEMDB
- file_name: global.ini
- layer: SYSTEM
- reconfig: True
- user_name: SYSTEM
- user_password: {{ node.password }}
- password: {{ node.password }}
- sid: {{ node.sid }}
- inst: {{ node.instance }}
- require:
- reduce_memory_resources_{{ node.host+node.sid }}
- setup_srHook_directory
Expand Down
37 changes: 23 additions & 14 deletions hana/ha_cluster.sls
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,8 @@ sudoers_remove_old_entries_{{ sap_instance }}_srHook:
- repl: ''
# Add SAPHANASR hook
# It would be better to get the text from /usr/share/SAPHanaSR/samples/global.ini
# only add hook and stop/start if hana was installed (not on scale-out standby/workers)
# Only add hook if hana was installed (not on scale-out standby/workers). A restart is needed as secondary cannot register a new hook without this (e.g. via hdbsql).
{% if node.install is defined %}
configure_ha_hook_{{ sap_instance }}_multi_target:
ini.options_present:
Expand Down Expand Up @@ -126,8 +125,9 @@ remove_wrong_ha_hook_{{ sap_instance }}_sections_multi_target:
ha_dr_provider_SAPHanaSR:
- require:
- pkg: install_SAPHanaSR
- onlyif:
- test -f {{ sr_hook_multi_target }}
- unless:
- fun: file.file_exists
path: sr_hook_multi_target
remove_wrong_ha_hook_{{ sap_instance }}_options_multi_target:
ini.options_absent:
Expand Down Expand Up @@ -161,22 +161,31 @@ remove_wrong_ha_hook_{{ sap_instance }}_options:
- ha_dr_saphanasrmultitarget
- require:
- pkg: install_SAPHanaSR
- unless:
- test -f {{ sr_hook_multi_target }}
- onlyif:
- fun: file.file_exists
path: sr_hook_multi_target
# Configure system replication operation mode in the primary site
{% for secondary_node in hana.nodes if node.primary is defined and secondary_node.secondary is defined and secondary_node.secondary.remote_host == host %}
configure_replication_{{ sap_instance }}:
ini.options_present:
- name: /hana/shared/{{ node.sid.upper() }}/global/hdb/custom/config/global.ini
- separator: '='
- strict: False # do not touch rest of file
- sections:
system_replication:
operation_mode: '{{ secondary_node.secondary.operation_mode }}'
module.run:
- hana.set_ini_parameter:
- ini_parameter_values:
- section_name: 'system_replication'
parameter_name: 'operation_mode'
parameter_value: '{{ secondary_node.secondary.operation_mode }}'
- database: SYSTEMDB
- file_name: global.ini
- layer: SYSTEM
- reconfig: True
- user_name: SYSTEM
- user_password: {{ node.password }}
- password: {{ node.password }}
- sid: {{ node.sid }}
- inst: {{ node.instance }}
{% endfor %}
# Stop SAP Hana
# Stop SAP Hana - Only needed if global.ini was edited directelly (removed old hooks).
stop_hana_{{ sap_instance }}:
module.run:
- hana.stop:
Expand Down
86 changes: 83 additions & 3 deletions hana/install.sls
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,18 @@
include:
- .enable_cost_optimized
{% for node in hana.nodes if node.host == host and node.install is defined %}
{% for node in hana.nodes if node.host == host %}
{% if node.install is defined %}
{% set instance = '{:0>2}'.format(node.instance) %}
{% set sap_instance = '{}_{}'.format(node.sid, instance) %}
{% if node.install.extra_parameters is defined and node.install.extra_parameters|length > 0 %}
{%set extra_parameters = True %}
{%set extra_parameters_items = node.install.extra_parameters.items() %}
{% else %}
{%set extra_parameters = False %}
{%set extra_parameters_items = [] %}
{% endif %}
hana_install_{{ node.host+node.sid }}:
hana.installed:
Expand All @@ -27,10 +38,79 @@ hana_install_{{ node.host+node.sid }}:
{% endif %}
- extra_parameters:
- hostname: {{ node.host }}
{% if node.install.extra_parameters is defined and node.install.extra_parameters|length > 0 %}
{% for key,value in node.install.extra_parameters.items() %}
{% if extra_parameters %}
{% for key,value in extra_parameters_items %}
{% if key != 'addhosts' %} # exclude addhosts (scale-out)
- {{ key }}: {{ value }}
{% endif %}
{% endfor %}
{% endif %}
# needed to utilize pwd file for add_hosts
- remove_pwd_files: False
# scale-out specific
{% for key,value in extra_parameters_items %}
{% if key == 'addhosts' %}
# SAP Note 2080991
{% if not hana.basepath_shared|default(True) %}
disable_basepath_shared_{{ sap_instance }}:
module.run:
- hana.set_ini_parameter:
- ini_parameter_values:
- section_name: 'persistence'
parameter_name: 'basepath_shared'
parameter_value: 'no'
- database: SYSTEMDB
- file_name: global.ini
- layer: SYSTEM
- reconfig: True
- user_name: SYSTEM
- user_password: {{ node.password }}
- password: {{ node.password }}
- sid: {{ node.sid }}
- inst: {{ node.instance }}
{% endif %}
# add scale-out nodes
hana_add_hosts_{{ node.host+node.sid }}:
module.run:
- hana.add_hosts:
- add_hosts: {{ value }}
- hdblcm_folder: /hana/shared/{{ node.sid.upper() }}/hdblcm
- root_user: {{ node.install.root_user }}
- root_password: {{ node.install.root_password }}
- hdb_pwd_file: /root/hdb_passwords.xml
# only run after initial install (password file still exists)
- onlyif:
- test -f /root/hdb_passwords.xml
{% endif %}
{% endfor %}
# see "remove_pwd_files: False" above
hana_add_hosts_pwd_file_remove_{{ node.host+node.sid }}:
file.absent:
- name: /root/hdb_passwords.xml
{% else %} # node.install not defined
# make sure /hana/{data,log}/${SID} exists on nodes where install does not run
create_hana_data_{{ node.sid.upper() }}:
file.directory:
- name: /hana/data/{{ node.sid.upper() }}
# - user: {{ node.sid.lower() }}adm # user might not exist yet
# - group: sapsys # group might not exist yet
- mode: 750
- makedirs: True
create_hana_log_{{ node.sid.upper() }}:
file.directory:
- name: /hana/log/{{ node.sid.upper() }}
# - user: {{ node.sid.lower() }}adm # user might not exist yet
# - group: sapsys # group might not exist yet
- mode: 750
- makedirs: True
{% endif %}
{% endfor %}
9 changes: 9 additions & 0 deletions saphanabootstrap-formula.changes
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
-------------------------------------------------------------------
Thu May 13 08:16:24 UTC 2022 - Eike Waldt <[email protected]>

- Version bump 0.10.0
* allow to disable shared HANA basepath and rework add_hosts code
(enables HANA scale-out on AWS)
* do not edit global.ini directly (if not needed)

-------------------------------------------------------------------

Thu May 05 20:18:52 UTC 2022 - Eike Waldt <[email protected]>

- Version bump 0.9.1
Expand Down

0 comments on commit c42ce7c

Please sign in to comment.