@@ -331,24 +331,25 @@ ZookeeperStore
331
331
~~~~~~~~~~~~~~
332
332
333
333
.. versionadded :: 4.2
334
- The ZookeeperStore was introduced Symfony 4.2.
334
+ The ZookeeperStore was introduced in Symfony 4.2.
335
335
336
- The ZookeeperStore saves locks on a Zookeeper server, it requires a Zookeeper
336
+ The ZookeeperStore saves locks on a ` ZooKeeper `_ server. It requires a ZooKeeper
337
337
connection implementing the ``\Zookeeper `` class. This store does not
338
338
support blocking and expiration but the lock is automatically released when the
339
339
PHP process is terminated::
340
340
341
341
use Symfony\Component\Lock\Store\ZookeeperStore;
342
342
343
- $zookeeper_server = 'localhost:2181'; // For High Availablity Cluster you can pass 'localhost1:2181,localhost2:2181,localhost3:2181'
344
- $zookeeper = new \Zookeeper($zookeeper_server);
343
+ $zookeeper = new \Zookeeper('localhost:2181');
344
+ // use the following to define a high-availability cluster:
345
+ // $zookeeper = new \Zookeeper('localhost1:2181,localhost2:2181,localhost3:2181');
345
346
346
347
$store = new ZookeeperStore($zookeeper);
347
348
348
349
.. note ::
349
350
350
- Zookeeper does not require a TTL as the nodes used for locking are ephemeral and die when the PHP process is terminated.
351
-
351
+ Zookeeper does not require a TTL as the nodes used for locking are ephemeral
352
+ and die when the PHP process is terminated.
352
353
353
354
Reliability
354
355
-----------
@@ -360,9 +361,10 @@ Remote Stores
360
361
~~~~~~~~~~~~~
361
362
362
363
Remote stores (:ref: `MemcachedStore <lock-store-memcached >`,
363
- :ref: `PdoStore <lock-store-pdo >`, :ref: `RedisStore <lock-store-redis >`) and :ref: `ZookeeperStore <lock-store-zookeeper >`)
364
- use a unique token to recognize the true owner of the lock. This token is stored
365
- in the :class: `Symfony\\ Component\\ Lock\\ Key ` object and is used internally by
364
+ :ref: `PdoStore <lock-store-pdo >`, :ref: `RedisStore <lock-store-redis >`) and
365
+ :ref: `ZookeeperStore <lock-store-zookeeper >`) use a unique token to recognize
366
+ the true owner of the lock. This token is stored in the
367
+ :class: `Symfony\\ Component\\ Lock\\ Key ` object and is used internally by
366
368
the ``Lock ``, therefore this key must not be shared between processes (session,
367
369
caching, fork, ...).
368
370
@@ -589,22 +591,26 @@ can be two running containers in parallel.
589
591
ZookeeperStore
590
592
~~~~~~~~~~~~~~
591
593
592
- The way ZookeeperStore works is by maintaining locks as ephemeral nodes on the server. That means that by using
593
- the :ref: `ZookeeperStore <lock-store-zookeeper >` the locks will be automatically released at the end of the session
594
- in case the client cannot unlock for any reason.
594
+ The way ZookeeperStore works is by maintaining locks as ephemeral nodes on the
595
+ server. That means that by using :ref: `ZookeeperStore <lock-store-zookeeper >`
596
+ the locks will be automatically released at the end of the session in case the
597
+ client cannot unlock for any reason.
595
598
596
- If the Zookeeper service or the machine hosting it restarts, every lock would
599
+ If the ZooKeeper service or the machine hosting it restarts, every lock would
597
600
be lost without notifying the running processes.
598
601
599
602
.. tip ::
600
603
601
- To use Zookeeper's High Availability feature, you can setup a cluster of multiple servers so that in case one of
602
- the server goes down, the majority will still be up and serving the requests. All the available servers in the
604
+ To use ZooKeeper's high-availability feature, you can setup a cluster of
605
+ multiple servers so that in case one of the server goes down, the majority
606
+ will still be up and serving the requests. All the available servers in the
603
607
cluster will see the same state.
604
608
605
609
.. note ::
606
- As this store does not support multi-level node locks,
607
- since the clean up of intermediate nodes becomes an overhead, all locks are maintained at the root level.
610
+
611
+ As this store does not support multi-level node locks, since the clean up of
612
+ intermediate nodes becomes an overhead, all locks are maintained at the root
613
+ level.
608
614
609
615
Overall
610
616
~~~~~~~
@@ -621,3 +627,4 @@ are still running.
621
627
.. _`PDO` : https://php.net/pdo
622
628
.. _`Doctrine DBAL Connection` : https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Connection.php
623
629
.. _`Data Source Name (DSN)` : https://en.wikipedia.org/wiki/Data_source_name
630
+ .. _`ZooKeeper` : https://zookeeper.apache.org/
0 commit comments