创建用户环境
# 创建一个新的用户组
sudo groupadd dbgrp
# 创建一个新的用户omm并将其添加到dbgrp组中
sudo useradd -g dbgrp -m omm
# 添加到sudo组中
sudo usermod -aG sudo omm
# 设置用户密码
sudo passwd omm
# 指定默认的shell
sudo usermod -s /bin/bash omm
初始化数据库请使用普通用户执行,这里使用上面创建的omm用户执行
具体编译方式你一定要参考下面分享的文件
链接: https://pan.baidu.com/s/18n5mNgpgPgpIEOSSK0jAXQ?pwd=nzcx
提取码: nzcx
初始化數據庫
切换到omm用户,如果提示没有相关命令,这时候你需要更新/media/user/D/openGauss-server
目录下所有文件的权限即可解决;
设置命令:
chown -R omm:dbgrp /media/user/D/openGauss-server
omm@user-pc:/media/user/D$ gs_initdb -D /media/user/D/datanode/gsdn --nodename=rscnode -w Rsc@1234567
The files belonging to this database system will be owned by user "omm".
This user must also own the server process.
The database cluster will be initialized with locale "zh_CN.UTF-8".
The default database encoding has accordingly been set to "UTF8".
gs_initdb: could not find suitable text search configuration for locale "zh_CN.UTF-8"
The default text search configuration will be set to "simple".
creating directory /media/user/D/datanode/gsdn ... ok
creating subdirectories ... in ordinary occasionok
creating configuration files ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 1024MB
Begin init undo subsystem meta.
[INIT UNDO] Init undo subsystem meta successfully.
creating template1 database in /media/user/D/datanode/gsdn/base/1 ... 2024-08-08 16:18:01.266 [unknown] [unknown] localhost 547903012880 0[0:0#0] [BACKEND] WARNING: macAddr is 38926/613385338, sysidentifier is 2551063695/2222652543, randomNum is 1829043327
ok
initializing pg_authid ... ok
setting password ... ok
initializing dependencies ... ok
loading PL/pgSQL server-side language ... ok
creating system views ... ok
creating performance views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
initialize global configure for bucketmap length ... ok
creating information schema ... ok
loading foreign-data wrapper for distfs access ... ok
loading foreign-data wrapper for log access ... ok
loading hstore extension ... ok
loading security plugin ... ok
update system tables ... ok
creating snapshots catalog ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
freezing database template0 ... ok
freezing database template1 ... ok
freezing database postgres ... ok
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 gs_initdb.
Success. You can now start the database server of single node using:
gaussdb -D /media/user/D/datanode/gsdn --single_node
or
gs_ctl start -D /media/user/D/datanode/gsdn -Z single_node -l logfile
启动服务
gs_ctl start -D /media/user/D/datanode/gsdn
输出如下信息:
[2024-08-08 16:20:43.571][839775][][gs_ctl]: gs_ctl started,datadir is /media/user/D/datanode/gsdn
[2024-08-08 16:20:43.605][839775][][gs_ctl]: waiting for server to start...
.0 LOG: [Alarm Module]can not read GAUSS_WARNING_TYPE env.
0 LOG: [Alarm Mo