Enable GUI and GSQL HA after upgrading to 3.1

these steps are only necessary for a cluster that has been UPGRADED to 3.1. Clusters with a 3.1 fresh install will have HA enabled by default.

Introduction

Take 3 HA clusters as examples below:

1.Get HA cluster config

gadmin config get Controller.BasicConfig.Nodes[{"HostID":"m1","Partition":0,"Replica":1},{"HostID":"m2","Partition":0,"Replica":2},{"HostID":"m3","Partition":0,"Replica":3}]

2.Set GSQL HA cluster (Use single quote to quote the string)

gadmin config set GSQL.BasicConfig.Nodes '[{"HostID":"m1","Partition":0,"Replica":1},{"HostID":"m2","Partition":0,"Replica":2},{"HostID":"m3","Partition":0,"Replica":3}]'

3.Set GUI HA cluster NOTE: if you would only like to enable GUI HA (and NOT gsql) then only steps 3 and 4 have to be followed

gadmin config set GUI.BasicConfig.Nodes '[{"HostID":"m1","Partition":0,"Replica":1},{"HostID":"m2","Partition":0,"Replica":2},{"HostID":"m3","Partition":0,"Replica":3}]'

4.Apply config and restart services

gadmin config apply -y
gadmin restart all -y

5.Transfer user-defined files and object files

  NEW_APP_ROOT=$(gadmin config get System.AppRoot)
  # change '3.0.5' to specific old version upgrading from
  OLD_APP_ROOT=$NEW_APP_ROOT/../3.0.5
  TMP_ROOT=$(gadmin config get System.TempRoot)
  DATA_ROOT=$(gadmin config get System.DataRoot)
  # copy user-defined files, eg: ExprUtil.hpp
  # Notice: this is equivalent to use "PUT" to upload previous user-defined files
  gscp gsql "$OLD_APP_ROOT/dev/gdk/gsql/src/QueryUdf/*" "$DATA_ROOT/gsql/udf/"
  gscp gsql "$OLD_APP_ROOT/dev/gdk/gsql/src/TokenBank/*" "$DATA_ROOT/gsql/tokenbank/"
  # copy codegen files, eg: myTuple.hpp
  gscp gsql "$TMP_ROOT/gsql/codegen" "$TMP_ROOT/gsql/"

6.Notice all queries still need to re-install since the GPE binary (tg_dbs_gped) is outdated (older version) so we cannot directly copy it. If we run query without re-install, there will be an error:

unknown function error {"data":"%7B%7D","func":"queryDispatcher"}.

Here is the command to re-install queries for all graphs:

  # re-install queries for all
  gsql "use global install query -force all"