查看ocenabase的冻结、转储、合并?

发布于:2024-10-09 ⋅ 阅读:(4) ⋅ 点赞:(0)

[admin@lnpg ~]$ obclient -h127.0.0.1 -uroot -P2881 -p
Enter password: 
Welcome to the OceanBase.  Commands end with ; or \g.
Your OceanBase connection id is 3221703225
Server version: OceanBase 3.2.4.1 (r101000052023010822-346aa35c32e99d1b82d713f75f0072c45bdf7aab) (Built Jan  8 2023 22:52:43)

Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

obclient [(none)]> \h

General information about OceanBase can be found at
https://www.oceanbase.com

List of all client commands:
Note that all text commands must be first on line and end with ';'
?         (\?) Synonym for `help'.
clear     (\c) Clear the current input statement.
connect   (\r) Reconnect to the server. Optional arguments are db and host.
conn      (\) Reconnect to the server. Optional arguments are db and host.
delimiter (\d) Set statement delimiter.
edit      (\e) Edit command with $EDITOR.
ego       (\G) Send command to OceanBase server, display result vertically.
exit      (\q) Exit mysql. Same as quit.
go        (\g) Send command to OceanBase server.
help      (\h) Display this help.
nopager   (\n) Disable pager, print to stdout.
notee     (\t) Don't write into outfile.
pager     (\P) Set PAGER [to_pager]. Print the query results via PAGER.
print     (\p) Print current command.
prompt    (\R) Change your mysql prompt.
quit      (\q) Quit mysql.
rehash    (\#) Rebuild completion hash.
source    (\.) Execute an SQL script file. Takes a file name as an argument.
status    (\s) Get status information from the server.
system    (\!) Execute a system shell command.
tee       (\T) Set outfile [to_outfile]. Append everything into given outfile.
use       (\u) Use another database. Takes database name as argument.
charset   (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.
warnings  (\W) Show warnings after every statement.
nowarning (\w) Don't show warnings after every statement.

For server side help, type 'help contents'

obclient [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| oceanbase          |
| information_schema |
| mysql              |
| SYS                |
| LBACSYS            |
| ORAAUDITOR         |
| test               |
+--------------------+
7 rows in set (0.042 sec)

obclient [(none)]> select * from __all_virtual_table_mgr where table_type = 0 and is_active = 0 limit 10;
ERROR 1046 (3D000): No database selected
obclient [(none)]> use oceanbase;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
obclient [oceanbase]> select * from __all_virtual_table_mgr where table_type = 0 and is_active = 0 limit 10;
Empty set (0.044 sec)

obclient [oceanbase]> select * from __all_server_event_history where event like "%freeze%";
+----------------------------+-----------------+----------+--------+-------------------------+-----------+--------+-------+--------+-------+--------+-------+--------+-------+--------+-------+--------+------------+
| gmt_create                 | svr_ip          | svr_port | module | event                   | name1     | value1 | name2 | value2 | name3 | value3 | name4 | value4 | name5 | value5 | name6 | value6 | extra_info |
+----------------------------+-----------------+----------+--------+-------------------------+-----------+--------+-------+--------+-------+--------+-------+--------+-------+--------+-------+--------+------------+
| 2024-10-02 02:00:00.882971 | 192.168.207.143 |     2882 | freeze | do minor freeze         | tenant_id | 0      |       | NULL   |       |        |       |        |       |        |       |        |            |
| 2024-10-02 02:00:01.065399 | 192.168.207.143 |     2882 | freeze | do minor freeze success | tenant_id | 0      |       | NULL   |       |        |       |        |       |        |       |        |            |
| 2024-10-03 02:00:00.089953 | 192.168.207.143 |     2882 | freeze | do minor freeze         | tenant_id | 0      |       | NULL   |       |        |       |        |       |        |       |        |            |
| 2024-10-03 02:00:00.274010 | 192.168.207.143 |     2882 | freeze | do minor freeze success | tenant_id | 0      |       | NULL   |       |        |       |        |       |        |       |        |            |
| 2024-10-04 02:00:00.154322 | 192.168.207.143 |     2882 | freeze | do minor freeze         | tenant_id | 0      |       | NULL   |       |        |       |        |       |        |       |        |            |
| 2024-10-04 02:00:00.336579 | 192.168.207.143 |     2882 | freeze | do minor freeze success | tenant_id | 0      |       | NULL   |       |        |       |        |       |        |       |        |            |
| 2024-10-05 02:00:00.334580 | 192.168.207.143 |     2882 | freeze | do minor freeze         | tenant_id | 0      |       | NULL   |       |        |       |        |       |        |       |        |            |
| 2024-10-05 02:00:00.515766 | 192.168.207.143 |     2882 | freeze | do minor freeze success | tenant_id | 0      |       | NULL   |       |        |       |        |       |        |       |        |            |
| 2024-10-06 02:00:00.448825 | 192.168.207.143 |     2882 | freeze | do minor freeze         | tenant_id | 0      |       | NULL   |       |        |       |        |       |        |       |        |            |
| 2024-10-06 02:00:00.631566 | 192.168.207.143 |     2882 | freeze | do minor freeze success | tenant_id | 0      |       | NULL   |       |        |       |        |       |        |       |        |            |
| 2024-10-07 02:00:00.520971 | 192.168.207.143 |     2882 | freeze | do minor freeze         | tenant_id | 0      |       | NULL   |       |        |       |        |       |        |       |        |            |
| 2024-10-07 02:00:00.704124 | 192.168.207.143 |     2882 | freeze | do minor freeze success | tenant_id | 0      |       | NULL   |       |        |       |        |       |        |       |        |            |
| 2024-10-08 02:00:00.596585 | 192.168.207.143 |     2882 | freeze | do minor freeze         | tenant_id | 0      |       | NULL   |       |        |       |        |       |        |       |        |            |
| 2024-10-08 02:00:00.782384 | 192.168.207.143 |     2882 | freeze | do minor freeze success | tenant_id | 0      |       | NULL   |       |        |       |        |       |        |       |        |            |
+----------------------------+-----------------+----------+--------+-------------------------+-----------+--------+-------+--------+-------+--------+-------+--------+-------+--------+-------+--------+------------+
14 rows in set (0.025 sec)

obclient [oceanbase]> SELECT zone,name,date_format(usec_to_time(value),'%Y-%m-%d %H:%i:%S') as value, now(),
    -> timestampdiff(hour,date_format(usec_to_time(value),'%Y-%m-%d %H:%i:%S'),now()) as diff_hour 
    -> FROM __all_zone 
    -> WHERE name='frozen_time';
+------+-------------+---------------------+---------------------+-----------+
| zone | name        | value               | now()               | diff_hour |
+------+-------------+---------------------+---------------------+-----------+
|      | frozen_time | 2024-10-08 02:00:10 | 2024-10-08 10:20:24 |         8 |
+------+-------------+---------------------+---------------------+-----------+
1 row in set (0.003 sec)

obclient [oceanbase]>  select count(*) from __all_virtual_table_mgr where table_type = 0 and is_active=0;
+----------+
| count(*) |
+----------+
|        0 |
+----------+
1 row in set (0.023 sec)

obclient [oceanbase]>  select * from __all_virtual_sys_task_status;
Empty set (0.001 sec)

obclient [oceanbase]> SELECT table_id,partition_id,merge_type,merge_percentage 
    -> FROM __all_virtual_partition_sstable_merge_info 
    -> WHERE partition_id=$partition_id AND table_id=$table_id;
ERROR 1146 (42S02): Table 'oceanbase.__all_virtual_partition_sstable_merge_info' doesn't exist
obclient [oceanbase]>  SELECT * FROM gv$minor_merge_info WHERE finish_time!='';
Empty set (0.006 sec)

obclient [oceanbase]> SELECT * FROM __ALL_ZONE WHERE INFO LIKE '%IDLE%';
+----------------------------+----------------------------+-------+--------------+-------+------+
| gmt_create                 | gmt_modified               | zone  | name         | value | info |
+----------------------------+----------------------------+-------+--------------+-------+------+
| 2024-09-26 11:01:14.090570 | 2024-10-08 02:01:11.007800 |       | merge_status |     0 | IDLE |
| 2024-09-26 11:01:14.090570 | 2024-10-08 02:01:00.963605 | zone1 | merge_status |     0 | IDLE |
+----------------------------+----------------------------+-------+--------------+-------+------+
2 rows in set (0.002 sec)

obclient [oceanbase]> SELECT  zone,
    ->       svr_ip,
    ->       major_version,
    ->       macro_block_count,
    ->       use_old_macro_block_count,
    ->       merge_start_time,
    ->       merge_finish_time,
    ->       merge_process,
    ->       ( merge_finish_time - merge_start_time ) AS cost_time,
    ->       ( macro_block_count - use_old_macro_block_count ) AS merge_macro_block_count,
    ->       ( macro_block_count - use_old_macro_block_count ) / ( merge_finish_time - merge_start_time ) AS avg_per_sec
    -> FROM __all_virtual_partition_sstable_image_info
    -> ORDER BY zone, svr_ip, major_version;
+-------+-----------------+---------------+-------------------+---------------------------+----------------------------+----------------------------+---------------+-----------+-------------------------+-------------+
| zone  | svr_ip          | major_version | macro_block_count | use_old_macro_block_count | merge_start_time           | merge_finish_time          | merge_process | cost_time | merge_macro_block_count | avg_per_sec |
+-------+-----------------+---------------+-------------------+---------------------------+----------------------------+----------------------------+---------------+-----------+-------------------------+-------------+
| zone1 | 192.168.207.143 |            12 |               134 |                       101 | 2024-10-07 02:00:22.040845 | 2024-10-07 02:01:01.765908 |           100 | 79.725063 |                      33 |      0.4139 |
| zone1 | 192.168.207.143 |            13 |               134 |                       101 | 2024-10-08 02:00:21.789304 | 2024-10-08 02:00:50.893256 |            50 | 29.103952 |                      33 |      1.1339 |
+-------+-----------------+---------------+-------------------+---------------------------+----------------------------+----------------------------+---------------+-----------+-------------------------+-------------+
2 rows in set (0.016 sec)

obclient [oceanbase]> select * from __all_virtual_meta_table where data_version != xxx limit 10;
ERROR 1054 (42S22): Unknown column 'xxx' in 'where clause'
obclient [oceanbase]> select * from __all_virtual_meta_table limit 10;
+-----------+------------------+--------------+-----------------+----------+----------------------------+----------------------------+----------+---------+---------------+-------+------+---------------------------------------+-----------+-----------+--------------+---------------+--------------+-----------------+--------------------+--------------------+-------------+---------+--------------+---------------+-----------------------+------------+--------------------+--------+-----------+--------------------+------------------+------------------+
| tenant_id | table_id         | partition_id | svr_ip          | svr_port | gmt_create                 | gmt_modified               | sql_port | unit_id | partition_cnt | zone  | role | member_list                           | row_count | data_size | data_version | data_checksum | row_checksum | column_checksum | is_original_leader | is_previous_leader | create_time | rebuild | replica_type | required_size | status                | is_restore | partition_checksum | quorum | fail_list | recovery_timestamp | memstore_percent | data_file_id     |
+-----------+------------------+--------------+-----------------+----------+----------------------------+----------------------------+----------+---------+---------------+-------+------+---------------------------------------+-----------+-----------+--------------+---------------+--------------+-----------------+--------------------+--------------------+-------------+---------+--------------+---------------+-----------------------+------------+--------------------+--------+-----------+--------------------+------------------+------------------+
|      1001 | 1100611139453777 |            0 | 192.168.207.143 |     2882 | 2024-09-26 11:08:14.244522 | 2024-10-08 02:00:59.215105 |     2881 |    1001 |             0 | zone1 |    1 | 192.168.207.143:2882:1727320094243513 |         1 |       436 |           13 |    1837317129 |            0 |                 |                  0 |   1727320094262738 |           0 |       0 |            0 |       2097152 | REPLICA_STATUS_NORMAL |          0 |                  0 |      1 |           |                  0 |              100 | 1727319898252755 |
|      1001 | 1100611139453778 |            0 | 192.168.207.143 |     2882 | 2024-09-26 11:10:00.296839 | 2024-10-08 02:00:58.914225 |     2881 |    1001 |             0 | zone1 |    1 | 192.168.207.143:2882:1727320200295848 |         1 |       436 |           13 |    1837317129 |            0 |                 |                  0 |   1727320200314050 |           0 |       0 |            0 |       2097152 | REPLICA_STATUS_NORMAL |          0 |                  0 |      1 |           |                  0 |              100 | 1727319898252755 |
+-----------+------------------+--------------+-----------------+----------+----------------------------+----------------------------+----------+---------+---------------+-------+------+---------------------------------------+-----------+-----------+--------------+---------------+--------------+-----------------+--------------------+--------------------+-------------+---------+--------------+---------------+-----------------------+------------+--------------------+--------+-----------+--------------------+------------------+------------------+
2 rows in set (0.004 sec)

obclient [oceanbase]> select data_version from __all_virtual_meta_table limit 10;
+--------------+
| data_version |
+--------------+
|           13 |
|           13 |
+--------------+
2 rows in set (0.005 sec)

obclient [oceanbase]> 

如何查看ocenabase的冻结、转储、合并? | ANBOB