Skip to content

Commit 72d16a6

Browse files
committed
provision vagrant cluster
1 parent 2a5f35f commit 72d16a6

File tree

2 files changed

+81
-3
lines changed

2 files changed

+81
-3
lines changed

contrib/mmts/testeaux/Vagrantfile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,20 @@
22
# vi: set ft=ruby :
33

44
Vagrant.configure(2) do |config|
5-
config.vm.box = "ubuntu/ubuntu-15.04-snappy-core-stable"
5+
config.vm.box = "ubuntu/trusty64"
66

7-
5.times do |i|
8-
config.vm.define "n#{i+1}l"
7+
nhosts = 3
8+
9+
nhosts.times do |i|
10+
config.vm.define "node#{i}" do |node|
11+
node.vm.hostname = "node#{i}"
12+
if i == nhosts - 1
13+
node.vm.provision :ansible do |ansible|
14+
ansible.limit = "all"
15+
ansible.playbook = "provision.yml"
16+
end
17+
end
18+
end
919
end
1020

1121
end

contrib/mmts/testeaux/provision.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
3+
- hosts: all
4+
5+
roles:
6+
- role: kelvich.postgres
7+
pg_port: 5432
8+
pg_repo: https://github.com/postgrespro/postgres_cluster.git
9+
pg_version_tag: master
10+
pg_destroy_and_init: true
11+
pg_config_role:
12+
- line: "multimaster.buffer_size = 65536"
13+
14+
tasks:
15+
- name: generate connstrings
16+
set_fact:
17+
connstr: "host={{item}} user={{ansible_ssh_user}} dbname=postgres"
18+
with_items:
19+
groups['all'] | reverse | batch(nnodes | d(3) | int) | first
20+
register: connstrs
21+
22+
- name: make a list
23+
set_fact:
24+
connections: "{{ connstrs.results | map(attribute='ansible_facts.connstr') | join(', ') }}"
25+
26+
- debug: var=hostvars
27+
28+
- debug: var=inventory_hostname
29+
30+
#- debug: var=hostvars[inventory_hostname]
31+
32+
- name: build raftable
33+
shell: "make clean && make -j {{makejobs}} install"
34+
args:
35+
chdir: "{{pg_src}}/contrib/raftable"
36+
37+
- name: build multimaster
38+
shell: "make clean && make -j {{makejobs}} install"
39+
args:
40+
chdir: "{{pg_src}}/contrib/mmts"
41+
42+
- name: enable dtm extension on datanodes
43+
lineinfile:
44+
dest: "{{pg_datadir}}/postgresql.conf"
45+
line: "{{item}}"
46+
state: present
47+
with_items:
48+
- "wal_level = logical"
49+
- "max_wal_senders = 10"
50+
- "wal_sender_timeout = 0"
51+
- "max_replication_slots = 10"
52+
- "max_connections = 200"
53+
- "max_worker_processes = 100"
54+
- "shared_preload_libraries = 'raftable,multimaster'"
55+
- "multimaster.conn_strings = '{{connections}}'"
56+
- "multimaster.node_id = {{ inventory_hostname | regex_replace('([0-9]+)', '\\1') }}"
57+
- "multimaster.buffer_size = 65536"
58+
- "multimaster.queue_size = 1073741824"
59+
- "multimaster.arbiter_port = 5600"
60+
- "multimaster.vacuum_delay = 1"
61+
- "multimaster.workers = 32"
62+
- "multimaster.use_dtm = 1"
63+
64+
- name: restart postgrespro
65+
command: "{{pg_dst}}/bin/pg_ctl restart -w -D {{pg_datadir}} -l {{pg_datadir}}/pg.log"
66+
environment:
67+
LD_LIBRARY_PATH: "{{pg_dst}}/lib/"
68+

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy