返回首页

gbase数据、南大通用产品文档:GBase8sDRIDXAUTO 配置参数

更新日期:2024年09月11日

如果辅助 HDR 服务器检测到一个损坏的索引,则使用 DRIDXAUTO 配置参数来指定主
高可用性数据复制(HDR)服务器是否自动地启动索引复制。
onconfig.std 值
DRIDXAUTO 0

0 = 关
1 = 开
生效
编辑 onconfig 文件并重启数据库服务器之后。
用法
要改变活动的服务器实例的 DRIDXAUTO 配置参数值,请使用 onmode -d idxauto 命令。
您不需要重启服务器实例。 然而,onmode -d idxauto 命令将不修改 onconfig 文件中
DRIDXAUTO 配置参数值。

功能说明
rebalance 默认往最新的distribution 上分布,也可以通过to distributionid 语法往指
定拓扑上分布。在进行分布之前,需要确认gclusterdb.rebalancing_status 中没有该
表的分布记录,
如果有可以使用delete from 语句删除记录,
否则会影响分布命令的
执行。
语法格式
rebalance
[to distribution_id]
rebalance_options:
Table [[vc_name.]database_name.]table_name
| Database [vc_name.]database_name
| instance
表4- 42 参数说明

GBase 8a MPP Cluster 产品手册
4 管理员指南
文档版本953(2022-04-10)
南大通用数据技术股份有限公司
348
参数名称


table
[[vc_name.]database_name.]table_name
将指定表从一个distribution 规则转换为按另
一个distribution 规则进行分布。如果
database_name.table_name 已经分布在新的
distribution(gcadmin showdistribution 命令执
行结果中State 值new 的distribution)上,
rebalance table 操作报错,不会向
gclusterdb.rebalancing_status 中增加rebalance
任务。
database [vc_name.]database_name
批量将指定数据库下的所有表从一个
distribution 规则转换为按另一个distribution









database_name.table_name 已经分布在新的
distribution(gcadmin showdistribution 命令执
行结果中State 值new 的distribution)上,
rebalance table 操作报错,不会向
gclusterdb.rebalancing_status 中增加rebalance
任务。
rebalance
database




gclusterdb.rebalancing_status 的rebalance 任务
数。
instance
批量将指定实例下的所有表从一个
distribution 规则转换为按另一个distribution
规则进行分布。如果
database_name.table_name 已经分布在新的
distribution(gcadmin showdistribution 命令执
行结果中State 值new 的distribution)上,
rebalance table 操作报错,不会向
gclusterdb.rebalancing_status 中增加rebalance
任务。rebalance instance 返回加入
gclusterdb.rebalancing_status 的rebalance 任务
数。
to distribution_id
如果不指定[to distribution_id],
rebalance 操作
会按新的
distribution (即
gcadmin
showdistribution 命令执行结果中State 值new
的distribution)规则进行分布。
如果指定[to distribution_id],
rebalance 操作会
按指定的distribution_id 的distribution 规则进
行分布。
示例
示例1:
gbase> rebalance table testdis;
Query OK, 1 row affected

GBase 8a MPP Cluster 产品手册
4 管理员指南
文档版本953(2022-04-10)
南大通用数据技术股份有限公司
349
gbase> rebalance table testdis to 1;
Query OK, 1 row affected
示例2:
gbase> rebalance database test;
Query OK, 3 rows affected
gbase>
select
index_name,
status,
percentage
from
gclusterdb.rebalancing_status;
+---------------+----------+------------+
| index_name
| status
| percentage |
+---------------+----------+------------+
| test.testrep
| RUNNING
| 0
|
| test.testdis
| STARTING | 0
|
| test.testrand | STARTING | 0
|
+---------------+----------+------------+
3 row in set
gbase>
select
index_name,
status,
percentage
from
gclusterdb.rebalancing_status;
+---------------+-----------+------------+
| index_name
| status
| percentage |
+---------------+-----------+------------+
| test.testrep
| COMPLETED | 100
|
| test.testdis
| RUNNING
| 10
|
| test.testrand | RUNNING
| 90
|
+---------------+-----------+------------+
3 row in set
示例3:
gbase> rebalance instance;
Query OK, 6 rows affected
gbase>
select
index_name,
status,
percentage
from
gclusterdb.rebalancing_status;
+---------------+----------+------------+
| index_name
| status
| percentage |
+---------------+----------+------------+
| test1.t1
| RUNNING
| 0
|
| test.testdis
| STARTING | 0
|
| test.testrand | STARTING | 0
|
| test1.t3
| STARTING | 0
|
| test1.t2
| STARTING | 0
|
| test.testrep
| STARTING | 0
|
+---------------+----------+------------+
6 rows in set

GBase 8a MPP Cluster 产品手册
4 管理员指南
文档版本953(2022-04-10)
南大通用数据技术股份有限公司
350

GBase JDBC 主要类与接口
GBase
JDBC 由具有建立和管理与GBase 数据库连接功能、执行SQL 语句功
能和对结果集进行储存和管理功能的若干功能类组成。
下面是Gbase JDBC 涉及的主要类:

Driver 类 (com.gbase.jdbc.Driver)
当注册驱动的时候或配置软件以使用GBase
JDBC 的时候,应该使用这个类
名。在使用GBase JDBC 8.3.81.x 版本的驱动(jre1.6 及以上版本)时可以省
去注册驱动,由java 虚拟机自动完整驱动注册。
示例:
Class.forName("com.gbase.jdbc.Driver");

DriverManager 类(java.sql.DriverManager)
跟踪可用的驱动程序,在数据库与相应的驱动程序之间建立连接。
在应用服务器外使用JDBC 时,DriverManager 类管理连接的确立。
需要告诉DriverManager 应该与哪个JDBC 驱动进行连接,
最简单的方法就
是使用实现了接口java.sql.Driver 的类的Class.forName()方法。在GBase
JDBC 中,这个类的名字叫做com.gbase.jdbc.Driver。用这种方法,就可以在
连接一个数据库时使用一个外部配置文件来给驱动提供类名和驱动参数。

Connection 接口(com.gbase.jdbc. Connection)
与特定数据库的连接(会话)
。在连接上下文中执行SQL 语句并返回结果。

示例:
Connection
con=DriverManager.getConnection("jdbc:gbase://host:port/dbname ",

GBase 8a 程序员手册JDBC 篇


- 6 -

南大通用数据技术股份有限公司
"user", "password");

Statement 接口(com.gbase.jdbc.Statement)
用于执行SQL 语句并返回结果。

ResultSet 接口(java.sql.ResultSet)
通常由执行SQL 语句来产生。
示例:
Statement st = con.createStatement();
ResultSet rs = st.executeQuery(select c_custkey from customer);