From b07308ed5e17534790d9c91bf4a7b461ee544ac1 Mon Sep 17 00:00:00 2001 From: bartdong Date: Fri, 21 Jul 2023 17:50:39 +0800 Subject: [PATCH 1/7] update dependence --- README.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ea80ec30..7daca6be 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,18 @@ For more information look at our website located at: ## Building +### System Requirements: + +Memory: 4G RAM minimum + +OS: TencentOS 2, TencentOS 3, OpenCloudOS, CentOS 7, CentOS 8 + +### Dependence + +` yum -y install gcc make readline-devel zlib-devel openssl-devel uuid-devel bison flex` + +### Building + ``` cd ${SOURCECODE_PATH} rm -rf ${INSTALL_PATH}/tbase_bin_v2.0 @@ -51,6 +63,15 @@ Use PGXC\_CTL tool to build a cluster, for example: a cluster with a global tran export LC_ALL=C ``` +2. Disable SELinux and firewall (optinal) + + ``` + vi /etc/selinux/config # set SELINUX=disabled + # Disable firewalld + systemctl disable firewalld + systemctl stop firewalld + ``` + 2. Get through the SSH password free login between the machines where the cluster node is installed, and then deploy and init will SSH to the machines of each node. After getting through, you do not need to enter the password. ``` @@ -139,7 +160,7 @@ postgres=# create table foo(id bigint, str text) distribute by shard(id); ## References ``` -https://github.com/Tencent/TBase/wiki/1%E3%80%81TBase_Quick_Start +https://github.com/Tencent/TBase/wiki/1.-TBase_Quick_Start ``` ## License From c6521bd5305750a7fd93b2ad6933bfb9bd036654 Mon Sep 17 00:00:00 2001 From: Bart Date: Thu, 27 Jul 2023 09:30:01 +0800 Subject: [PATCH 2/7] Update pgxcnode.h --- src/include/pgxc/pgxcnode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/pgxc/pgxcnode.h b/src/include/pgxc/pgxcnode.h index 13757e15..c82f4626 100644 --- a/src/include/pgxc/pgxcnode.h +++ b/src/include/pgxc/pgxcnode.h @@ -301,7 +301,7 @@ int pgxc_get_coordinator_proc_pid(void); void pgxc_set_coordinator_proc_vxid(TransactionId proc_vxid); TransactionId pgxc_get_coordinator_proc_vxid(void); PGXCNodeHandle* find_ddl_leader_cn(void); -inline bool is_ddl_leader_cn(char *leader_cn); +bool is_ddl_leader_cn(char *leader_cn); void CheckInvalidateRemoteHandles(void); extern int pgxc_node_send_sessionid(PGXCNodeHandle * handle); extern void SerializeSessionId(Size maxsize, char *start_address); From 0c87b68021800420fd6af2817410dab723bb2040 Mon Sep 17 00:00:00 2001 From: Bart Date: Thu, 27 Jul 2023 09:30:53 +0800 Subject: [PATCH 3/7] Update proxy_main.c --- src/gtm/proxy/proxy_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gtm/proxy/proxy_main.c b/src/gtm/proxy/proxy_main.c index 279471d3..08027d4e 100644 --- a/src/gtm/proxy/proxy_main.c +++ b/src/gtm/proxy/proxy_main.c @@ -131,7 +131,7 @@ int GTMProxyPortNumber; int GTMProxyWorkerThreads; char *GTMProxyDataDir; char *GTMProxyConfigFileName; -char *GTMConfigFileName; +extern char *GTMConfigFileName; char *GTMServerHost; int GTMServerPortNumber; From 675e2d5f73db4a5ab08a7ada19a4301e2b287f3c Mon Sep 17 00:00:00 2001 From: Bart Date: Thu, 27 Jul 2023 09:31:18 +0800 Subject: [PATCH 4/7] Update gtm_proxy_opt.c --- src/gtm/proxy/gtm_proxy_opt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gtm/proxy/gtm_proxy_opt.c b/src/gtm/proxy/gtm_proxy_opt.c index d54fe675..fcad965a 100644 --- a/src/gtm/proxy/gtm_proxy_opt.c +++ b/src/gtm/proxy/gtm_proxy_opt.c @@ -54,7 +54,7 @@ extern int GTMServerPortNumber; extern int GTMProxyWorkerThreads; extern char *GTMProxyDataDir; extern char *GTMProxyConfigFileName; -extern char *GTMConfigFileName; +//extern char *GTMConfigFileName; /* From 4ed922063fddfc55b2fb29a837b1271c7daf07e6 Mon Sep 17 00:00:00 2001 From: Bart Date: Thu, 27 Jul 2023 09:32:21 +0800 Subject: [PATCH 5/7] Update variables.h --- contrib/pgxc_ctl/variables.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/pgxc_ctl/variables.h b/contrib/pgxc_ctl/variables.h index 644b3d06..cef86038 100644 --- a/contrib/pgxc_ctl/variables.h +++ b/contrib/pgxc_ctl/variables.h @@ -44,7 +44,7 @@ typedef struct pgxc_var_hash { } pgxc_var_hash; -pgxc_var_hash var_hash[NUM_HASH_BUCKET]; +extern pgxc_var_hash var_hash[NUM_HASH_BUCKET]; void init_var_hash(void); void add_var_hash(pgxc_ctl_var *var); From 237ccc313660c979b1c989479f92319877a6c971 Mon Sep 17 00:00:00 2001 From: Bart Date: Thu, 27 Jul 2023 09:32:39 +0800 Subject: [PATCH 6/7] Update variables.c --- contrib/pgxc_ctl/variables.c | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/pgxc_ctl/variables.c b/contrib/pgxc_ctl/variables.c index f8bd8917..121f62b8 100644 --- a/contrib/pgxc_ctl/variables.c +++ b/contrib/pgxc_ctl/variables.c @@ -17,6 +17,7 @@ pgxc_ctl_var *var_head = NULL; pgxc_ctl_var *var_tail = NULL; +pgxc_var_hash var_hash[NUM_HASH_BUCKET]; static void clear_var(pgxc_ctl_var *var); /* From 73b371bc93a46d31f43e050defdd2bd37fa37299 Mon Sep 17 00:00:00 2001 From: Bart Date: Mon, 31 Jul 2023 15:22:42 +0800 Subject: [PATCH 7/7] Update README.md --- README.md | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 7daca6be..3cd332d9 100644 --- a/README.md +++ b/README.md @@ -26,15 +26,32 @@ For more information look at our website located at: Memory: 4G RAM minimum -OS: TencentOS 2, TencentOS 3, OpenCloudOS, CentOS 7, CentOS 8 +OS: TencentOS 2, TencentOS 3, OpenCloudOS, CentOS 7, CentOS 8, Ubuntu ### Dependence ` yum -y install gcc make readline-devel zlib-devel openssl-devel uuid-devel bison flex` -### Building +or + +` apt install -y gcc make libreadline-dev zlib1g-dev libssl-dev libossp-uuid-dev bison flex` +### Create User 'tbase' + +```shell +mkdir /data +useradd -d /data/tbase -s /bin/bash -m tbase # add user tbase +passwd tbase # set password ``` + +### Building + +```shell +git clone https://github.com/Tencent/TBase + +export SOURCECODE_PATH=/data/tbase/TBase +export INSTALL_PATH=/data/tbase/install + cd ${SOURCECODE_PATH} rm -rf ${INSTALL_PATH}/tbase_bin_v2.0 chmod +x configure* @@ -48,6 +65,8 @@ make -sj make install ``` +**Notice: if you use Ubuntu and see *initgtm: command not found* while doing "init all", you may add *${INSTALL_PATH}/tbase_bin_v2.0/bin* to */etc/environment*** + ## Installation Use PGXC\_CTL tool to build a cluster, for example: a cluster with a global transaction management node (GTM), a coordinator(COORDINATOR) and two data nodes (DATANODE). @@ -56,7 +75,7 @@ Use PGXC\_CTL tool to build a cluster, for example: a cluster with a global tran 1. Install pgxc and import the path of pgxc installation package into environment variable. - ``` + ```shell PG_HOME=${INSTALL_PATH}/tbase_bin_v2.0 export PATH="$PATH:$PG_HOME/bin" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PG_HOME/lib" @@ -65,16 +84,17 @@ Use PGXC\_CTL tool to build a cluster, for example: a cluster with a global tran 2. Disable SELinux and firewall (optinal) - ``` - vi /etc/selinux/config # set SELINUX=disabled - # Disable firewalld + ```shell + vi /etc/selinux/config # disable SELinux, change SELINUX=enforcing to SELINUX=disabled + # disable firewall, for Ubuntu, change firewalld to ufw systemctl disable firewalld systemctl stop firewalld ``` 2. Get through the SSH password free login between the machines where the cluster node is installed, and then deploy and init will SSH to the machines of each node. After getting through, you do not need to enter the password. - ``` + ```shell + su tbase ssh-keygen -t rsa ssh-copy-id -i ~/.ssh/id_rsa.pub destination-user@destination-server ``` @@ -85,13 +105,13 @@ Use PGXC\_CTL tool to build a cluster, for example: a cluster with a global tran * The pgxcInstallDir at the beginning of the configuration file refers to the installation package location of pgxc. The database user can set it according to his own needs. - ``` + ```shell pgxcInstallDir=${INSTALL_PATH}/tbase_bin_v2.0 ``` * For GTM, you need to configure the node name, IP, port and node directory. - ``` + ```shell #---- GTM ---------- gtmName=gtm gtmMasterServer=xxx.xxx.xxx.1 @@ -101,7 +121,7 @@ Use PGXC\_CTL tool to build a cluster, for example: a cluster with a global tran * If you do not need gtmSlave, you can directly set it to 'n' in the configuration of the corresponding node. - ``` + ```shell gtmSlave=n ```