SequoiaDB 简介
快速入门
安装部署
数据库实例
分布式引擎
SAC 管控中心
参考手册
常见问题及解答(FAQ)
版本信息
getMaster - 获取当前复制组的主节点
rg.getMaster()
SdbReplicaGroup
该函数用于获取当前复制组的主节点。
无
函数执行成功时,将返回一个 SdbNode 类型的对象。
函数执行失败时,将抛异常并输出错误信息。
当异常抛出时,可以通过 getLastErrMsg() 获取错误信息或通过 getLastError() 获取错误码。更多错误处理可以参考常见错误处理指南。
v2.0 及以上版本
获取 group1 复制组的主节点,可以通过该节点进行相关的节点级操作
> var rg = db.getRG("group1")
> var node = rg.getMaster()
> println(node)
hostname1:11830
> println(node.constructor.name)
SdbNode
> node.help()
--Instance methods for class "SdbNode":
connect() - Connect the database to the current node.
getHostName() - Return the hostname of a node.
getNodeDetail() - Return the information of the current node.
getServiceName() - Return the server name of a node.
start() - Start the current node.
stop() - Stop the current node.
展开