SequoiaGroup Class. To get this Class object must be call SequoiaDB::getGroup.
SequoiaGroup::attachNode |
( |
string |
$hostName, |
|
|
string |
$serviceName, |
|
|
array|string |
$options |
|
) |
| |
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. Can be the follow options: KeepData : Whether to keep the original data of the new node. This option has no default value.
User should specify its value explicitly.
|
- Returns
- Returns the result, default return array.
- Return values
-
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example:
$err = $groupObj ->
attachNode(
'host1',
'11900', array(
'KeepData' =>
true ) ) ;
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 |
|
) |
| |
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. Can be the follow options: KeepData : Whether to keep the original data of the detached node. This option has no default value.
User should specify its value explicitly.
Enforced : Whether to detach the node forcibly, default to be false.
|
- Returns
- Returns the result, default return array.
- Return values
-
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example:
$err = $groupObj ->
detachNode(
'host1',
'11900', array(
'KeepData' =>
true ) ) ;
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 -> getLastErrorMsg() ;
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 -> getLastErrorMsg() ;
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 -> getLastErrorMsg() ;
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 -> getLastErrorMsg() ;
echo "Failed to get the node, error code: ".$err['errno'] ;
return ;
}
SequoiaGroup::getNodeNum |
( |
integer |
$status | ) |
|
Get the status node number.
- Deprecated:
- This function is deprecated.
SequoiaGroup::getSlave |
( |
|
$positionsArray = void | ) |
|
Get the slave node.
- Parameters
-
$positionsArray | an array argument. The array of node's position, the array elements can be 1-7. |
- Returns
- Returns a new SequoiaNode object.
- Return values
-
Example: Get one of slave node
if( empty( $nodeObj ) ) {
$err = $db -> getLastErrorMsg() ;
echo "Failed to get the slave node, error code: ".$err['errno'] ;
return ;
}
Example: Get a specified slave node
$nodeObj = $groupObj ->
getSlave( array( 1, 2, 3 ) ) ;
if( empty( $nodeObj ) ) {
$err = $db -> getLastErrorMsg() ;
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. The $options of reelection. Please reference here for more detail. |
- 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 files: