Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 47 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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*
Expand All @@ -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).

Expand All @@ -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
```
Expand All @@ -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
Expand All @@ -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
```

Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions contrib/pgxc_ctl/variables.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
/*
Expand Down
2 changes: 1 addition & 1 deletion contrib/pgxc_ctl/variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/gtm/proxy/gtm_proxy_opt.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ extern int GTMServerPortNumber;
extern int GTMProxyWorkerThreads;
extern char *GTMProxyDataDir;
extern char *GTMProxyConfigFileName;
extern char *GTMConfigFileName;
//extern char *GTMConfigFileName;


/*
Expand Down
2 changes: 1 addition & 1 deletion src/gtm/proxy/proxy_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ int GTMProxyPortNumber;
int GTMProxyWorkerThreads;
char *GTMProxyDataDir;
char *GTMProxyConfigFileName;
char *GTMConfigFileName;
extern char *GTMConfigFileName;

char *GTMServerHost;
int GTMServerPortNumber;
Expand Down
2 changes: 1 addition & 1 deletion src/include/pgxc/pgxcnode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down