Book Image

Learning Karaf Cellar

By : Jean Baptiste Onofre, Jean-Baptiste Onofré
Book Image

Learning Karaf Cellar

By: Jean Baptiste Onofre, Jean-Baptiste Onofré

Overview of this book

Table of Contents (16 chapters)


Apache Karaf has been emerging as the main container for the Open Software Gateway initiative (OSGi) applications. This is mainly because more and more people can see the benefits of OSGi in terms of the reuse of components, versioning, and reduced complexity with real modular applications.

People are also looking for a ready-to-use container that provides all the features expected in a mission-critical and enterprise-ready environment: management, monitoring, and provisioning. It's what Karaf provides, simplifying the development, execution, and production of OSGi applications. However, Karaf is more than a container focused on OSGi; even though it's powered by OSGi, it also supports non-OSGi applications such as Spring or web applications.

In modern architecture, most of the time, we don't have a single instance of the container to be running. In order to provide scalability and high availability, a classic architecture contains multiple container instances that form a farm or cluster of Karaf containers. This architecture brings up new questions: how do you deploy your application components on different instances? How can you target this deployment only on a subset of nodes for staging purposes, for instance? How can you deal with the configuration on different nodes?

Apache Karaf Cellar has been created to address these questions and many more questions.

This book will begin by giving you the means to understand OSGi and Apache Karaf as well as the concepts of a provisioning cluster. By doing so, it will provide the baseline needed before you shift to the advanced usage of Cellar, such as cluster groups or the filtering of cluster events.

This book details the Cellar architecture and the different commands provided by Cellar, from the installation up to the management of clusters.

More than a simple provisioning or synchronization cluster, this book will show you the Cellar runtime features such as Distributed OSGi (DOSGi) and interaction with Apache Camel to create a multinode integration platform.

Using this book, readers will get a detailed understanding, through how-to steps, to set up a cluster of Karaf nodes.

What this book covers

Chapter 1, Apache Karaf – Provisioning and Clusters, reviews what an OSGi is, the purposes, architectures, and components. We will introduce details about the Apache Karaf container, its architecture, and features. We will also introduce the question of how to manage multiple Apache Karaf instances.

Chapter 2, Apache Karaf Cellar, introduces Apache Karaf Cellar and the different cluster topologies that it can address. After the presentation of the Cellar architecture, we will perform our first cluster installation and manage different resources on the cluster using different techniques to monitor the current cluster state.

Chapter 3, Hazelcast, digs into the Cellar engine. After the introduction of Hazelcast, we will see different configurations that are useful for Cellar, especially around the network setup.

Chapter 4, Cluster Groups, shows you how to set up cluster groups in Cellar, allowing you to create a subset of nodes and target provisioning.

Chapter 5, Producers, Consumers, Handlers, Listeners, and Synchronizers, introduces you to the Cellar components used for the production, consumption, and transportation of cluster events between different nodes in a cluster.

Chapter 6, The Filtering of Cluster Events, shows you how to filter cluster events, allowing a fine-grained configuration of the resource synchronization in a cluster.

Chapter 7, DOSGi, shows that Cellar is not just a provisioning and synchronization clustering solution by introducing the first runtime clustering feature provided by Cellar: DOSGi. We will see how to use Cellar to implement remote communication between bundles located on different nodes using an example.

Chapter 8, Cellar and Camel, shows the second runtime clustering feature provided by Cellar by leveraging the camel-hazelcast component. Thanks to Cellar and Hazelcast, we will see how to implement remote communication between the Camel routes located on different nodes through an example.

Chapter 9, Roadmap, presents the new ideas and features that will come in the future versions of Cellar. This chapter gives an overview of the Cellar roadmap.

What you need for this book

In this book, the software required is as follows:

  • Operating systems: Any system that supports Java:

    • Windows XP or superior

    • Unix (Linux, AIX, Solaris, and so on)

  • Java JDK 1.7

  • Apache Karaf Cellar 2.3.4

Who this book is for

This book is for developers and system administrators who want to implement a clustering solution for Apache Karaf. They will master and dominate Cellar from installation to advanced usage. Thanks to the first chapter, even if you are not familiar with Karaf, you will receive a comprehensive look at Apache Karaf before you jump into the details of clustering.


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.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "You have to copy the JDBC driver JAR file into the lib/ext folder."

A block of code is set as follows:


Any command-line input or output is written as follows:

karaf@node1> config:edit my
karaf@node1> config:propset key other
karaf@node1> config:update


Warnings or important notes appear in a box like this.


Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title through the subject of your message.

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 on

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.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.


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 would 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, 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.


Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.


You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.