Preparations
- Obtain and upload the tsdbtool package to the server, and decompress it to obtain a complete software folder tsdbtool.
- Download GCC-7.3.0 and CMake-3.5.2 source code packages and upload them to the postgresqlDep folder in the tsdbtool folder. For details about the download addresses, see Table 2.
- Obtain the PostgreSQL source package or RPM package and upload it to the tsdbtool directory.
- Modify the installation configuration file postgresqlconf.csv.
Table 1 describes the parameters in the postgresqlconf.csv configuration file.
Table 1 Parameters in the postgresqlconf.csv configuration file Parameter
Description
isopath
Specifies the OS image path, which must be uploaded to the OS of the server in advance for installing some dependencies.
db_password
Specifies the password of the PostgreSQL database. The tool uses this field to set the password of the database.
host
Specifies the server where PostgreSQL is installed. If the installation is performed on the local host, enter localhost. If you need to remotely install PostgreSQL on another server, enter the IP address of the server.
os_root_user
Specifies the root username of the OS on the server where PostgreSQL is installed.
os_root_password
Specifies the password of user root for logging in to the OS of the server where PostgreSQL is installed.
version
Specifies the PostgreSQL version to be installed.
compile_flag
Determines the check process. Set this parameter to 1 for the check before RPM package compilation. Otherwise, set this parameter to 0. The number of check items is small during compilation.
prefixdir
Specifies the absolute path for installing the software after the source code is compiled. The path must exist in the OS. This parameter is invalid and not used for RPM package installation.
datadir
Specifies the absolute path of the PostgreSQL data directory, which must exist in the OS.
waldir
Specifies the absolute path of the PostgreSQL log directory, which must exist in the OS.
shared_buffers
Specifies shared_buffers of PostgreSQL.
This document uses check, install, and uninstall of PostgreSQL 11.3 as examples. Before installing PostgreSQL using tsdbtool:
- Obtain and upload the tool package to the server, and decompress it to the /home directory to obtain the /home/tsdbtool directory.
- Upload the postgresql-11.3.tar.gz source code or RPM package to the /home/tsdbtool directory.
- Download GCC-7.3.0 and CMake-3.5.2 source code packages and upload them to the postgresqlDep folder in the tsdbtool folder. For details about the download addresses, see Table 2.
- Modify the postgresqlconf.csv file, and create datadir, waldir, and prefixdir in the system. (prefixdir is not required if you install PostgreSQL using an RPM package.) Example:
parm,values [install-conf], isopath,/root/CentOS-7-aarch64-Everything-1810.iso db_password,123456 host,localhost os_root_user,root os_root_password,Admin@123 version,11.3 compile_flag,1 [pg-conf], prefixdir,/usr/local/pgsql datadir,/data/pgsql/data waldir,/data/pgsql/log shared_buffers,5GB