返回首页

gbase数据、南大通用产品文档:GBase8aGCmmonit 基本配置

更新日期:2024年09月11日

配置文件
在$GCLUSTER_BASE/config/gcmmonit.conf配置文件中,
可以查看和修改gcmmonit
的基本配置。
配置文件格式说明
[common]
log_file=
log_flag=
retry_times=
interval=
[TagName]
fail2ok_trigger_cmd=
ok2fail_trigger_cmd=
prog_name=
表4- 8 参数说明
参数名称



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


common
通用设置节点标签,此标签下的配置为gcmonit 程序配置。
log_file
gcmmonit 的日志文件的绝对路径,如果没有指定,程序将报
错退出。
interval
gcmmonit 的检测服务程序的时间间隔,设置内容为正整数。
单位为秒。最小值为1,最大值为3600,如果没有指定,或
者指定值越界,程序将报错退出。
retry_times
gcmmonit 启动被监测程序的连续失败次数,设置内容为非负
整数。最小值为0,代表无限重试;最大值为64,如果没有
指定,或者指定值越界,程序将报错退出。
log_flag
gcmmonit 程序启动过程中是否生成log 文件。1 表示生成log
信息;0 表示不生成log 信息。默认值为1。
TagName
要监控的服务程序名称。
fail2ok_trigger_cmd
监测程序由stopped 到running 状态后需要执行的命令行方法。
可选设置项,用户可以依照需求来进行设置。如果发现设置
存在异常(如重复设置,设置值有误等),gcmonit 程序将报
错退出。
ok2fail_trigger_cmd
被监测程序由running 到stopped 状态后,
或者是在retry_times
内的stopped 到running,需要执行的命令行方法。为可选设
置项,用户可以依照需求来进行设置。如果发现设置存在异

(如重复设置,
设置值有误等)

gcmonit 程序将报错退出。
prog_name
指定了集群服务程序对应的具体进程名称,必须在配置文件
中指定。如果没有指定,gcmonit 程序将报错退出。
示例
gcmmonit 的配置文件$GCLUSTER_BASE/config/gcmmonit.conf 内容参考如下:
$ cat $GCLUSTER_BASE/config/gcmmonit.conf
[common]
log_file="/opt/192.168.146.22/gcluster/log/gcluster/gcmmonit.log"
log_flag=1
retry_times=10
interval=5
[gcmonit]
fail2ok_trigger_cmd="echo gcmonit started again"
ok2fail_trigger_cmd="/opt/192.168.146.22/gcluster/server/bin/gcmonit --start"
prog_name=gcmonit

代表一个GBase 数据库中的事务。这个类不能被继承。对于该类型的所有
成员,参考GBaseTransaction 成员。

继承层次
System.Object
|__ System.MarshalByRefObject
|__ System.Data.Common.DbTransaction
|__ GBase.Data.GBaseClient.GBaseTransaction

语法
[Visual Basic]
Public NotInheritable Class GBaseTransaction _
Inherits DbTransaction
[C#]
public sealed class GBaseTransaction : DbTransaction

必要条件



GBase 8a 程序员手册ADO.NET 篇
南大通用数据技术股份有限公司

- 323 -
命名空间:GBase.Data.GBaseClient

线程安全性
这个类型的公共静态成员(在Visual Basic 中为 Shared)对于多线程操作
是保证线程安全的,对于实例不保证线程安全性。

注释
程序通过在GBaseConnection 对象上调用BeginTransaction 来创建一个
GBaseTransaction 对象。
所有后面关于事务的操作
(例如:
提交或者回滚事务)
都在GBaseTransaction 对象上进行。

示例
下面的例子创建了一个GBaseConnection 和一个GBaseTransaction 对象,
还示范了如何使用BeginTransaction、Commit 和Rollback 方法。
[Visual Basic]
Public Sub RunTransaction(gsConnString As String)
Dim gsConnection As New GBaseConnection(gsConnString)
gsConnection.Open()
Dim gsCommand As GBaseCommand = gsConnection.CreateCommand()
Dim gsTrans As GBaseTransaction
' Start a local transaction
gsTrans = gsConnection.BeginTransaction()
' Must assign both transaction object and connection
' to Command object for a pending local transaction
gsCommand.Connection = gsConnection
gsCommand.Transaction = gsTrans
Try
gsCommand.CommandText = "Insert into Region ("_
&"RegionID,"_
&"RegionDescription)VALUES (100, "_
&"Description')"
gsCommand.ExecuteNonQuery()
gsCommand.CommandText = "Insert into Region ("_
&"RegionID, "_

GBase 8a 程序员手册ADO.NET 篇


- 324 -

南大通用数据技术股份有限公司
&"RegionDescription) VALUES (101, "_
&"'Description')"
gsCommand.ExecuteNonQuery()
gsTrans.Commit()
Console.WriteLine("Both records are written to
database.")
Catch e As Exception
Try
gsTrans.Rollback()
Catch ex As GBaseException
If Not gsTrans.Connection Is Nothing Then
Console.WriteLine("An exception of type " &_
ex.GetType().ToString() &_
" was encountered
while
attempting to roll back
the
transaction.")
End If
End Try
Console.WriteLine("An exception of type "& _
e.GetType().ToString()&_
"was encountered while inserting the data.")
Console.WriteLine("Neither record was written to
database.")
Finally
gsConnection.Close()
End Try
End Sub 'RunTransaction

[C#]
public void RunTransaction(string gsConnString)
{
GBaseConnection gsConnection = new
GBaseConnection(gsConnString);
gsConnection.Open();
GBaseCommand gsCommand = gsConnection.CreateCommand();
GBaseTransaction gsTrans;
// Start a local transaction
gsTrans = gsConnection.BeginTransaction();



GBase 8a 程序员手册ADO.NET 篇
南大通用数据技术股份有限公司

- 325 -
// Must assign both transaction object and connection
// to Command object for a pending local transaction
gsCommand.Connection = gsConnection;
gsCommand.Transaction = gsTrans;
try
{
gsCommand.CommandText = "Insert into Region (RegionID,
RegionDescription) VALUES (100, 'Description')";
gsCommand.ExecuteNonQuery();

gsCommand.CommandText = "Insert into Region (RegionID,
RegionDescription) VALUES (101, 'Description')";
gsCommand.ExecuteNonQuery();
gsTrans.Commit();
Console.WriteLine("Both
records
are
written
to
database.");
}
catch(Exception e)
{
try
{
gsTrans.Rollback();
}
catch (GBaseException ex)
{
if (gsTrans.Connection != null)
{
Console.WriteLine("An exception of type " +
ex.GetType() +" was encountered while attempting to roll back the
transaction.");
}
}
Console.WriteLine("An exception of type " + e.GetType() +
" was encountered while inserting
the data.");
Console.WriteLine("Neither record was written to
database.");
}
finally

GBase 8a 程序员手册ADO.NET 篇


- 326 -

南大通用数据技术股份有限公司
{
gsConnection.Close();
}
}

dcf_mec_pool_max_size
参数说明:DCF 通信模块内存池最大值,参数重启生效。
该参数属于POSTMASTER 类型参数,请参考表15-1 中对应设置方法进行设置。
取值范围:整型,单位MB,32~2147483647
默认值:200