zoukankan      html  css  js  c++  java
  • 基于华为云 EulerOS 2.8 的 GaussDB T 全新HA主备搭建(1P1S)

    环境

    主备库 云环境规格 操作系统 主机名 IP地址 端口号
    主库 4vCPUs 8G EulerOS 2.8 64bit with ARM THR102-0001 192.168.0.164 1888
    备库 4vCPUs 8G EulerOS 2.8 64bit with ARM THR102-0002 192.168.0.231 1888

    主备机分别完成以下操作

    • 创建用户及用户组
    groupadd dbgrp
    useradd -g dbgrp -d /home/omm -m -s /bin/bash omm
    
    • 修改OMM用户密码
    passwd omm
    
    • 创建软件目录
    mkdir -p /opt/software/gaussdb
    
    • 进入目录并上传软件
    GaussDB_T_1.0.2-EULER20SP8-ARM-64bit.tar.gz
    

    主机操作

    • 解压软件
    [root@thr102-0001 ~]# cd /opt/software/gaussdb/
    [root@thr102-0001 gaussdb]# ls
    GaussDB_T_1.0.2-EULER20SP8-ARM-64bit.tar.gz
    [root@thr102-0001 gaussdb]# tar -zxvf GaussDB_T_1.0.2-EULER20SP8-ARM-64bit.tar.gz
    
    • 解压数据库
    [root@thr102-0001 gaussdb]# tar -zxvf GaussDB_T_1.0.2-DATABASE-EULER20SP8-64bit.tar.gz
    
    • 进入目录执行安装
    [root@thr102-0001 gaussdb]# cd GaussDB_T_1.0.2-DATABASE-EULER20SP8-64bit/
    [root@thr102-0001 GaussDB_T_1.0.2-DATABASE-EULER20SP8-64bit]# python install.py -U omm:dbgrp -R /opt/gaussdb/app -D /opt/gaussdb/data -C LSNR_ADDR=127.0.0.1,192.168.0.164 -C LSNR_PORT=1888 -C REPL_PORT=1889 -C "LOG_ARCHIVE_DEST_2=SERVICE=192.168.0.231:1889 SYNC"
    # 输出信息
    Checking runner.
    Checking parameters.
    End check parameters.
    Checking user.
    End check user.
    Checking old install.
    End check old install.
    Checking kernel parameters.
    Checking directory.
    Checking integrality of run file...
    Decompressing run file.
    Setting user env.
    Checking data dir and config file
    Initialize db instance.
    Creating database.
    Creating database succeed.
    Changing file permission due to security audit.
    Install successfully, for more detail information see /home/omm/zengineinstall.log.
    
    • 登录数据库查询主机角色
    [root@thr102-0001 GaussDB_T_1.0.2-DATABASE-EULER20SP8-64bit]# cd
    [root@thr102-0001 ~]# su - omm
    Last login: Mon Mar 23 18:44:52 CST 2020
    [omm@thr102-0001 ~]$ zsql / as sysdba -q
    
    connected.
    
    SQL> select database_role from dv_database;
    
    DATABASE_ROLE                 
    ------------------------------
    PRIMARY                       
    
    1 rows fetched.
    

    备机操作

    • 解压软件
    [root@thr102-0002 ~]# cd /opt/software/gaussdb/
    [root@thr102-0002 gaussdb]# ls
    GaussDB_T_1.0.2-EULER20SP8-ARM-64bit.tar.gz
    [root@thr102-0002 gaussdb]# tar -zxvf GaussDB_T_1.0.2-EULER20SP8-ARM-64bit.tar.gz 
    
    • 解压数据库
    [root@thr102-0002 gaussdb]# tar -zxvf GaussDB_T_1.0.2-DATABASE-EULER20SP8-64bit.tar.gz
    
    • 进入目录执行安装
    [root@thr102-0002 gaussdb]# cd GaussDB_T_1.0.2-DATABASE-EULER20SP8-64bit/
    [root@thr102-0002 GaussDB_T_1.0.2-DATABASE-EULER20SP8-64bit]# python install.py -U omm:dbgrp -R /opt/gaussdb/app -D /opt/gaussdb/data -C LSNR_ADDR=127.0.0.1,192.168.0.231 -C LSNR_PORT=1888 -C REPL_PORT=1889 -C "LOG_ARCHIVE_DEST_2=SERVICE=192.168.0.164:1889 SYNC" -O
    # 输出信息
    Checking runner.
    Checking parameters.
    End check parameters.
    Checking user.
    End check user.
    Checking old install.
    End check old install.
    Checking kernel parameters.
    Checking directory.
    Checking integrality of run file...
    Decompressing run file.
    Setting user env.
    Checking data dir and config file
    Initialize db instance.
    Changing file permission due to security audit.
    Install successfully, for more detail information see /home/omm/zengineinstall.log.
    
    • 执行脚本
    [root@thr102-0002 GaussDB_T_1.0.2-DATABASE-EULER20SP8-64bit]# su - omm
    [omm@thr102-0002 ~]$ cd /opt/gaussdb/app/bin/
    [omm@thr102-0002 bin]$ python zctl.py -t build
    # 输出信息
    Check if incremental build is available ...
    Begin to shutdown database ...
    Done
    
    Begin to clear data and log ...
    Done
    
    Begin to startup instance nomount ...
    Done
    
    Is incremental build: False
    Begin to build database ...
    Done
    
    Successfully build database
    
    • 登录数据库查询备机角色
    [omm@thr102-0002 bin]$ zsql / as sysdba -q
    
    connected.
    
    SQL> select database_role from dv_database;
    
    DATABASE_ROLE                 
    ------------------------------
    PHYSICAL_STANDBY              
    
    1 rows fetched.
    

    同步验证

    • 主库创建测试表插入数据
    SQL> create table henry(id number);
    
    Succeed.
    
    SQL> insert into henry values(1);
    
    1 rows affected.
    
    SQL> commit;
    
    Succeed.
    
    SQL> select * from henry;
    
    ID                                      
    ----------------------------------------
    1                                       
    
    1 rows fetched.
    
    • 备库查询验证
    SQL> select * from henry;
    
    ID                                      
    ----------------------------------------
    1                                       
    
    1 rows fetched.
    
  • 相关阅读:
    Java程序运行机制及开发环境
    Redis源码分析(八)--- t_hash哈希转换
    Redis源码分析(八)--- t_hash哈希转换
    Redis源码分析(八)--- t_hash哈希转换
    Redis源码分析(九)--- t_list,t_string的分析
    Redis源码分析(九)--- t_list,t_string的分析
    Redis源码分析(九)--- t_list,t_string的分析
    Redis源码分析(十)--- testhelp.h小型测试框架和redis-check-aof.c日志检测
    Redis源码分析(十)--- testhelp.h小型测试框架和redis-check-aof.c日志检测
    Redis源码分析(十)--- testhelp.h小型测试框架和redis-check-aof.c日志检测
  • 原文地址:https://www.cnblogs.com/askscuti/p/12553986.html
Copyright © 2011-2022 走看看