Saturday, April 20, 2024

Getting memory usage of a query in Tigergraph DB

a) Get the request id from RESTPP log file or from Admin UI under running queries.

In the restpp log directory.

$ grep -i "requestinfo" RESTPP#1.INFO | grep -v "__INTERNAL_API__"

I0418 13:11:58.809935 1828010 handler.cpp:569] RequestInfo|,16777217.RESTPP_1_1.1713445918809.N,NNN,0,0,0,0,S|user:tigergraph|api:v2|function:queryDispatcher|graph_name:bypramod|libudf:libudf_bypramod_1

I0418 13:23:12.551373 1828012 handler.cpp:569] RequestInfo|,16842762.RESTPP_1_1.1713446592551.N,NNN,0,0,0,0,S|user:tigergraph|api:v2|function:queryDispatcher|graph_name:bypramod|libudf:libudf_bypramod_1

Here, one of the request id is "1713445918809"

b) Getting how much memory being used by each running query.
$ grun_p all "grep -ai '<request_id>' $(gadmin config get System.LogRoot)/gpe/log.INFO | grep -i "querymem""


$ grun_p all "grep -ai '1713445918809' $(gadmin config get System.LogRoot)/gpe/log.INFO | grep -i "querymem""
***

Saturday, April 6, 2024

Extract Tigergraph DB's backup files with "tg_infr_goblin"

 Open the desired backup folder and use below commands to extract the archive.

Tested on Tigergraph DB 3.9.3-2

$ cd /tigergraph/backup/full_backup_20240131/

$(gadmin config get System.AppRoot --file ~/.tg.cfg)/bin/tg_infr_goblin archive extract --archive=GPE_1_1.tgdat --dest=GPE_1_1


*** 

 

Wednesday, April 3, 2024

Installation of 3 node cluster of TigerGraph DB on Oracle Linux 7

Step 1: Provision 3 nodes of Oracle Linux 7

Step 2: Install pre-requisite OS packages.

$ sudo yum install tar curl cronie iproute util-linux-ng net-tools nc coreutils openssh-clients openssh-server sshpass jq

Note: If a package is not found, try resolving by installing manually. In my case sshpass  is not found with yum install, so downloaded package from official repositories.

$ wget https://yum.oracle.com/repo/OracleLinux/OL7/openstack30/x86_64/getPackage/sshpass-1.05-5.el7.x86_64.rpm

$ sudo rpm -ivh sshpass-1.05-5.el7.x86_64.rpm

Step 3: Create "tigergraph" user

$ sudo useradd tigergraph
$ sudo passwd tigergraph

Note: You might need to add the tigergraph user to "Allowuser" in "/etc/ssh/sshd_config" and reboot/restart sshd.

Example: 

## AllowUsers OLD-USER NEW-USER

AllowUsers pramod user2 user3 tigergraph

Step 4: Download official Tigergraph DB package to desired location.

$ wget https://dl.tigergraph.com/enterprise-edition/tigergraph-3.9.2-1-offline.tar.gz

Step 5: Make sure the mount for logs, data, kafka, etc to be owned by "tigergraph" user and corresponding group.

Example:

$ ls -ld /tigergraph/kafka
drwxr-x--- tigergraph tigergraph /tigergraph/kafka

Step 6: Add "tigergraph" to sudoers file.

# visudo
tigergraph          ALL=(ALL) ALL

Step 7: Make configuration changes.

Example:

$ cd /tigergraph-3.9.3-3-offline
$ cat install_conf.json
{
  "BasicConfig": {
    "TigerGraph": {
      "Username": "tigergraph",
      "[comment]":"Provide password for tigergraph user, if the user already exists, we won't change the password. If the password is empty, we will set it to default value 'tigergraph'.",
      "[comment]": "TigerGraph does not support passwords with special characters such as '$'. Please change your password if it contains such special characters.",
      "Password": "tigergraph",
      "SSHPort": 22,
      "[comment]":"(Optional)Provide valid private key file below to replace tigergraph.rsa and tigergraph.pub, which will be generated by default.",
      "PrivateKeyFile": "",
      "PublicKeyFile": ""
    },
    "RootDir": {
      "AppRoot": "/tigergraph_tmp/app",
      "DataRoot": "/tigergraph_tmp/data",
      "LogRoot": "/tigergraph_tmp/log",
      "TempRoot": "/tigergraph_tmp/tmp"
    },
    "License": "Replace_With_Trial_Or_Official_License_Key_String",
    "[comment]":"You can add more nodes by string 'node_id: IP', appending to the following json array. Otherwise, it installs single node locally by default.",
    "NodeList": [
      "m1: 1.10.18.15",
      "m2: 1.10.14.7",
      "m3: 1.10.14.3"
    ]
  },
  "AdvancedConfig": {
    "[comment]": "Keep the default ClusterConfig if installing locally",
    "ClusterConfig": {
      "[comment]": "All nodes must have the same login configurations",
      "LoginConfig": {
        "SudoUser": "tigergraph",
        "[comment]": "choose login method: 'P' for SSH using password or 'K' for SSH using key file (e.g. ec2_key.pem)",
        "[comment]": "TigerGraph does not support passwords with special characters such as '$'. Please change your password if it contains such special characters.",
        "Method": "P",
        "P": "sudoUserPassword",
        "K": "/path/to/my_key.pem_rsa"
      },
      "[comment]": "To install a high-availability cluster, please specify the ReplicationFactor greater than 1",
      "ReplicationFactor": 1
    }
  }
}

Step 8: Install as "root" user

Note: If tried with "tigergraph" or other user it might fail at port check etc.

# sudo ./install.sh -n

Step 9: Validate

As "tigergraph" user

$ gadmin status -v

***


SFTP error:


In logs check for statement "The SFTP tool is missing. TG requires SFTP to be properly installed."

Then check if sftp is setup correctly setup or installed.

$ sudo grep -P '^\s*Subsystem\s+sftp' /etc/ssh/sshd_config

if no output, then it indicates that the sftp is not enabled.

Edit /etc/ssh/sshd_config and add below line

Subsystem sftp /usr/libexec/openssh/sftp-server

to it, then restart sshd 

# systemctl restart sshd

Then try install again.

***