Comprehensive Overview of Built-in Script Components in the GBase 8s Installation Package
Covers the full database lifecycle management: from environment check → one-click deployment → performance monitoring → data backup → environment uninstallation, 10 scripts + 1 configuration file + 1 readme document, covering five major functional categories. All scripts are located in the PluginPak/ directory after the installation package is extracted.
1. Component Overview
Configuration (root)
init.ini — Parameter configuration file for automated installation
Defines all key parameters such as database instance name, path, port, memory, and character set. The install_init.sh script reads this file first upon execution.
Deployment (root)
install_init.sh — One-click automated installation script
Automates the entire process including software installation, instance initialization, and optimal configuration. Configuration originates from init.ini, and during execution it calls check_env.sh, collector_gbase.sh, and collector_env.sh.
Deployment (root)
check_env.sh — Pre-installation environment check script
Automatically detects system tools, library files, hostname configuration, firewall (firewalld), SELinux, and other software/hardware environments to ensure they meet installation requirements. When library files are missing, it attempts to automatically create soft links to fix the issue.
Monitoring (root)
collector_gbase_tmp_v1.3.sh — Instance information collection script (temporary version)
Similar to collector_gbase.sh, but adds memory allocator information collection items (nbm, rbm, cac, afr, ffr, etc.), with tool paths written statically. Used for specific compatibility scenarios.
Monitoring (root)
collector_env.sh — Post-installation environment information collection script
Collects database deployment environment information (space layout, log configuration, memory segments, network listeners, version, environment variables) and OS static information (kernel parameters, disk partitions, dd read/write tests, etc.) for record-keeping and issue tracing.
Monitoring (gbasedbt)
llog_freq_statis.sh — Logical log switch frequency statistics script
Analyzes message logs, counts logical log switch frequency by date and hour over the past 8 days, outputs a CSV time-series report, and finally appends the complete log status from onstat -l.
Backup (gbasedbt)
auto_bak.sh — Automatic backup script
Performs a level-0 full backup (ontape -s -L 0), backs up key configuration files, generates and executes update_statistics.sh to update statistics, and automatically cleans up historical backups that exceed the retention period.
Cleanup (root)
clean_env.sh — Environment cleanup/uninstall script
Adopts an interactive confirmation mechanism: shut down the instance, uninstall the software, confirm deletion of chunk files (with a second confirmation), confirm deletion of the OS user, and remove the installation directory. Used for reinstalling or completely uninstalling the database environment.
2. Core Configuration File init.ini
init.ini is the parameter hub for automated installation; install_init.sh first reads and parses this file. Configuration items are divided into three categories:
2.1 Basic Database Parameters
USER_OS_PWD — gbasedbt password, must contain digits, uppercase and lowercase letters, and symbols (default GBase@123)
HOMEDIR — Home directory of the user (default /home/gbasedbt)
GBASEDBTSERVER — Instance name, must start with a letter (default gbase01)
IPADDRESS — Listening address (default 0.0.0.0)
PORT — Service port (default 9088)
GBASEDBTDIR — Software installation path (default /opt/gbase8s)
CLIENT_LOCALE — Client locale (default zh_CN.utf8)
DB_LOCALE — Database locale (default zh_CN.utf8)
2.2 Server Efficiency Parameters
SHM_SIZE — Database memory (MB), 0 = 1/4 of available memory, must be ≥ 512
CHUNK_SIZE — Disk space (MB), must be ≥ 5120
CHUNK_DIR — Chunk storage path
CPU_VPS — Number of CPU cores, 0 = logical CPUs minus 1
CHUNK_MAX_SIZE — Maximum chunk size (MB), must be > CHUNK_SIZE
2.3 Special Server Parameters
DB_SERVICE — System service installation option:
0 = Do not install system service
1 = Install but do not enable auto-start on boot
2 = Install and enable auto-start on boot (service gbase8s start|stop|restart|status)
3. Installation and Deployment Scripts
3.1 install_init.sh
install_init.sh is the core engine of the installation package, enabling full-process automation from software installation, instance initialization to optimal configuration for GBase 8s. It requires no input parameters during execution; configuration comes from init.ini.
Execution Phases:
Phase 1: Environment Validation and Parameter Checking
Checks root user, bash interpreter; validates the existence of init.ini, verifies disk space, memory, parameter legality, IP format, port usage, password complexity; automatically invokes check_env.sh
Phase 2: Database Software Installation
Creates gbasedbt user and group; configures sysctl (shmmax, shmall, shmmni, sem, swappiness) and limits.conf (nproc=65536, nofile=1048576); performs silent installation of the database software (with a 30-minute timeout protection); creates chunk directories and proxy files
Phase 3: Instance Initialization and Space Creation
Generates profile, sqlhosts, and onconfig configuration files; adjusts 30+ key parameters (auto-calculating dual buffer pools, CPU VPs, space layout); creates 6 chunk files (rootchk, plogchk, llogchk, tmpchk01, datachk01, sbschk); initializes the instance and creates five spaces: plogdbs, llogdbs, sbsdbs, tmpdbs01, datadbs01; migrates physical logs and logical logs
Phase 4: Service Configuration and Information Summary
Generates systemd service file (sets auto-start as required); creates PluginPak directory and copies auxiliary scripts; invokes collector_gbase.sh and collector_env.sh to collect information; outputs an installation summary report (including JDBC URL)
Phase 5: Cleanup Intermediate Files
Cleans up temporary files or directories generated by the auxiliary database installation process
3.2 check_env.sh
Performs an automated check of the operating system environment before installation to ensure software and hardware conditions meet installation requirements:
System tools — tar, timeout, unzip, id, getent, pwdx, passwd, sleep, netstat; if any are missing, they are listed in a unified error message.
System library files — libnsl.so.1, libaio.so.1, libgcc_s.so.1, etc., supporting x86_64 / aarch64; missing ones are automatically fixed by creating soft links (provided the base shared library files exist)
Java timezone database binary file — tzdb.dat, supporting x86_64 / aarch64; automatically fixed if missing
Hostname — Checks /etc/hosts; if missing, automatically adds 127.0.0.1 mapping
Firewall — Automatically stops and permanently disables firewalld
SELinux — Temporarily sets enforcing to 0 and permanently disables it
3.3 auto_start.sh
Registers GBase 8s as a systemd system service to enable auto-start on boot:
1. Generates /etc/init.d/gbase8s service script (start/stop/restart/status)
2. Generates /etc/systemd/system/gbase8s.service unit file (Restart=on-failure)
3. Reloads systemd configuration and enables auto-start on boot
4. Interactively asks whether to immediately restart the database service for verification
⚠️ Note: This script includes database restart operations; please evaluate whether restarting the database is feasible before use in a production environment.
4. Data Operation Scripts
4.1 dbexport.sh
Exports the complete structure, data, and comments of a specified database, and automatically generates a corresponding import script:
5. O&M Monitoring Scripts
5.1 collector_gbase.sh
Comprehensively collects database instance running status and operating system performance metrics to support fault diagnosis and performance analysis.
Deployment Path: Default script storage path after database installation: $GBASEDBTDIR/PluginPak/inst_ma
Output: Collected data is automatically packaged as stats_yyyymmdd.tar.gz, stored at: $GBASEDBTDIR/PluginPak/collector_gbase
Usage Recommendation: It is recommended to configure a scheduled execution every 5 minutes via crontab
Input Parameters:
Parameter 1 (Retention days for historical collections): Specifies the retention duration of historical collection files; the script automatically cleans up expired files.
Parameter 2 (Configuration file path): Absolute path to the database environment variable configuration file.
Collected Contents:
Database metrics (onstat series): ath(threads), act(active threads), u(sessions), ses(session details), b(buffer), l(logs), d(spaces/chunks), x(transactions/locks), ckp(checkpoints), V(version), pe(page information), glo(global), io(IO details), rwm(read-write locks)
Operating system indicators: netstat(network), iostat(disk IO), vmstat(virtual memory), sar(comprehensive performance), top(processes), df(disk space), uptime(load), ps(processes), ifconfig(network interfaces), dmesg(kernel), ulimit(resource limits)
5.2 collector_gbase_tmp_v1.3.sh
Comprehensively collects database instance running status and operating system performance metrics to support fault diagnosis and performance analysis.
Deployment Path: Default script storage path after database installation: $GBASEDBTDIR/PluginPak/inst_ma
Output: Collected data is automatically packaged as stats_yyyymmddhhmm.tar.gz in the current script directory
Usage Recommendation: It is recommended to configure a scheduled execution every 5 minutes via crontab
Input Parameters:
Parameter 1 (Retention days for historical collections): Specifies the retention duration of historical collection files; the script automatically cleans up expired files.
Parameter 2 (Configuration file path): Absolute path to the database environment variable configuration file.
Collected Contents:
Database metrics (onstat/oncheck series): ath(threads), act(active threads), u(sessions), ses 0(session details), stk(thread stacks), c(configuration), F(page cleaning), k(locks), l(logs), m(message log), b(buffers), p(performance), P(partitions), R(buffer queues), s(locks), t(tables), T(table locks), x(transactions), X(buffers), con(connections), dic(dictionary), glo(global status), iof/iog/ioq/iov/iob(IO details), lmx(locks), mgm(memory management), nsd/nss(network), nta(threads), ppf(page configuration), prc(parameters), sch(scheduling), seg(shared memory), sle(waiting), sts(status), tpf(table configuration), wai(waiting), wmx(wait locks), rwm(read-write locks), ckp(checkpoints), d(spaces/chunks), cfg(parameters), osi(OS information), V(version), opn(open tables), stm(SQL statements), nbm/rbm(messages), cac(cache), laq(log queue), mem(memory), pe(space page info), rea(read/write statistics), tabnames.partnum(table partition info)
Operating system indicators: netstat(network), iostat(disk IO), vmstat(virtual memory), sar(system performance), top(processes), uptime(system load), ps(processes), ifconfig(network interface info), df(disk space), dmesg(kernel log), ulimit(system resource limits)
5.3 collector_env.sh
Collects database deployment environment and OS static information after installation for record-keeping and issue tracing.
Deployment Path: Default script storage path after database installation: $GBASEDBTDIR/PluginPak/inst_ma
Output: Collected data is automatically packaged as env_yyyymmdd.tar.gz, stored at: $GBASEDBTDIR/PluginPak/collector_env
Usage Recommendation: It is recommended to configure a scheduled execution every 5 minutes via crontab
Input Parameters:
Parameter 1 (Retention days for historical collections): Specifies the retention duration of historical collection files; the script automatically cleans up expired files.
Parameter 2 (Configuration file path): Absolute path to the database environment variable configuration file.
Collected Contents:
Database: onstat -d(spaces), -l(logs), -g mem(memory segments), -g seg(VP memory), -g ntt(network listeners), -(server status), -g sync(ER replication), -V(version), -g env(environment variables)
Operating system: ip addr, uname -a, hostname, sysctl -a, firewalld, df -h, free -m, lscpu, fdisk -l, lsblk, lspci, dd read/write tests, ping gateway
5.4 llog_freq_statis.sh
Counts the frequency distribution of logical log switches by date and hour over the past 8 days.
Deployment Path: Default script storage path after database installation: $GBASEDBTDIR/PluginPak/inst_ma
Output: This script only prints results to the screen; you need to manually append them to a CSV file.
Usage Recommendation: Run once per week.
Input Parameters:
Parameter 1 (Configuration file path): Absolute path to the database environment variable configuration file.
Collected Contents:
Database message log (onstat -m), physical logs, logical logs running status, space usage, read/write statistics, etc.
6. Backup Management Scripts
6.1 auto_bak.sh
Performs a level-0 full backup, backs up sqlhosts and onconfig configuration files, generates an auxiliary script to update statistics, and automatically cleans up expired historical backups.
Deployment Path: Default script storage path after database installation: $GBASEDBTDIR/PluginPak/inst_ma
Output: By default, saved under the gbasedbt home directory, generating file backup_YYYYMMDD/HHMMSS.tar.gz
Input Parameters:
Parameter 1 (Retention days): Retention days for historical backups
Parameter 2 (Backup retention path): Optional parameter
7. Environment Cleanup Scripts
7.1 clean_env.sh
Used to safely clean up all related environments when reinstalling or completely uninstalling the database. Adopts an interactive confirmation mechanism to prevent misoperation:
1. Interactively confirms deletion of chunk files (with a second confirmation of directory contents)
2. Interactively confirms deletion of the gbasedbt user and its home directory
3. Deletes the installation directory (with non-empty detection of chunk directory)
4. Deletes the install subdirectory
8. Script Collaboration Relationships
There are clear invocation and collaboration relationships among the scripts, forming a complete closed loop for database lifecycle management:
9. Summary
This script system in the GBase 8s installation package embodies the design philosophy of 'Automation, Standardization, and Traceability':
This set of scripts is not just an installation tool, but a complete database operation and maintenance framework, suitable for development testing, production deployment, troubleshooting, data migration, and various other scenarios, covering the entire database lifecycle management.
This document is compiled based on the script components of the GBase 8s installation package. For any updates, please refer to the latest official version.