Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Learning Karaf Cellar
Learning Karaf Cellar

Learning Karaf Cellar: Build and implement a complete clustering solution for the Apache Karaf OSGi container

Arrow left icon
Profile Icon Jean-Baptiste Onofré
Arrow right icon
€8.99 €14.99
Full star icon Full star icon Full star icon Full star icon Full star icon 5 (1 Ratings)
eBook Jul 2014 124 pages 1st Edition
eBook
€8.99 €14.99
Paperback
€18.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon Jean-Baptiste Onofré
Arrow right icon
€8.99 €14.99
Full star icon Full star icon Full star icon Full star icon Full star icon 5 (1 Ratings)
eBook Jul 2014 124 pages 1st Edition
eBook
€8.99 €14.99
Paperback
€18.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€8.99 €14.99
Paperback
€18.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Learning Karaf Cellar

Chapter 2. Apache Karaf Cellar

Apache Karaf Cellar is a provisioning cluster solution for Apache Karaf.

It's an Apache Karaf subproject released under the Apache 2 license. To know more, please visit http://karaf.apache.org/index/subprojects/cellar.html.

Apache Karaf Cellar allows you to manage a farm of Apache Karaf instances spread over different machines and networks.

As a provisioning cluster solution, Apache Karaf Cellar synchronizes the states of the different instances. By synchronization, we mean that an action on a resource from a node will result in a notification to change for the other nodes.

The following topics will be covered in this chapter:

  • Cluster topologies
  • Apache Karaf Cellar architecture
  • Apache Karaf Cellar installation
  • Cluster resources

Cluster topologies

When we talk about provisioning clusters, it means that we have to store and share the status of resources between different instances.

We name the node as an instance member of the provisioning cluster.

We can see two approaches to share the status of the resources.

The first approach is to use a central component to store the status. This central component is named cluster manager. It's responsible for storing the data shared between the nodes and the communication between the nodes. Have a look at the following diagram:

Cluster topologies

All nodes are connected to a central component storing the status of the resources. For instance, this component could be Apache ZooKeeper.

The advantage of this approach is that the provisioning cluster has no impact on the nodes; a node just communicates with the central component.

The cluster manager is not just a simple shared storage, as it has to deal with the communication and transport of information between the nodes.

A drawback of this approach...

Apache Karaf Cellar architecture

Apache Karaf Cellar provides an API to implement the cluster component. The default cluster component implementation is powered by Hazelcast.

Hazelcast is a clustering and scalable data distribution solution. It provides features that exactly match the needs for the cluster component, especially the following:

  • A distributed storage implementation. This is where Apache Karaf Cellar will store the resources' status.
  • A distributed topic for publish/subscribe messaging. Apache Karaf Cellar will use this distributed topic to implement cluster events.

These are the two functionalities we are looking for in our cluster component.

However, Hazelcast also provides additional features. Thanks to Hazelcast, Apache Karaf Cellar supports different ways to discover the nodes of the cluster: static IP address definition, multicast, and whiteboard registration. The following diagram shows the modules provided by Karaf:

Apache Karaf Cellar architecture

The first thing to do is install Cellar in the different...

Apache Karaf Cellar installation and first commands

Apache Karaf Cellar is provided as a Karaf feature.

Throughout this book, we will use the following installation:

  • Node 1 is a server running with the 192.168.1.1 network address. It hosts an Apache Karaf 2.3.3 instance running in the /opt/apache-karaf folder.
  • Node 2 is another server running with the 192.168.1.2 network address. It hosts an Apache Karaf 2.3.3 instance running in the /opt/apache-karaf folder.
  • Both servers have Internet access.

We connect to the Apache Karaf instance on node 1 (using SSH or client) to install the Apache Karaf Cellar feature, as follows:

karaf@node1> features:addurl mvn:org.apache.karaf.cellar/apache-karaf-cellar/2.3.1/xml/features
karaf@node1> features:install cellar

It's done! Apache Karaf Cellar is installed and operating on node1.

We can now install Apache Karaf Cellar on node 2. We connect on node 2 (using SSH or client) and install the Apache Karaf Cellar feature, as follows:

karaf@node2> features...

Cluster resources

By default, Apache Karaf Cellar supports the clustering and distribution of different resources.

Cellar is able to manage the resources covered in the following sections.

Bundles

Apache Karaf Cellar is able to sync the status of OSGi bundles on the cluster.

Thanks to the bundle listener, all actions that you may perform on a bundle are spread onto the cluster. You can also use dedicated cluster commands to manipulate the bundles on the cluster.

For instance, it's possible to see the bundles available on the cluster with their current status using the cluster:bundle-list command as follows:

karaf@node1> cluster:bundle-list default
Bundles in cluster group default
 ID      State     Name
[0   ] [Active] Apache Karaf :: Cellar :: Utils (2.3.1)
[1   ] [Active] Apache Karaf :: JAAS :: Config (2.3.3)
[2   ] [Active] Apache Karaf :: Diagnostic :: Command (2.3.3)
[3   ] [Active] Apache Karaf :: Deployer :: Spring (2.3.3)
[4   ] [Active] Apache Aries Proxy Service (1.0.1)
[5...

Summary

In this chapter, we have introduced the Apache Karaf Cellar topology and architecture.

We also installed Apache Karaf Cellar and used some basic commands to sync two nodes in a cluster. The next chapter will describe the configuration files used by Apache Karaf Cellar and the usage of Hazelcast.

Left arrow icon Right arrow icon

Description

This book is a tutorial written with a step-by-step approach to help you implement an optimum clustering solution in Apache Karaf Cellar quickly and efficiently. If you are new to Karaf and want to install and manage multiple Karaf instances by farming or clustering, then this book is for you. If you are a Java developer or a system administrator with basic knowledge of Karaf, you can use this book as a guide. Some background knowledge of OSGi and/or Karaf would be preferred but is not mandatory.

What you will learn

  • Explore the Apache Karaf OSGi container and its features
  • Install and configure multiple Karaf containers
  • Leverage Hazelcast using Cellar to provide clustering
  • Create and manage multiple cluster groups
  • Discover the different components of Cellar and how to administrate them
  • Implement a finegrained topology by filtering cluster events
  • Use Cellar to implement remote communication between OSGi bundles (DOSGi)
  • Use Cellar with Camel to implement a remote communication between Camel routes and a distributed cache

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jul 22, 2014
Length: 124 pages
Edition : 1st
Language : English
ISBN-13 : 9781783984619
Category :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Jul 22, 2014
Length: 124 pages
Edition : 1st
Language : English
ISBN-13 : 9781783984619
Category :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 90.97
Learning Karaf Cellar
€18.99
APACHE KARAF COOKBOOK
€29.99
Apache Camel Developer's Cookbook
€41.99
Total 90.97 Stars icon
Banner background image

Table of Contents

10 Chapters
1. Apache Karaf – Provisioning and Clusters Chevron down icon Chevron up icon
2. Apache Karaf Cellar Chevron down icon Chevron up icon
3. Hazelcast Chevron down icon Chevron up icon
4. Cluster Groups Chevron down icon Chevron up icon
5. Producers, Consumers, Handlers, Listeners, and Synchronizers Chevron down icon Chevron up icon
6. The Filtering of Cluster Events Chevron down icon Chevron up icon
7. DOSGi Chevron down icon Chevron up icon
8. Cellar and Camel Chevron down icon Chevron up icon
9. Roadmap Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Full star icon 5
(1 Ratings)
5 star 100%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
Rodrigo Serra Dec 14, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Nice introductory book
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.