SequoiaGroup Class. To get this Class object must be call SequoiaDB::getGroup.
SequoiaGroup::attachNode |
( |
string |
$hostName, |
|
|
string |
$serviceName, |
|
|
array|string |
$options = NULL |
|
) |
| |
Attach a node to the group.
- Parameters
-
$hostName | the string argument. The hostname for the catalog replica group. |
$serviceName | the string argument. The servicename for the catalog replica group. |
$options | an array or the string argument. The options of attach. KeepData : Whether the node data is preserved, default false.
|
- Returns
- Returns the result, default return array.
- Return values
-
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example:
$err = $groupObj ->
attachNode(
'host1',
'11900' ) ;
if( $err['errno'] != 0 ) {
echo "Failed to attach node, error code: ".$err['errno'] ;
return ;
}
SequoiaGroup::createNode |
( |
string |
$hostName, |
|
|
string |
$serviceName, |
|
|
string |
$databasePath, |
|
|
array|string |
$configure = NULL |
|
) |
| |
Create node.
- Parameters
-
$hostName | the string argument. The hostname for the catalog replica group. |
$serviceName | the string argument. The servicename for the catalog replica group. |
$databasePath | the string argument. The path for the catalog replica group. |
$configure | the string argument. The configurations for the catalog replica group. |
- Returns
- Returns the result, default return array.
- Return values
-
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example:
$err = $groupObj ->
createNode(
'host1',
'11900',
'/opt/sequoiadb/database/catalog/11900' ) ;
if( $err['errno'] != 0 ) {
echo "Failed to create node, error code: ".$err['errno'] ;
return ;
}
SequoiaGroup::detachNode |
( |
string |
$hostName, |
|
|
string |
$serviceName, |
|
|
array|string |
$options = NULL |
|
) |
| |
Detach a node from the group.
- Parameters
-
$hostName | the string argument. The hostname for the catalog replica group. |
$serviceName | the string argument. The servicename for the catalog replica group. |
$options | an array or the string argument. The options of detach. KeepData : Whether the node data is preserved, default false.
|
- Returns
- Returns the result, default return array.
- Return values
-
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example:
$err = $groupObj ->
detachNode(
'host1',
'11900' ) ;
if( $err['errno'] != 0 ) {
echo "Failed to detach node, error code: ".$err['errno'] ;
return ;
}
SequoiaGroup::getDetail |
( |
| ) |
|
Get the group detail.
- Returns
- Returns the group detail, default return array.
- Return values
-
Example:
$err = $db -> getError() ;
if( $err['errno'] != 0 ) {
echo "Failed to call getDetail, error code: ".$err['errno'] ;
return ;
}
var_dump( $detail ) ;
SequoiaGroup::getMaster |
( |
| ) |
|
Get the master node.
- Returns
- Returns a new SequoiaNode object.
- Return values
-
Example:
if( empty( $nodeObj ) ) {
$err = $db -> getError() ;
echo "Failed to get the master node, error code: ".$err['errno'] ;
return ;
}
SequoiaGroup::getName |
( |
| ) |
|
Get the specified replica group name.
- Returns
- Returns the group name.
- Return values
-
Example:
$groupName = $groupObj ->
getName() ;
$err = $db -> getError() ;
if( $err['errno'] != 0 ) {
echo "Failed to get group name, error code: ".$err['errno'] ;
return ;
}
echo "Group name is: ".$groupName ;
SequoiaGroup::getNode |
( |
string |
$name | ) |
|
Get the node.
- Parameters
-
$name | the string argument. The name of the node. |
- Returns
- Returns a new SequoiaNode object.
- Return values
-
Example:
$nodeObj = $groupObj ->
getNode(
'host1:11910' ) ;
if( empty( $nodeObj ) ) {
$err = $db -> getError() ;
echo "Failed to get the node, error code: ".$err['errno'] ;
return ;
}
SequoiaGroup::getNodeNum |
( |
integer |
$status | ) |
|
Get the status node number.
- Parameters
-
$status | an integer argument. The node status, can not be null |
- Returns
- Returns the number of node.
- Return values
-
Example:
if( $NodeNum < 0 ) {
$err = $db -> getError() ;
echo "Failed to call getNodeNum, error code: ".$err['errno'] ;
return ;
}
echo "Node number: ".$NodeNum ;
SequoiaGroup::getSlave |
( |
| ) |
|
Get the slave node.
- Returns
- Returns a new SequoiaNode object.
- Return values
-
Example:
if( empty( $nodeObj ) ) {
$err = $db -> getError() ;
echo "Failed to get the slave node, error code: ".$err['errno'] ;
return ;
}
SequoiaGroup::isCatalog |
( |
| ) |
|
Judge whether the specified replica group is catalog.
- Returns
- Returns the result.
- Return values
-
Example:
if( $isCata == true ) {
echo "This is the catalog group." ;
} else {
echo "This is not the catalog group" ;
}
SequoiaGroup::reelect |
( |
array|string |
$options = NULL | ) |
|
Re-elected in the replication group.
- Parameters
-
$options | an array or the string argument. Seconds: New elections needed within the number of seconds to complete, default 30 seconds.
|
- Returns
- Returns the result, default return array.
- Return values
-
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example: 60 seconds for new elections.
$err = $groupObj ->
reelect( array(
'Seconds' => 60 ) ) ;
if( $err['errno'] != 0 ) {
echo "Failed to call reelect, error code: ".$err['errno'] ;
return ;
}
SequoiaGroup::removeNode |
( |
string |
$hostName, |
|
|
string |
$serviceName, |
|
|
array|string |
$configure = NULL |
|
) |
| |
Remove node in a given replica group.
- Parameters
-
$hostName | the string argument. The hostname for the catalog replica group. |
$serviceName | the string argument. The servicename for the catalog replica group. |
$configure | the string argument. The configurations for the catalog replica group. |
- Returns
- Returns the result, default return array.
- Return values
-
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example:
$err = $groupObj ->
removeNode(
'host1',
'11900' ) ;
if( $err['errno'] != 0 ) {
echo "Failed to remove node, error code: ".$err['errno'] ;
return ;
}
Start and activate the specified replica group.
- Returns
- Returns the result, default return array.
- Return values
-
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example:
$err = $groupObj ->
start() ;
if( $err['errno'] != 0 ) {
echo "Failed to start group, error code: ".$err['errno'] ;
return ;
}
Stop the specified replica group.
- Returns
- Returns the result, default return array.
- Return values
-
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example:
$err = $groupObj ->
stop() ;
if( $err['errno'] != 0 ) {
echo "Failed to stop group, error code: ".$err['errno'] ;
return ;
}
The documentation for this class was generated from the following file:
- /var/lib/jenkins/workspace/compile_db_x86_branch_2.6/sequoiadb/driver/php5/ext/class/class_group.php