Parsing the configuration file. Successfully parsed the configuration file. Installing the tools on the local node. Successfully installed the tools on the local node. Setting host ip env Successfully set host ip env. Preparing SSH service. Successfully prepared SSH service. Checking OS software. Successfully check os software. Checking OS version. Successfully checked OS version. Creating cluster's path. Successfully created cluster's path. Set and check OS parameter. Setting OS parameters. Successfully set OS parameters. Warning: Installation environment contains some warning messages. Please get more details by "/home/omm/software/script/gs_checkos -i A -h host-01 --detail". Set and check OS parameter completed. Preparing CRON service. Successfully prepared CRON service. Setting user environmental variables. Successfully set user environmental variables. Setting the dynamic link library. Successfully set the dynamic link library. Setting Core file Successfully set core path. Setting pssh path Successfully set pssh path. Setting Cgroup. Successfully set Cgroup. Set ARM Optimization. No need to set ARM Optimization. Fixing server package owner. Setting finish flag. Successfully set finish flag. Preinstallation succeeded.
Parsing the configuration file. Check preinstall on every node. Successfully checked preinstall on every node. Creating the backup directory. Last time end with Install cluster. Continue this step. Successfully created the backup directory. begin deploy.. Rolling back. Rollback succeeded. Installing the cluster. begin prepare Install Cluster.. Checking the installation environment on all nodes. begin install Cluster.. Installing applications on all nodes. Successfully installed APP. begin init Instance.. encrypt cipher and rand files for database. Please enter password for database: Please repeat for database: begin to create CA cert files The sslcert will be generated in /opt/opengauss/install/app/share/sslcert/om NO cm_server instance, no need to create CA for CM. Non-dss_ssl_enable, no need to create CA for DSS Cluster installation is completed. Configuring. Deleting instances from all nodes. Successfully deleted instances from all nodes. Checking node configuration on all nodes. Initializing instances on all nodes. Updating instance configuration on all nodes. Check consistence of memCheck and coresCheck on database nodes. Successful check consistence of memCheck and coresCheck on all nodes. Configuring pg_hba on all nodes. Configuration is completed. The cluster status is Normal. Successfully started cluster. Successfully installed application. end deploy.. omm@host-01[~]
2.12 状态检查
安装完成后执行gs_om命令检查状态。
omm@host-01[/opt/opengauss/install/app/bin]gs_om -t status --detail [ Cluster State ]
cluster_state : Normal redistributing : No current_az : AZ_ALL
1 host-01 11.11.xx.183 15400 6001 /opt/opengauss/install/data/dn P Primary Normal 2 host-02 11.11.xx.184 15400 6002 /opt/opengauss/install/data/dn S Standby Normal
2.13 备库只读
设置备库只读。
1)如果主备机上的openGauss数据库实例正在运行,请先分别停止主备机上的数据库实例。
2)分别打开主机与备机的postgresql.conf配置文件,找到并将对应参数修改为:
wal_level=hot_standby hot_standby = on hot_standby_feedback = on
revoke all on schema public from public; create user user1 login identified by "passwd1"; grant all privileges on database db1 to user1;
2.15 高可用切换测试
进行主备切换测试,以及主备故障恢复测试。
## 切主操作。
#在备库执行:
omm@host-02[~]gs_om -t status --detail [ Cluster State ]
cluster_state : Normal redistributing : No current_az : AZ_ALL
[ Datanode State ]
node node_ip port instance state ---------------------------------------------------------------------------------------------------------- 1 host-01 11.11.11.183 15400 6001 /opt/opengauss/install/data/dn P Primary Normal 2 host-02 11.11.11.184 15400 6002 /opt/opengauss/install/data/dn S Standby Normal
omm@host-02[~]gs_ctl switchover -D /opt/opengauss/install/data/dn [2023-12-19 23:10:18.450][160831][][gs_ctl]: gs_ctl switchover ,datadir is /opt/opengauss/install/data/dn [2023-12-19 23:10:18.450][160831][][gs_ctl]: switchover term (1) [2023-12-19 23:10:18.456][160831][][gs_ctl]: waiting for server to switchover........ [2023-12-19 23:10:23.493][160831][][gs_ctl]: done [2023-12-19 23:10:23.493][160831][][gs_ctl]: switchover completed (/opt/opengauss/install/data/dn) omm@host-02[~]gs_om -t status --detail [ Cluster State ]
cluster_state : Normal redistributing : No current_az : AZ_ALL
[ Datanode State ]
node node_ip port instance state ---------------------------------------------------------------------------------------------------------- 1 host-01 11.11.11.183 15400 6001 /opt/opengauss/install/data/dn P Standby Normal 2 host-02 11.11.11.184 15400 6002 /opt/opengauss/install/data/dn S Primary Normal
omm@host-02[~]gs_om -t refreshconf ## 一定要更新配置
Generating dynamic configuration file for all nodes. Successfully generated dynamic configuration file.
1 host-01 11.11.11.183 15400 6001 /opt/opengauss/install/data/dn P Primary Normal 2 host-02 11.11.11.184 15400 6002 /opt/opengauss/install/data/dn S Standby Normal omm@host-01[~]
## 失败切换。
# 停掉主库:
omm@host-01[~]gs_om -t status --detail
[ Cluster State ] cluster_state : Unavailable redistributing : No current_az : AZ_ALL [ Datanode State ] node node_ip port instance state
1 host-01 11.11.11.183 15400 6001 /opt/opengauss/install/data/dn P Down Manually stopped 2 host-02 11.11.11.184 15400 6002 /opt/opengauss/install/data/dn S Standby Need repair(Disconnected)
[2023-12-19 23:14:16.444][172210][][gs_ctl]: gs_ctl failover ,datadir is /opt/opengauss/install/data/dn [2023-12-19 23:14:16.444][172210][][gs_ctl]: failover term (1) [2023-12-19 23:14:16.449][172210][][gs_ctl]: waiting for server to failover... .[2023-12-19 23:14:17.460][172210][][gs_ctl]: done [2023-12-19 23:14:17.460][172210][][gs_ctl]: failover completed (/opt/opengauss/install/data/dn)
omm@host-02[~]gs_om -t status --detail
[ Cluster State ] cluster_state : Degraded redistributing : No current_az : AZ_ALL [ Datanode State ] node node_ip port instance state ---------------------------------------------------------------------------------------------------------- 1 host-01 11.11.11.183 15400 6001 /opt/opengauss/install/data/dn P Down Manually stopped 2 host-02 11.11.11.184 15400 6002 /opt/opengauss/install/data/dn S Primary Normal omm@host-02[~]
[2023-12-19 23:15:14.417][314811][][gs_ctl]: gs_ctl started,datadir is /opt/opengauss/install/data/dn [2023-12-19 23:15:14.441][314811][][gs_ctl]: waiting for server to start... .0 LOG: [Alarm Module]can not read GAUSS_WARNING_TYPE env. [2023-12-19 23:15:15.448][314811][][gs_ctl]: server started (/opt/opengauss/install/data/dn) omm@host-01[~]gs_om -t status --detail [ Cluster State ]
cluster_state : Degraded redistributing : No current_az : AZ_ALL
[ Datanode State ]
node node_ip port instance state ---------------------------------------------------------------------------------------------------------- 1 host-01 11.11.11.183 15400 6001 /opt/opengauss/install/data/dn P Standby Need repair(WAL) 2 host-02 11.11.11.184 15400 6002 /opt/opengauss/install/data/dn S Primary Normal
[ Cluster State ] cluster_state : Normal redistributing : No current_az : AZ_ALL
[ Datanode State ]
node node_ip port instance state ---------------------------------------------------------------------------------------------------------- 1 host-01 11.11.11.183 15400 6001 /opt/opengauss/install/data/dn P Standby Normal 2 host-02 11.11.11.184 15400 6002 /opt/opengauss/install/data/dn S Primary Normal
gs_guc reload -N all -I all -c "password_encryption_type=1" gs_guc reload -N all -I all -c "password_reuse_max=3" gs_guc reload -N all -I all -c "enable_memory_limit=on" gs_guc reload -N all -I all -c "work_mem=512MB" gs_guc reload -N all -I all -c "maintenance_work_mem=512MB" gs_guc reload -N all -I all -c "bulk_read_ring_size=512MB" gs_guc reload -N all -I all -c "bulk_write_ring_size=512MB" ? gs_guc reload -N host-01 -D /opt/opengauss/install/data/dn -c "max_process_memory=16GB" gs_guc reload -N host-02 -D /opt/opengauss/install/data/dn -c "max_process_memory=8GB" gs_guc reload -N host-02 -D /opt/opengauss/install/data/dn -c "work_mem=1GB" gs_guc reload -N host-01 -D /opt/opengauss/install/data/dn -c "shared_buffers=10GB" gs_guc reload -N host-02 -D /opt/opengauss/install/data/dn -c "shared_buffers=4GB"
omm@host-01[~]gs_om -t restart #重启生效
Stopping cluster.
=========================================
Successfully stopped cluster.
=========================================
End stop cluster.
Starting cluster.
=========================================
[SUCCESS] host-01
2023-12-20 10:38:08.725 65825390.1 [unknown] 139684122632128 [unknown] 0 dn_6001_6002 01000 0 [BACKEND] WARNING: could not create any HA TCP/IP sockets
[SUCCESS] host-02
2023-12-20 10:38:12.216 65825394.1 [unknown] 139862630883264 [unknown] 0 dn_6001_6002 01000 0 [BACKEND] WARNING: could not create any HA TCP/IP sockets
[GAUSS-51400] : Failed to execute the command: python3 '/opt/opengauss/install/om/script/local/CheckPreInstall.py' -U omm -t preinstall. Result:{'host-01': 'Failure', 'host-02': 'Success'}.
Error:
[FAILURE] host-01:
[SUCCESS] host-02:
Successfully checked GAUSS_ENV.
需要手工执行验证互信,包括本机和远端,两节点一样操作:
omm@host-01[~]python3 '/opt/opengauss/install/om/script/local/CheckPreInstall.py' -U omm -t preinstall Successfully checked GAUSS_ENV. omm@host-01[~]ssh host-01 date The authenticity of host 'host-01 (11.11.11.183)' can't be established. ECDSA key fingerprint is SHA256:ei10qMITbfPdLiU7EJ1WdJZfzCPcj/6U60ckhXQKfO8. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added 'host-01,11.11.11.183' (ECDSA) to the list of known hosts.
Authorized users only. All activities may be monitored and reported. Mon Dec 18 14:45:33 CST 2023 omm@host-01[~]ssh host-01 date Authorized users only. All activities may be monitored and reported. Mon Dec 18 14:45:35 CST 2023 omm@host-01[~]ssh host-02 date
ora2pg -t TABLE -a T1,T2,T3 -c /etc/ora2pg/ora2pg.conf
root@host-01[/etc/ora2pg]ora2pg -t TABLE -a T1,T2,T3 -c /etc/ora2pg/ora2pg.conf [========================>] 12/12 tables (100.0%) end of scanning. Retrieving table partitioning information... [========================>] 12/12 tables (100.0%) end of table export.
##存储过程处理 P1,P2,P3A root@host-01[/home/omm/ora2pg/dir1]sh export_schema.sh [========================>] 685/685 tables (100.0%) end of scanning. [========================>] 13/13 objects types (100.0%) end of objects auditing. Running: ora2pg -p -t TABLE -a T1,T2,T3 -o table.sql -b ./schema/tables -c ./config/ora2pg.conf
[========================>] 12/12 tables (100.0%) end of scanning. Retrieving table partitioning information... [========================>] 12/12 tables (100.0%) end of table export. Running: ora2pg -p -t PROCEDURE -a P1,P2,P3 A -o procedure.sql -b ./schema/procedures -c ./config/ora2pg.conf
[========================>] 8/8 procedures (100.0%) end of procedures export. Running: ora2pg -t PROCEDURE -a P1,P2,P3 A -o procedure.sql -b ./sources/procedures -c ./config/ora2pg.conf [========================>] 8/8 procedures (100.0%) end of procedures export.
##上面定义转换完成后,可以在目标端执行。
To extract data use the following command: ora2pg -t COPY -a T1,T2,T3 -o data.sql -b ./data -c ./config/ora2pg.conf sh import_all.sh -d db1 -o user1 -w xxxx -p 15400 -h 127.0.0.1 -f ora2pg -p -t TABLE -a T1,T2,T3 -o tales2.sql -b ./schema/tables -c ./config/ora2pg.conf
In file included from Pg.xs:14:0: Pg.h:35:10: fatal error: libpq-fe.h: No such file or directory #include "libpq-fe.h" ^~~~~~~~~~~~ compilation terminated. make: *** [Makefile:359: Pg.o] Error 1
omm@host-01[~]ora2pg --help Can't locate JSON.pm in @INC (you may need to install the JSON module) (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at /usr/local/share/perl5/Ora2Pg.pm line 41. BEGIN failed--compilation aborted at /usr/local/share/perl5/Ora2Pg.pm line 41. Compilation failed in require at /usr/local/bin/ora2pg line 27. BEGIN failed--compilation aborted at /usr/local/bin/ora2pg line 27. omm@host-01[~]timed out waiting for input: auto-logout JSON-4.10]perl Makefile.PL JSON-4.10]make && make install