Change tmp/app/data root directory
Introduction
This article explains how to change the default root locations for parts of the TigerGraph application
Instructions
tmp root
To change the tmp root directory interactively use:
gadmin config entry System.TempRoot
To do so non-interactively use:
gadmin config set System.TempRoot /PATH/TO/DIRECTORY
Then run the following commands to apply the config change and restart services:
gadmin config apply -y
gadmin restart all -y
app Root
Note: this can only be done with the application root directories that are created by TigerGraph during the installation process. This can also only be done to move within directories of the same minor version. For example, you can move from 3.1.0 to 3.1.1 but cannot do so between 3.0.5 and 3.1.0.
To change the app root directory interactively use:
gadmin config entry System.AppRoot
To do so non-interactively use:
gadmin config set System.AppRoot /PATH/TO/DIRECTORY
As with the previous change, the config must be applied and services restarted.
gadmin config apply -y
gadmin restart all -y
For example, if you have both TigerGraph versions 3.1.1 and 3.1.0 installed and wish to change from 3.1.1 to 3.1.0 use the following commands:
#will print out /home/tigergraph/tigergraph/app/3.1.1
gadmin config get System.AppRoot
#set the new value
gadmin config set System.AppRoot /home/tigergraph/tigergraph/app/3.1.0
gadmin config apply -y
gadmin restart all -y
data Root
This process involves more steps than the above as the data in this directory also has to be moved.
The following script walks through the process:
#set the new directory you want to use and create it on all nodes in the cluster
NewDir=/PATH/TO/DIRECTORY
grun all "mkdir -p NEW_DIR"
#configure variables for use
OriginDataRoot=$(gadmin config get System.DataRoot)
newDataRoot=$NewDir
gstore_path=$OriginDataRoot/gstore
#convert links from absolute to relative
grun all "symlinks -rc $gstore_path/0/part"
#stop all TG services
gadmin stop all -y
#create a copy of the TigerGraph config
cp -L ~/.tg.cfg ~/.copy.tg.cfg
#make sure the new location exists
grun all "if [[ ! -f $newDataRoot && ! -d $newDataRoot ]]; then echo 'not exists'; else echo 'exists'; fi"
#move data from the old location to the new location on all nodes
grun all "mv $OriginDataRoot $newDataRoot"
#remove the old link and prepare the modified config
rm ~/.tg.cfg
cp -L ~/.copy.tg.cfg ~/.tg.cfg
gadmin config set System.DataRoot $newDataRoot --file ~/.tg.cfg
#start the cluster with the new config and remove the old copy
gadmin init cluster -y --skip-stop
rm ~/.copy.tg.cfg