diff --git a/README.md b/README.md index ea80ec30..3cd332d9 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,36 @@ 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, Ubuntu + +### Dependence + +` yum -y install gcc make readline-devel zlib-devel openssl-devel uuid-devel bison flex` + +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* @@ -36,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). @@ -44,16 +75,26 @@ 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" export LC_ALL=C ``` -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. +2. Disable SELinux and firewall (optinal) + ```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 ``` @@ -64,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 @@ -80,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 ``` @@ -139,7 +180,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 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); /* 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); 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; /* 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; 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);