Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2ca5564

Browse files
committed
Fetching logs improved, adding nodes done.
1 parent 39a29ab commit 2ca5564

File tree

4 files changed

+45
-2
lines changed

4 files changed

+45
-2
lines changed

devops/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
*.retry
22
inventory/manual
3+
logs/
34

45
/postgresql.conf.common
56
/postgresql.conf.lord

devops/init.yml

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
---
44
- hosts: nodes
5-
65
environment:
76
PATH: "{{ pg_dst }}/bin:{{ ansible_env.PATH }}"
87

@@ -31,10 +30,19 @@
3130
tags:
3231
- initdb
3332

33+
- name: enable blind trust
34+
lineinfile:
35+
dest: "{{pg_datadir}}/pg_hba.conf"
36+
line: "{{item}}"
37+
state: present
38+
with_items:
39+
- "host all all 0.0.0.0/0 trust"
40+
- "host replication all 0.0.0.0/0 trust"
41+
- "local replication all trust"
42+
3443
- import_playbook: send_config.yml
3544

3645
- hosts: nodes
37-
3846
environment:
3947
PATH: "{{ pg_dst }}/bin:{{ ansible_env.PATH }}"
4048

@@ -43,3 +51,24 @@
4351
command: psql -p {{ pg_port }} -c "create extension pg_shardman cascade;"
4452
tags:
4553
- create_ext
54+
55+
- hosts: shardlord
56+
environment:
57+
PATH: "{{ pg_dst }}/bin:{{ ansible_env.PATH }}"
58+
59+
tasks:
60+
- name: add ec2 workers
61+
command: >
62+
psql -p {{ pg_port }} -c "select shardman.add_node(
63+
'hostaddr={{ hostvars[item]['ec2_private_ip_address'] }} port={{ pg_port }}')"
64+
with_items: "{{ groups.ec2_workers }}"
65+
tags:
66+
- add_nodes
67+
68+
- name: add manual workers
69+
command: >
70+
psql -p {{ pg_port }} -c "select shardman.add_node(
71+
'hostaddr={{ item]}} port={{ pg_port }}')"
72+
with_items: "{{ groups.manual_workers }}"
73+
tags:
74+
- add_nodes

devops/logs.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@
1414
validate_checksum: no # new logs might constantly arrive
1515
flat: yes
1616

17+
- name: touch logs/united.log
18+
local_action: copy content="" dest=logs/united.log
19+
run_once: true
20+
21+
- name: unite logs
22+
local_action: shell cat logs/{{ item }}.log >> logs/united.log
23+
with_items: "{{ groups.nodes }}"
24+
run_once: true
25+
1726
- hosts: shardlord
1827

1928
tasks:

devops/readme.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ ansible-playbook -i inventory_ec2 pg_ctl.yml -e "pg_ctl_action=restart"
5252
Read cmd log on shardlord:
5353
ansible-playbook -i inventory_ec2/ psql.yml --limit 'shardlord' -e "cmd='\'table shardman.cmd_log\''"
5454

55+
Gather logs to ./logs:
56+
ansible-playbook -i inventory_ec2/ logs.yml
57+
5558
Ubuntu images EC2 locator:
5659
https://cloud-images.ubuntu.com/locator/ec2/
5760
We need ami-4199282e.
@@ -67,3 +70,4 @@ Things that made me wonder during writing this:
6770
* No way to specify multiple inventory files, only whole directory or one file.
6871
* No way to append file to file, except for j2 templates, which doesn't work
6972
with files outside the template dir, really?
73+
* Writing yml files makes me nervous.

0 commit comments

Comments
 (0)