Skip to content

Commit

Permalink
add sysbench test db examplate
Browse files Browse the repository at this point in the history
  • Loading branch information
denglei committed Aug 28, 2014
1 parent 745d4f2 commit 556b793
Show file tree
Hide file tree
Showing 14 changed files with 119 additions and 0 deletions.
1 change: 1 addition & 0 deletions sysbench_install/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
本文介绍使用ansible的playbook功能在centos或者redhat 6系列系统里安装sysbench测试数据库负载情况.
2 changes: 2 additions & 0 deletions sysbench_install/roles/common/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- name: restart ntpd
service: name=ntpd state=restarted
16 changes: 16 additions & 0 deletions sysbench_install/roles/common/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
galaxy_info:
author: Deng Lei
description: Install initializtion Software
license: MIT
min_ansible_version: 1.6
platforms:
- name: CentOS
versions:
- 5
- 6
- name: Ubuntu
versions:
- precise
categories:
- system
dependencies: []
2 changes: 2 additions & 0 deletions sysbench_install/roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- name: Install initializtion require software
shell: yum -y install make cmake bc gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool-ltdl bison libtool vim-enhanced tar wget readline-devel libyaml-devel patch telnet dmidecode
12 changes: 12 additions & 0 deletions sysbench_install/roles/sysbench_delete/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
galaxy_info:
author: Deng Lei
description: Delete Sysbench
license: MIT
min_ansible_version: 1.6
platforms:
- name: CentOS
versions:
- 6
categories:
- Test
dependencies: []
3 changes: 3 additions & 0 deletions sysbench_install/roles/sysbench_delete/tasks/delete.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- name: Delete Sysbench Test Log Dir
shell: rm -rf {{ sysbench_log_dir }}
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6
1 change: 1 addition & 0 deletions sysbench_install/roles/sysbench_delete/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- include: delete.yml
9 changes: 9 additions & 0 deletions sysbench_install/roles/sysbench_delete/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
sysbench_log_dir: /tmp/sysbench_test_log
cpu_max_prime: 20000
num_threads: 64
mutex_loops: 5000
mutex_locks: 1000000
mutex_num: 2048
memory_total_size: 8G
memory_block_size: 8K

12 changes: 12 additions & 0 deletions sysbench_install/roles/sysbench_install/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
galaxy_info:
author: Deng Lei
description: Install Sysbench
license: MIT
min_ansible_version: 1.6
platforms:
- name: CentOS
versions:
- 6
categories:
- Test
dependencies: []
38 changes: 38 additions & 0 deletions sysbench_install/roles/sysbench_install/tasks/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
- name: Install Base Require Software In Redhat Client
yum: name=sysbench state=latest
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6
tags: Only_install_sysbench
- name: Create Sysbench Test Log Dir In Redhat Client
file: dest={{ sysbench_log_dir }} state=directory
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6
tags: Onlytest
- name: Get the current time In Redhat Client
command: date +%Y%m%d%H%M
register: time
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6
tags: Onlytest
- name: Start Sysbench Cpu Test In Redhat Client
shell: sysbench --test=cpu --num-threads=`grep "processor" /proc/cpuinfo | wc -l` --cpu-max-prime={{ cpu_max_prime }} run > {{ sysbench_log_dir }}/sysbench_cputest_{{ ansible_hostname }}-{{ time.stdout }}.log
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6
tags: Onlytest
- name: Start Sysbench Threads Test In Redhat Client
shell: sysbench --test=threads --num-threads={{ num_threads }} run > {{ sysbench_log_dir }}/sysbench_threads_{{ ansible_hostname }}-{{ time.stdout }}.log
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6
tags: Onlytest
- name: Start Sysbench Mutex Test In Redhat Client
shell: sysbench --test=mutex --num-threads={{ num_threads }} --mutex-num={{ mutex_num }} --mutex-locks={{ mutex_locks }} --mutex-loops={{ mutex_loops }} run > {{ sysbench_log_dir }}/sysbench_mutexxx_{{ ansible_hostname }}-{{ time.stdout }}.log
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6
tags: Onlytest
- name: Start Sysbench Memory Test In Redhat Client
shell: sysbench --test=memory --memory-block-size={{ memory_block_size }} --memory-total-size={{ memory_total_size }} --num-threads={{ num_threads }} run > {{ sysbench_log_dir }}/sysbench_memory_{{ ansible_hostname }}-{{ time.stdout }}.log
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6
tags: Onlytest
- name: Copy Sysbench Test Result from Redhat Client
fetch: src={{ sysbench_log_dir }}/{{ item }} dest=/tmp/{{ item }} flat=yes
with_items:
- sysbench_cputest_{{ ansible_hostname }}-{{ time.stdout }}.log
- sysbench_threads_{{ ansible_hostname }}-{{ time.stdout }}.log
- sysbench_mutexxx_{{ ansible_hostname }}-{{ time.stdout }}.log
- sysbench_memory_{{ ansible_hostname }}-{{ time.stdout }}.log
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6
tags: Onlytest
1 change: 1 addition & 0 deletions sysbench_install/roles/sysbench_install/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- include: install.yml
9 changes: 9 additions & 0 deletions sysbench_install/roles/sysbench_install/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
sysbench_log_dir: /tmp/sysbench_test_log
cpu_max_prime: 20000
num_threads: 64
mutex_loops: 5000
mutex_locks: 1000000
mutex_num: 2048
memory_total_size: 8G
memory_block_size: 8K

6 changes: 6 additions & 0 deletions sysbench_install/sysbench_delete.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- hosts: "{{host}}"
remote_user: "{{user}}"
gather_facts: True
roles:
- sysbench_delete
7 changes: 7 additions & 0 deletions sysbench_install/sysbench_install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- hosts: "{{host}}"
remote_user: "{{user}}"
gather_facts: True
roles:
- common
- sysbench_install

0 comments on commit 556b793

Please sign in to comment.