(Ebook) Apache ZooKeeper Essentials - Saurav Haloi by 2015pdf download
(Ebook) Apache ZooKeeper Essentials - Saurav Haloi by 2015pdf download
https://ebooknice.com/product/apache-zookeeper-essentials-saurav-
haloi-50824168
https://ebooknice.com/product/apache-essentials-install-configure-
maintain-45035160
https://ebooknice.com/product/experimental-algorithms-14th-international-
symposium-sea-2015-paris-france-june-29-july-1-2015-proceedings-5141820
https://ebooknice.com/product/autocad-2015-and-autocad-lt-2015-essentials-
autodesk-official-press-4671428
https://ebooknice.com/product/antibiotic-essentials-2015-5201704
(Ebook) Mathematics of Program Construction: 12th International
Conference, MPC 2015, Königswinter, Germany, June 29--July 1,
2015. Proceedings by Ralf Hinze, Janis Voigtländer (eds.) ISBN
9783319197968, 3319197967
https://ebooknice.com/product/mathematics-of-program-construction-12th-
international-conference-mpc-2015-konigswinter-germany-
june-29-july-1-2015-proceedings-5141764
https://ebooknice.com/product/autodesk-robot-structural-analysis-
professional-2015-essentials-6857832
Saurav Haloi
BIRMINGHAM - MUMBAI
Apache ZooKeeper Essentials
All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy
of the information presented. However, the information contained in this book is
sold without warranty, either express or implied. Neither the author, nor Packt
Publishing, and its dealers and distributors will be held liable for any damages
caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
ISBN 978-1-78439-132-4
www.packtpub.com
Credits
Reviewers Proofreaders
Hanish Bansal Martin Diver
Christopher Tang, PhD Ameesha Green
Technical Editor
Anushree Arun Tendulkar
Copy Editors
Karuna Narayanan
Alfida Paiva
About the Author
Saurav Haloi works as a principal software engineer at EMC in its data protection
and availability division. With more than 10 years of experience in software
engineering, he has also been associated with prestigious software firms such as
Symantec Corporation and Tata Consultancy Services, where he worked in the design
and development of complex, large-scale, multiplatform, multi-tier, and enterprise
software systems in a storage, networking, and distributed systems domain. He
has been using Apache ZooKeeper since 2011 in a variety of different contexts. He
graduated from National Institute of Technology, Surathkal, India, with a bachelors
degree in computer engineering. An open source enthusiast and a hard rock and heavy
metal fanatic, he lives in the city of Pune in India, which is also known as the Oxford of
the East.
Did you know that Packt offers eBook versions of every book published, with PDF and
ePub files available? You can upgrade to the eBook version at www.PacktPub.com and
as a print book customer, you are entitled to a discount on the eBook copy. Get in touch
with us at service@packtpub.com for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up
for a range of free newsletters and receive exclusive discounts and offers on Packt books
and eBooks.
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital
book library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
• Fully searchable across every book published by Packt
• Copy and paste, print, and bookmark content
• On demand and accessible via a web browser
[ ii ]
Table of Contents
[ iii ]
Preface
Architecting and building a distributed system is not a trivial job, and implementing
coordination systems for the distributed applications is even harder. They are often
prone to errors such as race conditions and deadlocks, and such bugs are not easily
detectable. Apache ZooKeeper has been developed with this objective in mind, to
simplify the task of developing coordination and synchronization systems from
scratch. ZooKeeper is an open source service, which enables high performance and
provides highly available coordination services for distributed applications.
This book covers the core concepts of ZooKeeper internals, its administration,
and the best practices for its usage. The ZooKeeper APIs and the data model are
presented in the most comprehensive manner for both beginners and experts,
followed by programming with ZooKeeper. Examples of developing client
applications have been given in three languages: Java, C, and Python. A full
chapter has been dedicated to discuss the various ZooKeeper recipes so that
readers get a vivid understanding of how ZooKeeper can be used to carry out
common distributed system tasks.
Preface
This book also introduces readers to two projects: Curator and Exhibitor, which
are used to ease the use of ZooKeeper in client applications and its management
in production. Real-world examples of software projects that use ZooKeeper have
been cited for readers to understand how ZooKeeper solves real problems. This
is followed by examples of organizations that use ZooKeeper in their production
platforms and enterprise software systems.
Apache ZooKeeper Essentials will help readers learn everything they need to get a
firm grasp of ZooKeeper so that they can start building scalable and high-performant
distributed applications with ease and full confidence.
Chapter 4, Performing Common Distributed System Tasks, discusses the various recipes
of distributed system tasks such as locks, queues, leader election, and so on. After
going through these recipes, you will understand how ZooKeeper can be used to
solve common coordination problems that are often encountered while building
distributed systems.
Chapter 5, Administering Apache ZooKeeper, provides you with all the information that
you need to know about the administration and configuration of ZooKeeper. It also
presents the best practices of ZooKeeper usage and the various ways to monitor it.
Chapter 6, Decorating ZooKeeper with Apache Curator, cites details about two projects,
Curator and Exhibitor, that make ZooKeeper programming and management easier
and simpler.
[2]
Preface
The procedure to download, install, and configure ZooKeeper is presented in the first
chapter of this book. To play around with ZooKeeper and run the example code of
this book, readers need to have access to a system with the following requirements:
• Python 2.7.x: This is required to run the Python code samples. Python can
be downloaded from https://www.python.org/downloads/.
Conventions
In this book, you will find a number of styles of text that distinguish between
different kinds of information. Here are some examples of these styles, and an
explanation of their meaning.
New terms and important words are shown in bold. Words that you see on
the screen, in menus, or dialog boxes for example, appear in the text like this:
"The MBeans tab shows detailed information about ZooKeeper's internal state."
[4]
Preface
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about
this book—what you liked or disliked. Reader feedback is important for us as it helps
us develop titles that you will really get the most out of.
If there is a topic that you have expertise in and you are interested in either writing
or contributing to a book, see our author guide at www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to
help you to get the most from your purchase.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes
do happen. If you find a mistake in one of our books—maybe a mistake in the text or
the code—we would be grateful if you could report this to us. By doing so, you can
save other readers from frustration and help us improve subsequent versions of this
book. If you find any errata, please report them by visiting http://www.packtpub.
com/submit-errata, selecting your book, clicking on the Errata Submission Form
link, and entering the details of your errata. Once your errata are verified, your
submission will be accepted and the errata will be uploaded to our website or added
to any list of existing errata under the Errata section of that title.
[5]
Random documents with unrelated
content Scribd suggests to you:
vera imprudenza, e il signor Bray doveva pensarlo, giacchè le ha
domandato dove andasse. Con le circonlocuzioni del suo fiorito
linguaggio ella ha risposto che andava a passar la giornata dalla
signora tale, dimorante nei pressi dei Prati. Io allora tocco una
manica al principale e gli dico piano che se non ha bisogno di me, vo
ad accompagnarla. Il signor Bray mi dà licenza, per un'ora. Io offro il
braccio alla vecchietta dicendole che sarebbe un piacere per me il
servirla. Ah, miei cari, bisognava vedere! Se io fossi stato un giovane
adulto e lei una ragazza, non avrebbe fatto più vezzosamente la
ritrosa, con mossettine del capo e mezzi sorrisetti.... Ma infine
prende il mio braccio e partiamo. Sapevo che il signor Bray e
l'avventore ridevano alle nostre spalle, ma non me ne importava;. la
vecchia signora mi faceva compassione, e non volevo che cascasse
una seconda volta.
«I passanti si voltavano a guardarci, e non c'è da maravigliarsene,
perchè eravamo senza dubbio una coppia dimolto buffa. Non
soltanto essa aveva accettato l'appoggio offerto, ma vi s'aggrappava
di peso, con tutte e due le mani, arrotondando le braccia come due
anse. Qui però non dovrei ridere di quella poveretta, perchè aveva
gran necessità che qualcuno l'aiutasse e la sostenesse per non
sdrucciolare sul ghiaccio, e non pesava già tanto da stancarmi. Sarei
curioso di sapere chi siano i suoi. È strano che la lascino uscire sola,
specie quando le strade sono nello stato d'oggi....
— Come si chiama? — domandò Gertrude. — Non te l'ha detto?
— No, non ha voluto. Io gliel'ho chiesto, ma mi ha risposto
semplicemente, con la sua vocettina fessa — e Guglielmo
ricominciava a sbellicarsi dalle risa — che ella era la dama incognita,
e ch'è l'impegno d'un vero e galante cavaliere scoprire il nome della
sua bella. In fede mia, un'avventura impagabile! Non ho sentito mai
nessuno parlare in modo così ridicolo. Le ho domandato la sua età....
La mamma dice che ho commesso un'inciviltà madornale, ma in
compenso è l'unica.... La vecchia signora lo attesterebbe se fosse
qui.
— Ebbene, quanti anni ha?
— Sedici.
— Eh via, Guglielmo! Mi burli?
— No, è l'età che m'ha detto lei. E un vero e galante cavaliere è in
obbligo di credere ciecamente alla sua bella dama.
— Povera creatura! — esclamò Trueman. — È rimbambita!
— Non mica, zio True. A momenti parrebbe, quando sballa certe
sciocchezze, ma poi subito si mette a parlare sensatamente quanto
voi e me. M'ha ringraziato protestandosi gratissima e lodando il raro
«spirito di cortesia» che dimostravo col pigliarmi tanta pena d'una
vecchia signora come lei. Nello svoltare in via Beacon ci siamo
incontrati in un intero collegio di ragazze, tutte bellezze fiorenti,
«bellezze da ammazzare un uomo» diceva la mia vecchietta. Appena
vedutele apparire da lontano doveva aver tenuto sicuro ch'io
cercherei di liberarmi per correre dietro a qualcuna di loro, tanto
furiosamente s'attaccava al mio braccio. Sorte ch'io non avessi punto
la prava intenzione d'abbandonarla, perchè mi sarebbe stato
impossibile. Alcune delle ragazze si fermavano un momento a
guardarci con curiosità; io, s'intende, non ne facevo caso, ma la mia
dama sembrava credere che ne fossi terribilmente mortificato, e,
passate alfine tutte quante, ha rilodato il mio «spirito di cortesia»:
sua espressione favorita. —
Guglielmo tacque, sfiatato. True gli pose una mano sulla spalla:
— Sei un bravo e buon ragazzo! — disse; — Tu onori i vecchi, e fai
bene, quantunque il tuo nonno pretenda che non sia più di moda.
— Non so di mode, io, zio True, ma stimerei tristo e di basso animo
un ragazzo che vedesse una vecchia sdrucciolare sul ghiaccio, e non
l'accompagnasse a casa per risparmiarle una nuova caduta.
— Guglielmo è sempre stato buono con tutti, — osservò Gertrude.
— O Guglielmo è un eroe, — disse il giovanetto — o ha due cari
amici che lo giudicano con troppa benevolenza, com'è più verosimile.
Ma vieni, Gertrude, Carlo XII ci aspetta, e dobbiamo studiare molto
oggi, perchè può darsi che non ci capiti tanto presto un'altra
occasione. Il signor Bray non istava bene stasera; pare che lo
minacci la febbre. Gli ho promesso di ritornar a bottega domani,
dopo desinato. Se, Dio guardi, s'ammala, sarò occupatissimo, e non
potrò affatto venire a casa.
— Oh, speriamo che non s'ammali! — esclamarono Trueman e
Gertrude, a una voce.
— È un così brav'uomo! — soggiunse il vecchio.
— E tratta Guglielmo con tanta bontà! — aggiunse la bambina.
Anche Guglielmo sperava, ma le sue speranze si mutarono in ansiosi
timori quando il giorno seguente seppe che il suo ottimo padrone
non si trovava in grado di lasciare il letto, e che il medico era
impensierito dai sintomi riscontrati.
Si manifestò una febbre tifoidea che in pochi giorni condusse il
farmacista alla tomba.
La sua morte fu per Guglielmo un colpo tanto improvviso e terribile,
che su quel subito egli non comprese le importanti conseguenze che
da questo evento derivavano a lui stesso, nel suo avvenire. La
farmacia venne chiusa, essendosi la vedova risolta a vendere i fondi
per ritirarsi a vivere in campagna; sicchè rimase privo a un tempo
dell'impiego e del prezioso appoggio che aveva nel signor Bray.
Nell'ultimo anno i guadagni del giovanetto erano stati considerevoli,
e avevano migliorato le condizioni de' suoi cari, permettendo loro di
diminuire le proprie quotidiane fatiche. Il pensiero d'essere a carico
della mamma e del nonno anche per un solo giorno era intollerabile
al suo spirito indipendente ed energico. E però si mise sollecitamente
alla ricerca d'un nuovo posto. Incominciò dal rivolgersi ai farmacisti
della città: a nessuno di essi occorreva un ragazzo dell'età sua, e la
giornata fu spesa in gite inutili.
Ritornò a casa la sera, disilluso, ma punto scoraggiato. Se non
trovava da impiegarsi in una farmacia, avrebbe fatto qualche altra
cosa.
Ma che cosa? Questo era il nodo. Dibattè a lungo la questione con
sua madre. Ella sentiva che l'ingegno e l'educazione del suo figliuolo
gli davano diritto a un posto almeno pari a quello che aveva
occupato fino allora, e non poteva sopportare l'idea ch'egli
scendesse a servigi più bassi. Guglielmo stesso, senz'essere
presuntuoso, non pensava diversamente. Egli ben si sapeva capace
di tenere uffici richiedenti assai maggior coltura e attitudine agli
affari che non le incombenze affidategli dal signor Bray. Ma se per
ora non era possibile conseguire ciò che desiderava, avrebbe preso
ciò che si sarebbe offerto. E cercò da tutte le parti. Il guaio era che
non aveva nessuno da far dire una buona parola in suo favore, e
certo non si può pretendere che la gente abbia fiducia in un ragazzo
sconosciuto e senza raccomandazioni.
Tutti i suoi passi riuscivano dunque infruttuosi, e un giorno dopo
l'altro se ne tornava a casa silenzioso e depresso, temendo la vista
del nonno e della mamma. Quando questa volgeva verso di lui piena
di speranza il pallido viso che portava l'impronta di tante cure, di
tante fatiche, era uno strazio per il suo cuore doverla rattristare con
nuovi disinganni; e non meno lo tormentava il pessimismo del
vecchio, il quale addirittura non credeva alla possibilità ch'egli
trovasse un'altra occupazione, nè si sarebbe persuaso del contrario
finchè non glielo provasse un fatto di cui non si vedeva ancora
speranza. In capo a due settimane la signora Sullivan finì con
l'astenersi dall'interrogarlo sui risultati delle pratiche fatte, avendo il
suo vigile occhio materno scorto tutta la pena che gli cagionavano
quelle domande. Aspettava pazientemente che egli le comunicasse le
sue notizie, se ne aveva.
Spesso così avveniva che non fosse scambiata tra loro una parola sul
modo in cui Guglielmo aveva impiegato la giornata. E molte trepide
istanze egli fece per ottenere lavoro, molte mortificanti repulse ebbe
a soffrire, di cui sua madre nulla mai seppe.
XIV.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebooknice.com