Halo数据库单机版快速部署

Halo数据库是杭州易景数通科技有限公司自主研发的一款商业数据库产品,中文名称叫羲和数据库。

通过张震总获得了数据库安装包和license,正好体验一下,据说Halo数据库100%兼容PostgreSQL。

实验环境:Centos 7.9 ARM架构

1. 安装依赖包

由于本地环境编译过PostgreSQL,这里并未安装额外的依赖包,生产环境应该根据官方文档安装相应的依赖包。

内核参数及limits设置等同样需要根据官方文档进行生产调优。

2. 创建用户和组

# groupadd dba -g 1000

# useradd -u 3000 -g dba halo

3. 目录及权限设置

安装文件目录
# mkdir /opt/halo
 
数据目录
# mkdir /opt/data1921
 
# chown halo: {/opt/halo,/opt/data1921}

# chmod 0755 /opt/halo
 
# chmod 0700 /opt/data1921

生产环境还需要规划WAL、归档、LOG目录等。

4. 安装部署

将获取的数据库安装包和license两个文件上传到halo用户家目录下。

使用halo用户进行如下操作:

[halo@centos7arm ~]$ tar zxf halo_14.el7.aarch64.build240418.tar.gz -C /opt/halo/

[halo@centos7arm ~]$ mv license.lic /opt/halo/product/dbms/14

5. 配置环境变量

halo用户家目录配置如下环境变量

vi .bashrc

export HALO_HOME=/opt/halo/product/dbms/14
export LD_LIBRARY_PATH=$HALO_HOME/lib
export PATH=$HALO_HOME/bin:$PATH
export PGDATA=/opt/data1921
export PGPORT=1921
export PGHOST=$PGDATA

再执行source .bashrc让其生效

6. 验证安装版本

[halo@centos7arm ~]$ psql --version
psql (Halo) 1.0.14.11 (240417)

7. 初始化数据目录

初始化操作的确是PG老司机,pg_ctl不仅支持start、stop、reload也可以做init操作!

[halo@centos7arm ~]$ pg_ctl init -D /opt/data1921
The files belonging to this database system will be owned by user "halo".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /opt/data1921 ... 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
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    /opt/halo/product/dbms/14/bin/pg_ctl -D /opt/data1921 -l logfile start

8. 修改数据库参数

为了更安全的使用socket方式访问数据库,需要设置unix_socket_directories参数,通常建议设置为$PGDATA的路径。

unix_socket_directories = '/opt/data1921' 

在postgresql.conf文件末尾加上这个配置

9.启动数据库

前面环境变量已经配置了PGDATA,下面直接使用pg_ctl启动

[halo@centos7arm ~]$ pg_ctl start
waiting for server to start....2024-04-18 08:29:38.131 CST [4557] LOG:  starting 羲和(Halo) 1.0.14.11 (240417) on aarch64-unknown-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit
2024-04-18 08:29:38.132 CST [4557] LOG:  listening on IPv4 address "127.0.0.1", port 1921
2024-04-18 08:29:38.134 CST [4557] LOG:  listening on Unix socket "/opt/data1921/.s.PGSQL.1921"
2024-04-18 08:29:38.135 CST [4558] LOG:  database system was shut down at 2024-04-18 08:22:46 CST
2024-04-18 08:29:38.139 CST [4557] LOG:  database system is ready to accept connections
 done
server started

10.查看实例进程

使用ps f -u postgres查看进程信息如下:

 4557 ?        Ss     0:00 /opt/halo/product/dbms/14/bin/postgres
 4559 ?        Ss     0:00  \_ postgres: checkpointer 
 4560 ?        Ss     0:00  \_ postgres: background writer 
 4561 ?        Ss     0:00  \_ postgres: walwriter 
 4562 ?        Ss     0:00  \_ postgres: autovacuum launcher 
 4563 ?        Ss     0:00  \_ postgres: stats collector 
 4564 ?        Ss     0:00  \_ postgres: logical replication launcher 

11.连接数据库

[halo@centos7arm ~]$ psql
psql (1.0.14.11 (240417))
Type "help" for help.

halo0root=# 

默认的管理库名为halo0root,新建个业务库

create database halo owner halo;

再重新连接

[halo@centos7arm ~]$ psql -U halo halo
psql (1.0.14.11 (240417))
Type "help" for help.

halo=# select version();
         version                                      
                     
-----------------------------------------------------------------------
 羲和(Halo) 1.0.14.11 (240417) on aarch64-unknown-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit
(1 row)

上面可以看到数据库的版本信息,其中14.11为兼容PG的版本号,从server_version参数可以验证。

12.查看用户加密方式

halo=# show password_encryption;
 password_encryption 
---------------------
 scram-sha-256
(1 row)

默认加密方式为scram-sha-256,符合安全预期。

查看pg_authid系统表,发现rolpassword为空,可能是安全增强隐藏了。

13.数据库license

每个db库下可以看到有一个sys模式,视图license_info记录了license的有效期。

halo=# \dv sys.*
          List of relations
 Schema |     Name     | Type | Owner 
--------+--------------+------+-------
 sys    | license_info | view | halo
(1 row)

14.相比PG增加的GUC参数

通过pg_settings视图可以查看halo数据库增加了53个guc参数。

这里简单查看两组参数,兼容MySQL数据库的一组参数:

halo=# \dconfig mysql.*
          List of configuration parameters
               Parameter               |   Value    
---------------------------------------+------------
 mysql.ci_collation                    | on
 mysql.column_name_case_control        | 0
 mysql.customized_case_column_names    | aaabbb
 mysql.explicit_defaults_for_timestamp | off
 mysql.halo_mysql_version              | 5.7.32-log
 mysql.max_allowed_packet              | 512MB
(6 rows)

兼容Oracle数据库的一组参数:

halo=# \dconfig oracle.*
       List of configuration parameters
              Parameter               | Value 
--------------------------------------+-------
 oracle.connectby_orderby             | on
 oracle.connectby_sibling_sort        | on
 oracle._enable_named_placeholder     | off
 oracle._enable_with_function         | on
 oracle._partitonname_backward_compat | on
 oracle.transform_null_string         | on
 oracle.use_datetime_as_date          | on
 oracle.use_numerical_seq             | on
(8 rows)

本文先测试到此,后续有机会再测试这些新增参数的功能。

大家对Halo数据库感兴趣的可以加我微信skypkmoon联系张震总获取安装包及测试证书。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值