ZookeeperConfig::get

(PECL zookeeper >= 0.6.0, ZooKeeper >= 3.5.0)

ZookeeperConfig::getGets the last committed configuration of the ZooKeeper cluster as it is known to the server to which the client is connected, synchronously

说明

public ZookeeperConfig::get ([ callable $watcher_cb = NULL [, array &$stat = NULL ]] ) : string

参数

watcher_cb

If nonzero, a watch will be set at the server to notify the client if the node changes.

stat

If not NULL, will hold the value of stat for the path on return.

返回值

Returns the configuration string on success, and false on failure.

错误/异常

This method emits ZookeeperException and it's derivatives when parameters count or types are wrong or fail to get configuration.

范例

Example #1 ZookeeperConfig::get() example

Get configuration.

<?php
$zk 
= new Zookeeper();
$zk->connect('localhost:2181');
$zk->addAuth('digest''timandes:timandes');
$zkConfig $zk->getConfig();
$r $zkConfig->get();
if (
$r)
  echo 
$r;
else
  echo 
'ERR';
?>

以上例程会输出:

server.1=localhost:2888:3888:participant;0.0.0.0:2181
version=0xca01e881a2

参见

相关文章
php 数组 函数 gets the last key of an arrayphp mysqlnd ms 函数 returns an array which describes the last used connectionphp newt 函数 set a callback function which gets invoked when user presses the suspend keyphp socket 函数 sends a message to a socket whether it is connected or notphp stream 函数 sends a message to a socket whether it is connected or notphp sybase 函数 gets number of affected rows in last queryphp hyperwave api 函数 returns information about server configurationphp mongodb driver manager return the servers to which this manager is connectedphp mongodb driver monitoring commandstartedevent returns the server on which the command was executedphp splfileinfo gets last access time of the filephp stomp gets the last stomp errorphp swoole http client send post http request to the remote server.php zookeeper gets the data associated with a node synchronouslyphp zookeeper gets the acl associated with a node synchronouslyphp zookeeper lists the children of a node synchronouslyphp zookeeper return the client session id only valid if the connections is currently connected ie. last watcher state is zoo connected state php zookeeper get instance of zookeeperconfigphp zookeeper return the timeout for this session only valid if the connections is currently connected ie. last watcher state is zoo connected state . this value may change after a server re connectphp zookeeperconfig gets the last committed configuration of the zookeeper cluster as it is known to the server to which the client is connected synchronouslyphp zookeeperconfig change zk cluster ensemble membership and roles of ensemble peers
关注编程学问公众号