-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
These playbooks will set up servers to allow testing with HammerDB.
- Loading branch information
Showing
22 changed files
with
516 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
from __future__ import (absolute_import, division, print_function) | ||
__metaclass__ = type | ||
|
||
DOCUMENTATION = """ | ||
name: hammerdb_server | ||
author: Mark Wong | ||
short_description: Lookup HammerDB server, based on its private_ip | ||
description: | ||
- "Lookup HammerDB server, based on its private_ip" | ||
options: | ||
_terms: | ||
description: Private IP of the HammerDB server. | ||
required: False | ||
default: | ||
description: hammerdb_server_private_ip of the current node. | ||
""" | ||
|
||
EXAMPLES = """ | ||
- name: Show HammerDB server informations | ||
debug: msg="{{ lookup('hammerdb_server') }}" | ||
""" | ||
|
||
RETURN = """ | ||
_value: | ||
description: | ||
- List of HammerDB server nodes | ||
type: list | ||
elements: | ||
- dict: node_type, hostname, ansible_host (public IP address), private_ip | ||
""" | ||
|
||
from ansible.plugins.lookup import LookupBase | ||
|
||
|
||
class LookupModule(LookupBase): | ||
def run(self, terms, variables=None, **kwargs): | ||
|
||
myvars = getattr(self._templar, '_available_variables', {}) | ||
inventory_hostname = variables['inventory_hostname'] | ||
|
||
# If no terms, we'll used the current HammerDB server private IP | ||
if len(terms) == 0: | ||
if 'hammerdb_server_private_ip' not in myvars['hostvars'][inventory_hostname]: | ||
# hammerdb_server_private_ip not set, return None | ||
return [] | ||
hammerdb_server_private_ip = myvars['hostvars'][inventory_hostname]['hammerdb_server_private_ip'] | ||
else: | ||
hammerdb_server_private_ip = terms[0] | ||
|
||
# If no hammerdbserver found in the inventory file, just return None | ||
if 'hammerdbserver' not in variables['groups']: | ||
return [] | ||
if len(variables['groups']['hammerdbserver']) == 0: | ||
return [] | ||
|
||
# Lookup for hammerdb servers with a matching private_ip | ||
for host in variables['groups']['hammerdbserver']: | ||
hostvars = myvars['hostvars'][host] | ||
|
||
if hostvars['private_ip'] != hammerdb_server_private_ip: | ||
continue | ||
|
||
return [ | ||
dict( | ||
node_type='hammerdbserver', | ||
ansible_host=hostvars['ansible_host'], | ||
hostname=hostvars.get('hostname', hostvars['ansible_hostname']), | ||
private_ip=hostvars['private_ip'], | ||
inventory_hostname=hostvars['inventory_hostname'] | ||
) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# setup_hammerdb | ||
|
||
This role is for installing HammerDB. | ||
|
||
## Requirements | ||
|
||
Following are the requirements of this role. | ||
1. Ansible | ||
2. `edb_devops.edb_postgres` -> `setup_repo` role for setting the repository on | ||
the systems. | ||
|
||
## License | ||
|
||
BSD | ||
|
||
## Author information | ||
|
||
Author: | ||
|
||
* Mark Wong | ||
* EDB Postgres | ||
* [email protected] www.enterprisedb.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
|
||
supported_os: | ||
- CentOS8 | ||
- RHEL8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
galaxy_info: | ||
author: EDB | ||
description: Setup HammerDB | ||
company: "EnterpriseDB" | ||
|
||
license: BSD | ||
|
||
min_ansible_version: 2.8 | ||
|
||
platforms: | ||
- name: CentOS | ||
versions: | ||
- 8 | ||
- name: Red Hat | ||
versions: | ||
- 8 | ||
|
||
galaxy_tags: | ||
- database | ||
|
||
dependencies: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
|
||
- name: Update PostgreSQL parameters for TPROC-C | ||
include_role: | ||
name: manage_dbserver | ||
tasks_from: manage_postgres_params | ||
vars: | ||
pg_postgres_conf_params: | ||
- name: max_connections | ||
value: 300 | ||
- name: shared_buffers | ||
value: "16384MB" | ||
- name: work_mem | ||
value: "64MB" | ||
- name: maintenance_work_mem | ||
value: "620MB" | ||
- name: effective_cache_size | ||
value: "45 GB" | ||
- name: random_page_cost | ||
value: 1.25 | ||
- name: effective_io_concurrency | ||
value: 200 | ||
- name: checkpoint_timeout | ||
value: "15min" | ||
- name: checkpoint_completion_target | ||
value: 0.9 | ||
- name: max_wal_size | ||
value: "30GB" | ||
- name: min_wal_size | ||
value: "10GB" | ||
- name: wal_buffers | ||
value: "512MB" | ||
- name: jit | ||
value: on | ||
no_log: "{{ disable_logging }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
|
||
- name: Include the HBA file update tasks | ||
include_tasks: update_pg_hba.yml | ||
|
||
- name: Include Postgres configuration for TPROC-C | ||
include_tasks: configure_postgres_params.yml | ||
|
||
- name: Include HammerDB installation | ||
include_role: | ||
name: setup_hammerdbserver | ||
tasks_from: install_hammerdb | ||
|
||
- name: Include Touchstone installation | ||
include_role: | ||
name: setup_touchstone | ||
tasks_from: main | ||
|
||
- name: Create TPROC-C loader.tcl | ||
template: | ||
dest: loader.tcl | ||
src: ./templates/loader.tcl.template | ||
mode: 0644 | ||
become: no | ||
|
||
- name: Create TPROC-C load script | ||
template: | ||
src: ./templates/load-tproc-c.template | ||
dest: /usr/local/bin/load-tproc-c | ||
mode: 0755 | ||
become: yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
|
||
- name: Reference pg_type variables | ||
include_vars: "{{ role_path }}/../init_dbserver/vars/{{ pg_type }}.yml" | ||
|
||
- name: Initialize the hba_entries variable | ||
set_fact: | ||
hba_entries: >- | ||
[ | ||
{ | ||
'users': 'all', | ||
'databases': 'all', | ||
'contype': 'host', | ||
'source': '{{ hostvars[inventory_hostname].hammerdb_server_private_ip | default("127.0.0.1") }}/32', | ||
'method': 'trust' | ||
}, | ||
{ | ||
'users': 'all', | ||
'databases': 'all', | ||
'contype': 'host', | ||
'source': '{{ hostvars['primary1'].private_ip | default("127.0.0.1") }}/32', | ||
'method': 'trust' | ||
} | ||
] | ||
- name: Allow access from the hammerdb server | ||
include_role: | ||
name: manage_dbserver | ||
tasks_from: manage_hba_conf | ||
vars: | ||
pg_hba_ip_addresses: "{{ hba_entries }}" | ||
|
||
- name: Reset hba_entries | ||
set_fact: | ||
hba_entries: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
(cd ${HOME}/HammerDB-{{ hammerdb_version }} && \ | ||
./hammerdbcli << ! | ||
source ${HOME}/loader.tcl | ||
! | ||
) | ||
echo "load complete" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env tclsh | ||
global complete | ||
proc wait_to_complete {} { | ||
global complete | ||
set complete [vucomplete] | ||
if {!$complete} {after 5000 wait_to_complete} else { exit } | ||
} | ||
dbset db pg | ||
diset connection pg_host {{ hostvars['primary1'].private_ip }} | ||
diset connection pg_port {{ pg_port }} | ||
diset tpcc pg_count_ware 600 | ||
diset tpcc pg_num_vu {{ ansible_processor_vcpus }} | ||
diset tpcc pg_raiseerror true | ||
diset tpcc pg_superuser postgres | ||
buildschema | ||
wait_to_complete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
|
||
# setup_hammerdbserver | ||
|
||
This role is for setting up a server for [HammerDB](https://hammerdb.com/). | ||
HammerDB is the leading benchmarking and load testing software for the worlds | ||
most popular databases. | ||
|
||
## Requirements | ||
|
||
Following are the requirements of this role. | ||
1. Ansible | ||
2. `edb_devops.edb_postgres` -> `setup_repo` role for setting the repository | ||
on the systems. | ||
|
||
## Role Variables | ||
|
||
The variables that can be configured and are available in the: | ||
|
||
* [roles/setup_hammerdbserver/defaults/main.yml](./defaults/main.yml) | ||
|
||
Below is the documentation of the rest of the main variables: | ||
|
||
### `hammerdb_version` | ||
|
||
The release version of HammerDB. Default: 3.3 | ||
|
||
Example: | ||
```yaml | ||
hammerdb_version: 3.3 | ||
``` | ||
## License | ||
BSD | ||
## Author information | ||
Author: | ||
* Mark Wong | ||
* EDB Postgres | ||
* [email protected] www.enterprisedb.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
|
||
hammerdb_version: 3.3 | ||
supported_os: | ||
- CentOS8 | ||
- RHEL8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
galaxy_info: | ||
author: EDB | ||
description: Setup HammerDB server | ||
company: "EnterpriseDB" | ||
|
||
license: BSD | ||
|
||
min_ansible_version: 2.8 | ||
|
||
platforms: | ||
- name: CentOS | ||
versions: | ||
- 8 | ||
- name: Red Hat | ||
versions: | ||
- 8 | ||
|
||
galaxy_tags: | ||
- database | ||
|
||
dependencies: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
|
||
- name: Download HammerDB | ||
raw: curl -OL https://github.com/TPC-Council/HammerDB/releases/download/v{{ hammerdb_version }}/HammerDB-{{ hammerdb_version }}-Linux.tar.gz | ||
become: no | ||
|
||
- name: Install HammerDB | ||
raw: tar -xvf HammerDB-{{ hammerdb_version }}-Linux.tar.gz | ||
become: no |
Oops, something went wrong.