暂无图片
opengauss单机可以搭建主备吗?怎么搭建? 有没有相关的资料?
我来答
分享
李华
2021-04-08
opengauss单机可以搭建主备吗?怎么搭建? 有没有相关的资料?

opengauss单机可以搭建主备吗?怎么搭建? 有没有相关的资料?

我来答
添加附件
收藏
分享
问题补充
6条回答
默认
最新
llzx373

opengauss 在本地搭建 主、备 集群方法。
先编译安装完。进到bin目录下。

1、先初始化主库。 gs_initdb -D 主库目录 --nodename=节点名字 -w密码
2、修改db_p主库的配置文件。
port = 启主机服务的端口3 (备库端口和主库端口要相隔2个,即主库port=5001,则备库只能从Port=5003开始)
most_available_sync = on;
listen_addresses = ‘0.0.0.0’;
remote_read_mode = ‘non_authentication’
replconninfo1 = ‘localhost=192.168.3.83 localport=主机端口1 localheartbeatport=主机端口2 localservice=启主机服务的端口3 remotehost=192.168.3.83 remoteport=备机端口1 remoteheartbeatport=备机端口2 remoteservice=启备机服务的端口3’
3、修改pg_hba.conf 添加host all all 0.0.0.0/0 sha256

4、生成备库目录。mkdir 备机目录; chmod 700 备机目录
gs_basebackup -D 备机目录 -h 192.168.3.83 -p 5001
5、 再修改replconninfo1(和前文主库端口对应)

6、启动主备库。
./gs_ctl -D 主库目录 -M primary start
./gs_ctl -D 备库目录 -M standby start

暂无图片 评论
暂无图片 有用 0
打赏 0
南方芝麻糊

gs_initdb --pgdata=/opt/gaussdb/data1/ --nodename=node1 --encoding=GBK
gs_initdb: invalid locale settings; check LANG and LC_* environment variables

暂无图片 评论
暂无图片 有用 0
打赏 0
南方芝麻糊

gs_ctl -D /opt/gaussdb/data1/ -M primary start
[2021-04-08 17:31:00.353][39066][][gs_ctl]: gs_ctl started,datadir is /opt/gaussdb/data1
[2021-04-08 17:31:00.405][39066][][gs_ctl]: waiting for server to start…
.0 LOG: [Alarm Module]can not read GAUSS_WARNING_TYPE env.

0 LOG: [Alarm Module]Host Name: node1

0 LOG: [Alarm Module]Host IP: 192.168.1.28

0 LOG: [Alarm Module]Cluster Name: myCluster

0 LOG: [Alarm Module]Invalid data in AlarmItem file! Read alarm English name failed! line: 52

0 WARNING: failed to open feature control file, please check whether it exists: FileName=gaussdb.version, Errno=2, Errmessage=No such file or directory.
0 WARNING: failed to parse feature control file: gaussdb.version.
0 WARNING: Failed to load the product control file, so gaussdb cannot distinguish product version.
0 LOG: Failed to initialze environment for codegen.
0 WARNING: bbox_dump_path is set to /opt/gaussdb/corefile/

2021-04-08 17:31:00.511 [unknown] [unknown] localhost 281458685640720 0 0 [BACKEND] LOG: when starting as multi_standby mode, we couldn’t support data replicaton.
2021-04-08 17:31:00.512 [unknown] [unknown] localhost 281458685640720 0 0 [BACKEND] LOG: [Alarm Module]can not read GAUSS_WARNING_TYPE env.

2021-04-08 17:31:00.512 [unknown] [unknown] localhost 281458685640720 0 0 [BACKEND] LOG: [Alarm Module]Host Name: node1

2021-04-08 17:31:00.512 [unknown] [unknown] localhost 281458685640720 0 0 [BACKEND] LOG: [Alarm Module]Host IP: 192.168.1.28

2021-04-08 17:31:00.512 [unknown] [unknown] localhost 281458685640720 0 0 [BACKEND] LOG: [Alarm Module]Cluster Name: myCluster

2021-04-08 17:31:00.512 [unknown] [unknown] localhost 281458685640720 0 0 [BACKEND] LOG: [Alarm Module]Invalid data in AlarmItem file! Read alarm English name failed! line: 52

2021-04-08 17:31:00.512 [unknown] [unknown] localhost 281458685640720 0 0 [BACKEND] LOG: Transparent encryption disabled.

2021-04-08 17:31:00.513 [unknown] [unknown] localhost 281458685640720 0 0 [BACKEND] LOG: loaded library “security_plugin”
2021-04-08 17:31:00.514 [unknown] [unknown] localhost 281458685640720 0 0 [BACKEND] LOG: InitNuma numaNodeNum: 1 numa_distribute_mode: none inheritThreadPool: 0.
2021-04-08 17:31:00.514 [unknown] [unknown] localhost 281458685640720 0 0 [BACKEND] LOG: reserved memory for backend threads is: 220 MB
2021-04-08 17:31:00.514 [unknown] [unknown] localhost 281458685640720 0 0 [BACKEND] LOG: reserved memory for WAL buffers is: 128 MB
2021-04-08 17:31:00.514 [unknown] [unknown] localhost 281458685640720 0 0 [BACKEND] LOG: Set max backend reserve memory is: 348 MB, max dynamic memory is: 6888 MB
2021-04-08 17:31:00.514 [unknown] [unknown] localhost 281458685640720 0 0 [BACKEND] LOG: shared memory 4539 Mbytes, memory context 7236 Mbytes, max process memory 12288 Mbytes
2021-04-08 17:31:00.636 [unknown] [unknown] localhost 281458685640720 0 0 [CACHE] LOG: set data cache size(402653184)
2021-04-08 17:31:00.677 [unknown] [unknown] localhost 281458685640720 0 0 [CACHE] LOG: set metadata cache size(134217728)
2021-04-08 17:31:00.705 [unknown] [unknown] localhost 281458685640720 0 0 [BACKEND] LOG: gaussdb: fsync file “/opt/gaussdb/data1/gaussdb.state.temp” success
2021-04-08 17:31:00.706 [unknown] [unknown] localhost 281458685640720 0 0 [BACKEND] LOG: create gaussdb state file success: db state(STARTING_STATE), server mode(Primary)
2021-04-08 17:31:00.886 [unknown] [unknown] localhost 281458685640720 0 0 [BACKEND] LOG: max_safe_fds = 979, usable_fds = 1000, already_open = 11
bbox_dump_path is set to /opt/gaussdb/corefile/
2021-04-08 17:31:00.888 [unknown] [unknown] localhost 281458685640720 0 0 [BACKEND] LOG: the configure file /opt/gaussdb/install/app/etc/gscgroup_omm.cfg doesn’t exist or the size of configure file has changed. Please create it by root user!
2021-04-08 17:31:00.888 [unknown] [unknown] localhost 281458685640720 0 0 [BACKEND] LOG: Failed to parse cgroup config file.
[2021-04-08 17:31:01.406][39066][][gs_ctl]: waitpid 39069 failed, exitstatus is 256, ret is 2

[2021-04-08 17:31:01.406][39066][][gs_ctl]: stopped waiting
[2021-04-08 17:31:01.406][39066][][gs_ctl]: could not start server

暂无图片 评论
暂无图片 有用 0
打赏 0
贾军锋

单机主备? 那你这个应该是个人测试使用。
可以使用openGauss的极简安装,参考文章“https://www.modb.pro/db/48894” , 简单方便。

暂无图片 评论
暂无图片 有用 0
打赏 0
南方芝麻糊

sh install.sh -w qcubic@123 -p 15400 --multinode
[step 1]: check parameter
[step 2]: check install env and os setting
[step 3]: change_gausshome_owner
[step 4]: set environment variables

[init primary datanode.]
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 “en_US.UTF-8”.
The default text search configuration will be set to “english”.

fixing permissions on existing directory /home/omm/data/master … ok
creating subdirectories … ok
selecting default max_connections … 10
selecting default shared_buffers … 400kB
creating configuration files … ok
creating template1 database in /home/omm/data/master/base/1 … gs_initdb: removing contents of data directory “/home/omm/data/master”
[init slave datanode.]
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 “en_US.UTF-8”.
The default text search configuration will be set to “english”.

fixing permissions on existing directory /home/omm/data/slave … ok
creating subdirectories … ok
selecting default max_connections … 10
selecting default shared_buffers … 400kB
creating configuration files … ok
creating template1 database in /home/omm/data/slave/base/1 … gs_initdb: removing contents of data directory “/home/omm/data/slave”
[config datanode.]
sed: can’t read /home/omm/data/master/postgresql.conf: No such file or directory
sed: can’t read /home/omm/data/slave/postgresql.conf: No such file or directory
sed: can’t read /home/omm/data/master/postgresql.conf: No such file or directory
sed: can’t read /home/omm/data/slave/postgresql.conf: No such file or directory
sed: can’t read /home/omm/data/master/postgresql.conf: No such file or directory
sed: can’t read /home/omm/data/slave/postgresql.conf: No such file or directory
remote_read_mode = non_authentication
host all all 172.17.0.1/32 trust
[start primary datanode.]
0 LOG: [Alarm Module]can not read GAUSS_WARNING_TYPE env.

0 LOG: [Alarm Module]Host Name: node1

0 LOG: [Alarm Module]Host IP: 192.168.1.28

0 LOG: [Alarm Module]Cluster Name: dbCluster

0 LOG: [Alarm Module]Invalid data in AlarmItem file! Read alarm English name failed! line: 52

0 WARNING: failed to open feature control file, please check whether it exists: FileName=gaussdb.version, Errno=2, Errmessage=No such file or directory.
0 WARNING: failed to parse feature control file: gaussdb.version.
0 WARNING: Failed to load the product control file, so gaussdb cannot distinguish product version.
0 LOG: Failed to initialze environment for codegen.
0 WARNING: bbox_dump_path is set to /opt/gaussdb/corefile/

[2021-04-09 11:48:52.659][71076][][gs_ctl]: gs_ctl started,datadir is /home/omm/data/master
[2021-04-09 11:48:52.711][71076][][gs_ctl]: waiting for server to start…
.0 LOG: [Alarm Module]can not read GAUSS_WARNING_TYPE env.

0 LOG: [Alarm Module]Host Name: node1

0 LOG: [Alarm Module]Host IP: 192.168.1.28

0 LOG: [Alarm Module]Cluster Name: dbCluster

0 LOG: [Alarm Module]Invalid data in AlarmItem file! Read alarm English name failed! line: 52

0 WARNING: failed to open feature control file, please check whether it exists: FileName=gaussdb.version, Errno=2, Errmessage=No such file or directory.
0 WARNING: failed to parse feature control file: gaussdb.version.
0 WARNING: Failed to load the product control file, so gaussdb cannot distinguish product version.
0 LOG: Failed to initialze environment for codegen.
0 WARNING: bbox_dump_path is set to /opt/gaussdb/corefile/

0 [BACKEND] FATAL: “/home/omm/data/master” is not a valid data directory
0 [BACKEND] DETAIL: File “/home/omm/data/master/PG_VERSION” is missing.
[2021-04-09 11:48:53.712][71076][][gs_ctl]: waitpid 71085 failed, exitstatus is 256, ret is 2

[2021-04-09 11:48:53.712][71076][][gs_ctl]: stopped waiting
[2021-04-09 11:48:53.712][71076][][gs_ctl]: could not start server
Examine the log output.
[build and start slave datanode.]
0 LOG: [Alarm Module]can not read GAUSS_WARNING_TYPE env.

0 LOG: [Alarm Module]Host Name: node1

0 LOG: [Alarm Module]Host IP: 192.168.1.28

0 LOG: [Alarm Module]Cluster Name: dbCluster

0 LOG: [Alarm Module]Invalid data in AlarmItem file! Read alarm English name failed! line: 52

0 WARNING: failed to open feature control file, please check whether it exists: FileName=gaussdb.version, Errno=2, Errmessage=No such file or directory.
0 WARNING: failed to parse feature control file: gaussdb.version.
0 WARNING: Failed to load the product control file, so gaussdb cannot distinguish product version.
0 LOG: Failed to initialze environment for codegen.
0 WARNING: bbox_dump_path is set to /opt/gaussdb/corefile/

[2021-04-09 11:48:53.873][71089][][gs_ctl]: gs_ctl full build ,datadir is /home/omm/data/slave
[2021-04-09 11:48:53.873][71089][][gs_ctl]: stop failed, killing gaussdb by force …
[2021-04-09 11:48:53.873][71089][][gs_ctl]: command [ps c -eo pid,euid,cmd | grep gaussdb | grep -v grep | awk ‘{if($2 == curuid && $1!="-n") print “/proc/“1"/cwd"}' curuid=`id -u`| xargs ls -l | awk '{if (NF==”/home/omm/data/slave”) print $(NF-2)}’ | awk -F/ '{print 3 }' | xargs kill -9 >/dev/null 2>&1 ] path: [/home/omm/data/slave] [2021-04-09 11:48:53.893][71089][][gs_ctl]: server stopped [2021-04-09 11:48:53.893][71089][][gs_ctl]: current workdir is (/home/omm/simpleInstall). [2021-04-09 11:48:53.893][71089][][gs_ctl]: fopen build pid file "/home/omm/data/slave/gs_build.pid" success [2021-04-09 11:48:53.893][71089][][gs_ctl]: fprintf build pid file "/home/omm/data/slave/gs_build.pid" success [2021-04-09 11:48:53.894][71089][][gs_ctl]: fsync build pid file "/home/omm/data/slave/gs_build.pid" success [2021-04-09 11:48:53.894][71089][][gs_ctl]: set gaussdb state file when full build:db state(BUILDING_STATE), server mode(STANDBY_MODE), build mode(FULL_BUILD). [2021-04-09 11:48:53.894][71089][][gs_ctl]: invalid value for parameter "replconninfo" in postgresql.conf. import sql file Would you like to create a demo database (yes/no)? yes Load demoDB failed, you can check load.log for more details. [omm@node1 simpleInstall] ore load.log
-bash: ore: command not found
[omm@node1 simpleInstall]$ more load.log
failed to connect Unknown:15400.
failed to connect Unknown:15400.

暂无图片 评论
暂无图片 有用 0
打赏 0
贾军锋

@南方芝麻糊
从您的FATAL错误可以看出来,您的这个环境之前应该是已经安装过openGauss,原先数据目录可能存在手工rm删除的操作,没有使用脚本干净卸载,残留了部分env环境配置信息。
请使用一个干净的环境执行极简版安装操作。

暂无图片 评论
暂无图片 有用 0
打赏 0
回答交流
Markdown


请输入正文
提交
相关推荐
openGauss第一次使用必须要修改用户名密码吗?
回答 1
第一次使用数据库,必须修改omm用户密码,使用如下语句。alterroleommidentifiedby‘新密码’replace‘旧密码’;或者退出数据库。\q关闭密码修改设置。gsgucreload
opengauss 5.0.0 支持使用sqlalchemy连接吗?
回答 5
大佬sqlalchemy连接opengauss5.0可以指导一下方法
Ubuntu系统20.04可以安装opengauss吗?
回答 3
在执行 gsgucreload 命令时,OpenGauss报告它无法找到静态配置文件。这个错误信息提示:“realpath(/usr/local/opengauss/bin/clu
opengauss中omm用户什么无法创建表空间
回答 1
已采纳
先提前把目录创建好 确保omm操作系统用户有权限
请问gaussdb备份的数据库,能否恢复到opengauss数据库中?
回答 1
兼容性情况分析GaussDB和openGauss有一定的相似性,因为它们都有共同的技术渊源,但它们在某些细节上可能存在差异,这会影响数据库备份的恢复。GaussDB是华为的企业级数据库产品,而open
opengauss 的压测,性能如何?
回答 1
参考:2022年4月,ApacheShardingSphere社区公开表示,ApacheShardingSphere与openGauss合作的分布式解决方案在TPCC测试中,使用16台服务器得到了平均
openGgauss目前支持什么操作系统?以后会支持更多其他的什么系统么?
回答 1
已采纳
CentOS7.6、openEuler20.03LTSopenEuler20.03LTS、麒麟V10具体可参加openGauss软硬件规格
有没有复杂的Sample Database可下载?
回答 1
已采纳
可以看看mogila示例库,包括了全文检索,分区表,主外键约束,视图等。地址:https://gitee.com/enmotech/mogila
openGauss 3.1.0版本维护周期0.5年是怎么理解
回答 2
已采纳
openGauss版本号采用点分位命名规则(X.Y.Z)模式,其中X表示架构变更版本,Y表示每年发布版本,Z表示补丁版本。正常每年会发布一个Y版本,重大架构或特性变更,发布一个新的X版本。openGa
openGauss数据库从Oracle全量迁移至MySQL使用的是什么工具?
回答 3
mtk嘎嘎好用