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 mcve 函数 set certificate key files and certificates if server requires client certificate verificationphp pcntl 函数 retrieve the error number set by the last pcntl function which failedphp socket 函数 sends a message to a socket whether it is connected or notphp sybase 函数 returns the last message from the serverphp gearmanclient add a job server to the clientphp 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 mongodb driver server returns the port on which this server is listeningphp splfileinfo gets last access time of the filephp swoole http client check if the http connection is connected.php swoole http client send post http request to the remote server.php swoole websocket server unpack the binary data received from the client.php zookeeper checks the existence of a node in zookeeper synchronouslyphp 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 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 synchronously
关注编程学问公众号