gbase导入sql文件_GBase数据库——常用命令
1數據庫操作與維護
1.1數據庫啟停
[root@OMMB-66-V10-001 ~]# service gcware stop
Stopping GCMonit success!
Signaling GCRECOVER (gcrecover) to terminate: [ OK ]
Waiting for gcrecover services to unload:.....[ OK ]
Signaling GCSYNC (gc_sync_server) to terminate: [ OK ]
Waiting for gc_sync_server services to unload:.[ OK ]
Signaling GCLUSTERD to terminate: [ OK ]
Waiting for gclusterd services to unload:.........[ OK ]
Signaling GBASED to terminate: [ OK ]
Waiting for gbased services to unload:^[[A.........[ OK ]
Signaling GCWARE (gcware) to terminate: [ OK ]
Waiting for gcware services to unload:.[ OK ]
[root@OMMB-66-V10-001 ~]# service gcware start
Starting GCWARE (gcwexec): [ OK ]
Starting GCMonit success!
Starting GBASED : [ OK ]
Starting GCLUSTERD : [ OK ]
Starting GCSYNC : [ OK ]
Starting GCRECOVER : [ OK ]
[root@OMMB-66-V10-001 ~]# service gcware restart
1.2集群狀態查詢
[root@zdc3 zdcapp3]# gcadmin
CLUSTER STATE: ACTIVE
CLUSTER MODE: NORMAL
===============================================================
| GBASE COORDINATOR CLUSTER INFORMATION |
===============================================================
| NodeName | IpAddress |gcware |gcluster |DataState |
---------------------------------------------------------------
| coordinator1 | 192.168.250.250 | OPEN | OPEN | 0 |
---------------------------------------------------------------
| coordinator2 | 192.168.250.251 | OPEN | OPEN | 0 |
---------------------------------------------------------------
| coordinator3 | 192.168.250.252 | OPEN | OPEN | 0 |
---------------------------------------------------------------
===========================================================
| GBASE DATA CLUSTER INFORMATION |
===========================================================
|NodeName | IpAddress |gnode |syncserver |DataState |
-----------------------------------------------------------
| node1 | 192.168.250.250 | OPEN | OPEN | 0 |
-----------------------------------------------------------
| node2 | 192.168.250.251 | OPEN | OPEN | 0 |
-----------------------------------------------------------
| node3 | 192.168.250.252 | OPEN | OPEN | 0 |
-----------------------------------------------------------
1.3進程狀態查詢
[root@zdc2 gbase]# service gcware status
corosync (pid 3157) is running...
gclusterd (pid 3966) is running...
gcrecover (pid 4194) is running...
gbased (pid 3271) is running...
gc_sync_server (pid 3920) is running...
1.4GBase進程名
GBase協調節點/Coordinator node:
gcluster進程名 : gclusterd
gcware進程名 : corosync
自動回復進程名 : gcrecover
GBase數據節點/Data node
gnode進程名 : gbased
syncserver進程名 : gcsync
監控工具 : gcmonit / gcmmonit
2.數據庫訪問、信息查詢
2.1命令行方式訪問數據庫
root、gbase用戶本地訪問
[root@zdc2 installGBase_v14.1]# gccli
GBase client 8.6.2.20-R1.84277. Copyright (c) 2004-2017, GBase. All Rights Reserved.
gbase>
非本地訪問
[gbase@zdc2 ~]$ gccli -ugbase -pgbase20110531 -P5258 -h10.92.250.252
GBase client 8.6.2.20-R1.84277. Copyright (c) 2004-2017, GBase. All Rights Reserved.
gbase>
如果需要直接訪問gnode,查詢gnode相關內容,請使用gncli命令
直接執行sql
gccli -ugbase -ppassword -P5258 -h10.92.250.252 -vvv
2.2查詢數據庫節點,副本情況
gbase> show nodes;
+------------+-----------------+-------+--------------+----------------+--------+-----------+
| Id | ip | name | primary part | duplicate part | status | datastate |
+------------+-----------------+-------+--------------+----------------+--------+-----------+
| 4210731200 | 192.168.250.250 | node1 | n1 | n3 | online | 0 |
| 4227508416 | 192.168.250.251 | node2 | n2 | n1 | online | 0 |
| 4244285632 | 192.168.250.252 | node3 | n3 | n2 | online | 0 |
+------------+-----------------+-------+--------------+----------------+--------+-----------+
3 rows in set (Elapsed: 00:00:00.01)
2.3數據庫版本查詢
gbase> select @@version;
+-------------------+
| @@version |
+-------------------+
| 8.6.2.20-R1.84277 |
+-------------------+
1 row in set (Elapsed: 00:00:00.01)
2.4數據庫參數查詢與設置
gbase> show variables like ‘%heap%‘;
+---------------------------+-----------+
| Variable_name | Value |
+---------------------------+-----------+
| _gbase_enable_system_heap | OFF |
| gbase_heap_data | 536870912 |
| gbase_heap_large | 268435456 |
| gbase_heap_temp | 268435456 |
| max_heap_table_size | 16777216 |
+---------------------------+-----------+
5 rows in set (Elapsed: 00:00:00.00)
gbase> set global gcluster_max_conn_in_pool=301; 全局參數
Query OK, 0 rows affected (Elapsed: 00:00:00.08)
SET [GLOBAL | SESSION] = value
丼例:開啟本節點的trace日志,默認是設置session 變量。
SET gbase_sql_trace =on;
2.5加載數據文件
load data infile ‘ftp://gbase:gbase@disp_server//opt/1.txt,ftp://gbase:gbase@disp_server//opt/2.txt‘ into table test.tablename data_format 3 fields terminated by ‘#‘ table_fields ‘FIELD1,FIELD2,FIELD3‘ datetime format ‘%Y-%m-%d %H:%i:%S‘
文件名中的#要用%23代替。
2.6常用的show語句
show databases;
--查看系統中數據庫名的語句(根據權限顯示)
show tables;
--列出給定數據庫的所有非臨時表
desc test.t;
--查看test庫t表的列信息
show index from test.t;
--查看test庫t表的索引信息
show create table test.t;
--查看test的建庫語句
showcreateprocedurep_demo;
--查看創建存儲過程的語句
顯示警告或錯誤信息:
SHOW WARNINGS; --顯示由最后一個語句產生的錯誤,警告和注意信息。
SHOW ERRORS; --顯示由最后一個語句產生的錯誤信息。
顯示集群中節點信息:
SHOW NODES; --如果有SUPER 權限,可以看到所有節點信息。
SHOW LOCAL NODE; --顯示集群中客戶端正在訪問節點的信息。
3.數據庫故障定位
3.1查看錯誤日志
[root@zdc2 gbase]# gcadmin showddlevent 查看DDL語句錯誤日志
Event count:0
[root@zdc2 gbase]# gcadmin showdmlevent 查看DML語句錯誤日志
Event count:0
[root@zdc2 gbase]# gcadmin showdmlstorageevent 查看表數據損壞日志
Event count:0
3.2查看數據庫鎖情況
[root@zdc2 gbase]# gcadmin showlock
+===============================================+
| GCLUSTER LOCK |
+===============================================+
+---------+-----+-------+-----------+------+----+
|Lock name|owner|content|create time|orphan|type|
+---------+-----+-------+-----------+------+----+
Total : 0
Lock name | owner | content | create time | orphan | type
庫名.表名 |節點IP |鎖的備注 | 上鎖時間 |是否孤兒鎖|鎖類型(S/E)
gbase> show processlist; 查看當前正在執行的gbase進程,如果有上鎖的語句的話會打出語句
+-------+-----------------+-----------------------+---------+---------+-------+-----------------------------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+-------+-----------------+-----------------------+---------+---------+-------+-----------------------------+------------------+
| 1 | event_scheduler | localhost | NULL | Daemon | 35728 | Waiting for next activation | NULL |
| 46247 | root | 192.168.250.250:58468 | dap_etl | Sleep | 1 | | NULL |
| 47119 | root | 192.168.250.250:9318 | dap_etl | Sleep | 27 | | NULL |
| 47196 | root | 127.0.0.1:6824 | NULL | Query | 0 | NULL | show processlist |
+-------+-----------------+-----------------------+---------+---------+-------+-----------------------------+------------------+
4 rows in set (Elapsed: 00:00:00.00)
總結
以上是生活随笔為你收集整理的gbase导入sql文件_GBase数据库——常用命令的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 对C++库链接的认识
- 下一篇: 买基金如何开户