-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01_install_couchbase.yml
109 lines (88 loc) · 3.96 KB
/
01_install_couchbase.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
---
- name: Install Couchbase
hosts: all
become_method: sudo
tasks:
- name: upgrade all packages
become: yes
yum:
name: '*'
state: latest
- name: Install dependencies
yum: name={{ item }} state=latest update_cache=yes
become: yes
with_items:
- pkgconfig
- openssl
- name: Download Couchbase Repo definition
become: yes
get_url: dest=/tmp/couchbase-release-1.0-2-x86_64.rpm url=http://packages.couchbase.com/releases/couchbase-release/couchbase-release-1.0-2-x86_64.rpm
- name: Install Couchbase Repo definition
become: yes
yum: name=/tmp/couchbase-release-1.0-2-x86_64.rpm
- name: Instructs the kernel to swap only as a last resort. Set this to 1 if on a kernel version > 3.0 vm.swappiness = 0
become: yes
sysctl: name=vm.swappiness value=1 state=present
- name: Disable THP
become: yes
shell: "{{ item }}"
with_items:
- echo 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' >> /etc/rc.local
- echo 'echo never > /sys/kernel/mm/transparent_hugepage/defrag' >> /etc/rc.local
- echo never > /sys/kernel/mm/transparent_hugepage/enabled
- echo never > /sys/kernel/mm/transparent_hugepage/defrag
- name: Increase frequency of keepalive probes, identifiying and timing out dead connections faster
become: yes
sysctl: name=net.ipv4.tcp_keepalive_intvl value=30 state=present
- name: Enables reuse of TIME-WAIT sockets to reduce the time spent constructing connections. This setting is safe for all Couchbase protocols.
become: yes
sysctl: name=net.ipv4.tcp_tw_reuse value=1 state=present
# The default 20% of total system memory can overwhelm the storage system # once flushed.
- name: Limits the maximum memory used to 200MB before pdflush is involved.
become: yes
sysctl: name=vm.dirty_bytes value=209715200 state=present
- name: The lower threshold for vm.dirty_bytes
become: yes
sysctl: name=vm.dirty_background_bytes value=104857600 state=present
- name: Increases the rate at which data is flushed to disk vm.dirty_writeback_centisecs = 100
become: yes
sysctl: name=vm.dirty_expire_centisecs value=300 state=present
- name: Increases the rate at which data is flushed to disk (2)
become: yes
sysctl: name=vm.dirty_writeback_centisecs value=100 state=present
- name: Increases the max open file handles.
become: yes
sysctl: name=fs.file-max value=500000 state=present
- name: Disables NUMA zone reclaim algorithm. This tends to decrease read latencies.
become: yes
sysctl: name=vm.zone_reclaim_mode value=0 state=present reload=yes
- name: Install Couchbase Server
become: yes
yum: name=couchbase-server state=latest
- name: Start Couchbase Server
become: yes
service: name=couchbase-server state=started
- name: Wait for Couchbase initialization
wait_for: port={{ couchbase_port }} delay=2
- name: Check for numactl installed (but do not install it)
become: yes
yum:
list: numactl
register: numactl_reg
- name: Make data dir... /cbdata
become: yes
file: path={{ data_path }} state=directory owner=couchbase group=couchbase mode=u=rwx,g=rx,o=
# - name: Update init script with numactl (only if numactl is installed)
# become: yes
# replace:
# dest=/etc/init.d/couchbase-server
# regexp='daemon --user couchbase .DAEMON'
# replace='daemon --user couchbase "numactl --interleave=all $DAEMON"'
# when: (numactl_reg.results|length > 1) and (numactl_reg[1].yumstate == 'installed')
#
# - name: Restart Couchbase Server (with numactl)
# become: yes
# service: name=couchbase-server state=restarted
#
# - name: Wait for restarted Couchbase server
# wait_for: port={{ couchbase_port }} delay=2