Apache Karaf Cellar 2.2.1 Released
Apache Karaf Cellar 2.2.1 has been released today.
Cellar is a Karaf sub-project which aim to provide a clustering solution for Karaf.
Quick start
To enable Cellar into a Karaf, you just have to install the Cellar feature.
First, register the Cellar features descriptor in your running Karaf instance:
karaf@root> features:addurl mvn:org.apache.karaf.cellar/apache-karaf-cellar/2.2.1/xml/features
Now, you can see the Cellar features available:
karaf@root> features:list|grep -i cellar
[uninstalled] [2.2.1 ] cellar Karaf clustering
[uninstalled] [2.2.1 ] cellar-webconsole Karaf Cellar Webconsole Plugin
To start Cellar, install the cellar feature:
karaf@root> features:install cellar
It’s done: your Karaf instance is Cellar cluster ready.
You can see your cluster node ID and, eventually, others cluster nodes:
karaf@root> cluster:list-nodes
No. Host Name Port ID
* 1 node1.local 5701 node1.local:5701
2 node2.local 5702 node2.local:5702
The * indicates your local node (on which you are connected).
You can ping a given node to see how the network behaves:
karaf@root> cluster:ping node2.local:5702
Pinging node :node2.local:5702
PING 1 node2.local:5702 82ms
PING 2 node2.local:5702 11ms
PING 3 node2.local:5702 14ms
Now, if you install a feature, it will be installed on all nodes. For instance, if you install eventadmin feature on node1:
karaf@node1> features:install eventadmin
karaf@node1> features:list|grep -i eventadmin
[installed ] [2.2.1 ] eventadmin karaf-2.2.1
you can see it installed on node2:
karaf@node2> features:list|grep -i eventadmin
[installed ] [2.2.1 ] eventadmin karaf-2.2.1
Cellar groups
In Karaf Cellar, you can define cluster groups. It allows you to select nodes and resources involved in one group.
By default, you have the default group:
karaf@root> cluster:group-list
Node Group
* node1.local:5701 default
node2.local:5702 default
You can create a route, for instance test:
karaf@root> cluster:group-create test
Name test
Members []
For now, the group doesn’t have any member:
kaaf@root> cluster:group-list
Node Group
node1.local:5701 default
* node2.local:5702 default
test
We can add a node as a member of a cluster group:
karaf@root> cluster:group-join test node1.local:5701
Node Group
node1:5701 default
* node2:5702 default
node1:5701 test
The node could be local or remote.
Cluster units
Currently, Apache Karaf Cellar is able to manage features and configuration. It’s based on an event-driven model.
It means that Cellar is listening for some events (such as install/start/remove features, or set configuration) and fire the actions on all nodes.
Features
You can list the features of a given group:
karaf@root> cluster:features-list test
The feature events (install, uninstall) are sync between all members of the same cluster group.
Configuration
Cellar is able to manage configuration event, as it does for features.
You can see the configuration PID associated to a given cluster group:
karaf@root> cluster:config-list test
No PIDs found for group:test
You can create a configuration (with a PID) directly into a given group:
karaf@root> cluster:config-propset test my mykey myvalue
Now, we can see this configuration in the cluster memory:
karaf@root> cluster:config-list test
PIDs for group:test
PID
my
and the value in this configuration PID:
karaf@root> cluster:config-proplist test my
Property list for PID:my for group:test
Key Value
mykey myvalue
Now, you can see that the cluster group test doesn’t have any member for now:
karaf@root> cluster:group-list
Node Group
* node1.local:5701 default
test
If I list the configuration on my node1 local instance, my is not known:
karaf@root> config:list "(pid=my)"
Now, node1 join the test cluster group:
karaf@root> config:group-join test node1.local:5701
And, now, the node1.local inherits of the configuration defined in the cluster:
karaf@root> config:edit my
karaf@root> proplist
service.pid = my
mykey = myvalue
Now, time to work 🙂
OK, we have a first release of Karaf Cellar, allowing mainly discovery, group and state replication between Karaf instances. The bundle events support is also quite implemented (it just needs to be finalized).
We are going to add JMX Cellar MBeans and logging message with Mike Van. As Cellar is fully based on Blueprint, adding MBeans should be very easy and quick 🙂
But it’s not enough 🙂
Now, I’m sure you have a question: is it possible to have a kind of shared OSGi services registry, with proxy, and be able (transparently or not) to use a remote service ? Do we have DOSGi support ?
The short answer is: not in Cellar 2.2.1.
But, we are working on these two topics (I name it “distributed service registry” and “transport”) and it should be included the next Cellar releases.
I hope you enjoy this new Karaf sub-project.
Comments
Post a Comment