From 35caeaa66aa071501a9784133ce5990a3c143815 Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 22 Dec 2015 13:27:42 -0300 Subject: [PATCH] We need to update the repmgr.sql file with the new view and create a repmgr3.0_repmgr3.1.sql for the upgrade process when passing to 3.1 --- repmgr.sql | 9 +++++++++ sql/repmgr3.0_repmgr3.1.sql | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 sql/repmgr3.0_repmgr3.1.sql diff --git a/repmgr.sql b/repmgr.sql index 52f4e58d..e610b2b0 100644 --- a/repmgr.sql +++ b/repmgr.sql @@ -59,3 +59,12 @@ WHERE (standby_node, last_monitor_time) IN (SELECT standby_node, MAX(last_monito ALTER VIEW repl_status OWNER TO repmgr; CREATE INDEX idx_repl_status_sort ON repl_monitor(last_monitor_time, standby_node); + +/* + * This view shows the list of nodes with the information of which one is the upstream + * in each case (when appliable) + */ +CREATE VIEW repl_show_nodes AS +SELECT rn.id, rn.conninfo, rn.type, rn.name, rn.cluster, + rn.priority, rn.active, sq.name AS upstream_node_name +FROM repl_nodes as rn LEFT JOIN repl_nodes AS sq ON sq.id=rn.upstream_node_id; diff --git a/sql/repmgr3.0_repmgr3.1.sql b/sql/repmgr3.0_repmgr3.1.sql new file mode 100644 index 00000000..8608ab85 --- /dev/null +++ b/sql/repmgr3.0_repmgr3.1.sql @@ -0,0 +1,33 @@ +/* + * Update a repmgr 3.0 installation to repmgr 3.1 + * ---------------------------------------------- + * + * 1. Stop any running repmgrd instances + * 2. On the master node, execute the SQL statements listed below, + * taking care to identify the master node and any inactive + * nodes + * 3. Restart repmgrd (being sure to use repmgr 3.1) + */ + +/* + * Set the search path to the name of the schema used by + * your repmgr installation + * (this should be "repmgr_" + the cluster name defined in + * 'repmgr.conf') + */ + +-- SET search_path TO 'name_of_repmgr_schema'; + +BEGIN; + +-- We have this new view which gives the upstream node information when +-- checking on the nodes table + +CREATE VIEW repl_show_nodes AS +SELECT rn.id, rn.conninfo, rn.type, rn.name, rn.cluster, + rn.priority, rn.active, sq.name AS upstream_node_name +FROM repl_nodes as rn LEFT JOIN repl_nodes AS sq ON sq.id=rn.upstream_node_id; + +COMMIT; + +