跳到主要内容

安装参数交互

安装参数交互​

脚本启动后,首先连续提示语言、安装类型、安装路径、数据库角色 4 项;其余交互项(halo 用户、数据目录、归档、兼容模式)在安装步骤推进到对应阶段时逐个出现。本次演示的输入值如下表,每一项的含义见后续小节。

序号交互项演示输入说明
1语言 (cn/en)en选择脚本语言(中文 cn / 英文 en)
2安装类型halodb仅安装数据库(单机场景)
3安装路径(回车)默认 /u01/app/halo
4数据库角色 (m/s)m主库/单机选 m(master)
5创建 halo 用户no用户已存在,跳过重建
6数据目录(回车)默认 /data/halo
7是否配置归档 (yes/no)yes启用归档日志
8归档目录(回车)默认 /data/halo/archivedir
9兼容模式数据库all创建全部兼容模式

安装类型(halodb / etcd / clustermgr / all)​

● Installation Type Description:
► halodb - HaloDB database
► etcd - Key-value database component
► clustermgr - Management component
► all - All components, including halodb, key-value database component, management component
Enter installation type, halodb/etcd/clustermgr/all
halodb
输入值含义
halodb仅安装 Halo 数据库(单机场景选此项)
etcd仅安装 etcd 键值数据库组件
clustermgr仅安装 Clustermgr 管理组件
all安装全部组件(数据库 + etcd + Clustermgr)

注意: 单机部署只需安装数据库本体,输入 halodb 即可。all 用于后续扩展为高可用集群的场景。

安装路径​

Enter HaloDB installation target path:
(直接回车)
Input is empty, using default HaloDB installation path: /u01/app/halo

直接回车使用默认安装路径 /u01/app/halo,也可输入自定义路径。安装类型、安装路径连续提示的实际输出如下:

● Installation Type Description:
► halodb - HaloDB database
► etcd - Key-value database component
► clustermgr - Management component
► all - All components, including halodb, key-value database component, management component
Enter installation type, halodb/etcd/clustermgr/all
halodb
Enter HaloDB installation target path:
Input is empty, using default HaloDB installation path: /u01/app/halo

数据库角色(master / slave)​

Enter HaloDB database installation type: Enter m for master, s for slave
m

Installing HaloDB Database Master
输入值含义
m主库(master)。单机实例即为主库模式
s备库(slave),用于流复制从库

注意: 单机部署输入 m。s 仅在搭建主备流复制时用于备库节点。

安装路径 → 数据库角色连续提示的实际输出如下:

Enter HaloDB installation target path:
Input is empty, using default HaloDB installation path: /u01/app/halo
Enter HaloDB database installation type: Enter m for master, s for slave
m

Installing HaloDB Database Master
1. Start installing database dependencies

创建 halo 用户​

脚本首先自动安装数据库依赖(步骤 1),随后进入"创建 halo 用户"步骤(步骤 2)。若 halo 用户已存在,脚本会询问是否删除重建:

1、Start installing database dependencies
Database dependencies installation completed

2、Creating halo user
halouser already exists. Delete user? Enter yes/no, press Enter to skip deletion by default
no
Not deleting userhalo
输入值含义
no保留现有 halo 用户,跳过重建(演示选用,因用户已存在)
yes删除现有用户后重新创建
(回车)默认跳过删除

注意: 若环境中尚未创建 halo 用户,脚本会自动创建,无需此交互。演示服务器已提前创建好 halo 用户,故选择 no 保留。

步骤 1 依赖安装 → 步骤 2 创建 halo 用户 → 步骤 3 数据目录的实际输出如下:

Installing HaloDB Database Master
1. Start installing database dependencies
Database dependencies installation completed
2. Creating halo user
halouser already exists. Delete user? Enter yes/no, press Enter to skip deletion by default
no
Not deleting userhalo
3. Creating database directory
Warning: For cluster database, database directory and archive directory paths must be consistent across all nodes!
Current software installation directory: /u01/app/halo
Enter database directory, press Enter to use default /data/halo

说明: 实际输出中脚本编号步骤用 1. 2. 3.(点号)形式输出,与本节第 4 节步骤列表一致;末行 Not deleting userhalo 为脚本原文输出(user 与 halo 连写)。

数据目录​

3、Creating database directory
Warning: For cluster database, database directory and archive directory paths must be consistent across all nodes!
Current software installation directory: /u01/app/halo
Enter database directory, press Enter to use default /data/halo
(直接回车,使用默认值)
Input is empty, using default value: /data/halo

直接回车使用默认数据目录 /data/halo。步骤 3 之后脚本自动执行 initdb 初始化,实际输出如下:

3. Creating database directory
...
Enter database directory, press Enter to use default /data/halo

5. Initializing halo database
The files belonging to this database system will be owned by user "halo".
...
fixing permissions on existing directory /data/halo ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Asia/Shanghai
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

initdb: warning: enabling "trust" authentication for local connections

Success. You can now start the database server using:
/u01/app/halo/product/dbms/16/bin/pg_ctl -D /data/halo -l logfile start

说明: initdb 实际会打印一条 initdb: warning: enabling "trust" authentication for the local connection 警告(本地连接默认 trust 认证),属正常现象,可后续在 pg_hba.conf 中按需调整认证方式。完整 initdb 输出会持续滚动,此处仅保留关键行。

归档日志配置​

脚本在完成数据库初始化与参数配置后(步骤 7)询问是否启用归档日志,并提示输入归档目录:

7、Configuring archive log
Warning: For cluster database, database directory and archive directory paths must be consistent across all nodes!
Configure archive log? Enter yes/no
yes

Enter database archive directory, press Enter to create in database directory, e.g.:/data/halo
(直接回车,使用默认值)
Input is empty, using default value: /data/halo/archivedir
Creating archive log path
交互项演示输入说明
是否配置归档yes启用归档日志,保障可恢复性
归档目录(回车)默认 /data/halo/archivedir

注意: 生产环境建议启用归档日志(yes),便于基于时间点的恢复(PITR)与增量备份。

步骤 6 配置数据库 → 步骤 7 归档 → 步骤 8 拷贝授权 → 步骤 9 启动 的实际连续输出如下:

6. Configuring halo database
Configuring pg_hba.conf
Configuring postgresql.conf
using default memory parameters
7. Configuring archive log
Warning: For cluster database, database directory and archive directory paths must be consistent across all nodes!
Configure archive log? Enter yes/no
yes

Enter database archive directory, press Enter to create in database directory, e.g.:/data/halo

Input is empty, using default value: /data/halo/archivedir
Creating archive log path
8. Copying license.lic to /u01/app/halo/product/dbms/16
9. Starting halo database
waiting for server to start....2026-06-30 14:51:46.156 CST [16523] LOG: redirecting log output to logging collector process
2026-06-30 14:51:46.156 CST [16523] HINT: Future log output will appear in directory "diag".
done
server started

说明: 实际输出中步骤 8 明确打印授权文件目标路径 Copying license.lic to /u01/app/halo/product/dbms/16;步骤 9 启动数据库时会输出 waiting for server to start... 及日志重定向信息,最终 server started 表示启动成功。