• 南大通用数据库-Gbase-8a-学习-12-Gbase8a常用运维命令(持续更新哈)


    一、测试环境

    名称
    cpuIntel® Core™ i5-1035G1 CPU @ 1.00GHz
    操作系统CentOS Linux release 7.9.2009 (Core)
    内存4G
    逻辑核数3
    Gbase-8a节点1-IP192.168.142.10
    Gbase-8a节点2-IP192.168.142.11
    Gbase-8a数据库版本8.6.2.43-R33.132743

    二、C3安装

    c3这个工具需要各节点免密才可以正常使用,免密步骤大家可以百度一下,这里就不写了,嘿嘿。

    1、安装rpm包

    [root@xdw0 pkg]# rpm -ivh c3-5.1.2-1.noarch.rpm --force
    准备中...                          ################################# [100%]
    正在升级/安装...
       1:c3-5.1.2-1                       ################################# [100%]
    
    • 1
    • 2
    • 3
    • 4

    2、c3.conf

    [gbase@xdw0 ~]$ cat /etc/c3.conf 
    cluster coor {
    	192.168.142.10:127.0.0.1
    	dead remove-index-00
        192.168.142.10
    }
    cluster data {
    	192.168.142.10:127.0.0.1
        dead remove-index-00
        192.168.142.11
        192.168.142.10
    }
    cluster all {
        192.168.142.10:127.0.0.1
        dead remove-index-00
    	192.168.142.11
        192.168.142.10
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18

    三、常用命令

    1、查看集群状态

    [gbase@xdw0 ~]$ gcadmin
    CLUSTER STATE:  ACTIVE
    CLUSTER MODE:   NORMAL
    
    =====================================================================
    |               GBASE COORDINATOR CLUSTER INFORMATION               |
    =====================================================================
    |   NodeName   |       IpAddress       |gcware |gcluster |DataState |
    ---------------------------------------------------------------------
    | coordinator1 |    192.168.142.10     | OPEN  |  OPEN   |    0     |
    ---------------------------------------------------------------------
    =================================================================
    |                GBASE DATA CLUSTER INFORMATION                 |
    =================================================================
    |NodeName |       IpAddress       |gnode |syncserver |DataState |
    -----------------------------------------------------------------
    |  node1  |    192.168.142.10     | OPEN |   OPEN    |    0     |
    -----------------------------------------------------------------
    |  node2  |    192.168.142.11     | OPEN |   OPEN    |    0     |
    -----------------------------------------------------------------
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20

    2、查看各节点执行的sql

    (1)查看管理节点的sql

    [gbase@xdw0 ~]$ cexec coor: 'gccli -uroot -pqwer1234 -e"show full processlist"|grep -iv Sleep' 
    ************************* coor *************************
    --------- 192.168.142.10---------
    Warning: Permanently added '192.168.142.10' (ECDSA) to the list of known hosts.
    Id	Tid	User	Host	db	Command	Time	State	Info
    1	32124	event_scheduler	localhost	NULL	Daemon	30160	Waiting for next activation	NULL
    77	60202	root	localhost	NULL	Query	0	NULL	show full processlist
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    (2)查看数据节点的sql

    [gbase@xdw0 ~]$ cexec data: 'gncli -uroot -pqwer1234 -e"show full processlist"|grep -iv Sleep' 
    ************************* data *************************
    --------- 192.168.142.11---------
    Warning: Permanently added '192.168.142.11' (ECDSA) to the list of known hosts.
    Id	Tid	User	Host	db	Command	Time	State	Info
    150	34537	root	localhost	NULL	Query	0	NULL	show full processlist
    --------- 192.168.142.10---------
    Warning: Permanently added '192.168.142.10' (ECDSA) to the list of known hosts.
    Id	Tid	User	Host	db	Command	Time	State	Info
    59	31544	root	localhost	NULL	Query	0	NULL	show full processlist
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10

    3、查看数据节点最大trace文件

    有时trace文件并不是在当前管理节点生成的(有,但不是完整版),而是在某个数据节点生成的完整版。
    通过大小来判断哪个是最完整的日志。

    cexec data: 'ls -lrt /opt/gnode/log/gbase/*.trc|tail -n1 '
    
    • 1

    4、查看数据分布策略

    (1)方式一

    [gbase@xdw0 ~]$ gcadmin showdistribution 
    
                  Distribution ID: 5 | State: new | Total segment num: 2
    
         Primary Segment Node IP                           Segment ID         Duplicate Segment node IP
    ========================================================================================================================
    |    192.168.142.11                              |       1          |    192.168.142.10                                |
    ------------------------------------------------------------------------------------------------------------------------
    |    192.168.142.10                              |       2          |    192.168.142.11                                |
    ========================================================================================================================
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10

    (2)方式二

    [gbase@xdw0 ~]$ gcadmin showdistribution node
    
    Distribution ID: 5 | State: new | Total segment num: 2
    
    ============================================================================================
    |nodes     |         192.168.142.11                |         192.168.142.10                |
    --------------------------------------------------------------------------------------------
    |primary   |                  1                    |                  2                    |
    |segments  |                                       |                                       |
    --------------------------------------------------------------------------------------------
    |duplicate |                  2                    |                  1                    |
    |segments 1|                                       |                                       |
    ============================================================================================
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13

    (3)JSON方式

    [gbase@xdw0 ~]$ gcadmin showdistribution f
    
    <?xml version='1.0' encoding="utf-8"?>
    <distributions>
    
        <distribution>
            <distribution_id>5</distribution_id>
            <distribution_state>new</distribution_state>
            <total_segment_num>2</total_segment_num>
    
            <segments>
                <segment>
                    <primarynode ip="192.168.142.11"/>
                    <duplicatenodes>
                        <duplicatenode ip="192.168.142.10"/>
                    </duplicatenodes>
                </segment>
    
                <segment>
                    <primarynode ip="192.168.142.10"/>
                    <duplicatenodes>
                        <duplicatenode ip="192.168.142.11"/>
                    </duplicatenodes>
                </segment>
            </segments>
        </distribution>
    
    </distributions>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28

    5、查看集群锁状态

    [gbase@xdw0 ~]$ gcadmin showlock
     +===============================================+
     |                 GCLUSTER LOCK                 |
     +===============================================+
     +---------+-----+-------+-----------+------+----+
     |Lock name|owner|content|create time|orphan|type|
     +---------+-----+-------+-----------+------+----+
     Total : 0
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    6、启停集群(86版本)

    (1)启动

    [root@xdw0 ~]# service gcware start
    Starting GCWARE (gcwexec):                                 [  确定  ]
    Starting GBASED    :                                       [  确定  ]
    Starting GCSYNC :                                          [  确定  ]
    Starting GCLUSTERD :                                       [  确定  ]
    Starting GCRECOVER :                                       [  确定  ]
    Starting GCMonit success!
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    (2)停止

    [root@xdw0 ~]# service gcware stop
    Stopping GCMonit success!
    Signaling GCRECOVER (gcrecover) to terminate:              [  确定  ]
    Waiting for gcrecover services to unload:....              [  确定  ]
    Signaling GCSYNC (gc_sync_server) to terminate:            [  确定  ]
    Waiting for gc_sync_server services to unload:             [  确定  ]
    Signaling GCLUSTERD  to terminate:                         [  确定  ]
    Waiting for gclusterd services to unload:.........         [  确定  ]
    Signaling GBASED  to terminate:                            [  确定  ]
    Waiting for gbased services to unload:....                 [  确定  ]
    Signaling GCWARE (gcware) to terminate:                    [  确定  ]
    Waiting for gcware services to unload:..                   [  确定  ]
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12

    7、查看各节点错误日志

    (1)数据节点

    express.log

    [gbase@xdw0 ~]$ cexec data: 'tail -10 /opt/gnode/log/gbase/express.log|grep ERROR '
    ************************* data *************************
    --------- 192.168.142.11---------
    Warning: Permanently added '192.168.142.11' (ECDSA) to the list of known hosts.
    --------- 192.168.142.10---------
    Warning: Permanently added '192.168.142.10' (ECDSA) to the list of known hosts.
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    system.log

    [gbase@xdw0 ~]$ cexec data: 'tail -1000 /opt/gnode/log/gbase/system.log|grep ERROR '
    ************************* data *************************
    --------- 192.168.142.11---------
    Warning: Permanently added '192.168.142.11' (ECDSA) to the list of known hosts.
    --------- 192.168.142.10---------
    Warning: Permanently added '192.168.142.10' (ECDSA) to the list of known hosts.
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    (2)管理节点

    express.log

    [gbase@xdw0 ~]$ cexec coor: 'tail -10 /opt/gcluster/log/gcluster/express.log|grep ERROR '
    ************************* coor *************************
    --------- 192.168.142.10---------
    Warning: Permanently added '192.168.142.10' (ECDSA) to the list of known hosts.
    2022-08-17 09:00:00.496 [SQLDISP][ERROR][S:2][Q:0]:CAsyncSqlDispatcherArgs have not target node information.
    2022-08-17 09:00:00.496 [SQLDISP][ERROR][S:2][Q:0]:Fail to execute a CEventSqlExecutor.
    2022-08-17 09:00:01.313 [SQLDISP][ERROR][S:10][Q:40]:Query failed, THD(0x5876800) HOST(::ffff:192.168.142.10:5050->8) reason: (GBA-01EX-700) Gbase general error: (gns_host: ::ffff:192.168.142.10) source table and destination table are not same: src:( localhost:gclusterdb.import_audit_log_errors_n1 ) dst:( ::ffff:192.168.142.11:gclusterdb.import_audit_log_errors_n1 ) column type: [1]type: 1, precision: 256, scale: 0, is_lookup: 0, nulls_mode: 2, internal_size: 256, display_size: 64 -- type: 1, precision: 256, scale: 0, is_lookup: 0, nulls_mode: 2, internal_size: 256, display_size: 85 SQL(SELECT * from `gclusterdb`.`import_audit_log_errors_n1` limit 0 target into server (HOST '::ffff:192.168.142.10,::ffff:192.168.142.11',PORT '5050', USER 'root', PASSWORD '',DATABASE 'gclusterdb',TABLE 'import_audit_log_errors_n1',COMMENT 'table_host 0 0 1, scn 917506, gc_check '))
    2022-08-17 09:00:01.457 [INSERT][ERROR][S:10][Q:40]:Commit failed 
    ERROR NO: 1733ERROR DETAIL: (GBA-01EX-700) Gbase general error: (gns_host: ::ffff:192.168.142.10) source table and destination table are not same: src:( localhost:gclusterdb.import_audit_log_errors_n1 ) dst:( ::ffff:192.168.142.11:gclusterdb.import_audit_log_errors_n1 ) column type: [1]type: 1, precision: 256, scale: 0, is_lookup: 0, nulls_mode: 2, internal_size: 256, display_size: 64 -- type: 1, precision: 256, scale: 0, is_lookup: 0, nulls_mode: 2, internal_size: 256, display_size: 85
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    system.log

    [gbase@xdw0 ~]$ cexec coor: 'tail -10 /opt/gcluster/log/gcluster/system.log|grep ERROR '
    ************************* coor *************************
    --------- 192.168.142.10---------
    Warning: Permanently added '192.168.142.10' (ECDSA) to the list of known hosts.
    220817  8:58:26 [ERROR] (GBA-03OT-0003) Failed to get mode of gcluster, having error: GC_AIS_ERR_LIBRARY
    
    • 1
    • 2
    • 3
    • 4
    • 5
  • 相关阅读:
    11月PMP考试延考地区汇总,特别注意!
    Transformer pytorch实现逐行详解
    win10安装sql Server2016与ssms可视化
    Java“牵手”1688商品列表页数据采集+商品价格数据排序,商品销量排序数据,1688API接口采集方法
    ImageJ软件
    尚硅谷–MySQL–基础篇(P1~P95)
    Electron学习——解决npm install electron --save-dev出错/缓慢的问题
    AJAX异步请求解决跨域问题的三种方式
    TiDB 7.4 发版:正式兼容 MySQL 8.0
    Java EE初阶---计算机工作原理
  • 原文地址:https://blog.csdn.net/qq_45111959/article/details/126369627