Apache Karaf


Apache Karaf is a lighweigh, powerful container that supports the "run anywhere". It can be used (on any machine with Java, cloud, docker images) using the embedded mode.With this flexibility, Karaf is the perfect solution for microservices, systems integration, big data, and much more. Apache Karaf is powered by OSGi (but you don’t need to know what OSGi is to use Karaf). Apache Karaf uses either the Apache Felix or Eclipse Equinox OSGi frameworks, providing additional features on top of the framework. Apache Karaf can be scaled from a very lightweight container to a fully featured enterprise service: it’s a very flexible and extensible container, covering all the major needs.


OS: Run on any OS (Windows, Linux etc.)
Disk space:At least 20 MB but recommended 100 to 1000MB for logging, bundle cache, and repository.
Memory: At least 128 MB but 2GB recommended.
JRE: 1.6 and above.

Installation Of Karaf:

Installation of Karaf is very simple.
1) If you dont have java Install JAVA SE 7 or above version.
2) Download Karaf Click Here
3) Extract the archive to a new folder on your hard drive; for example in /home/kb/karaf
4) To start the server, run the command :/bin/karaf

Karaf Lifecycle:

Karaf is a lightweight container. In a web application, we create the war file, similarly using OSGi we create a modular application. Each module is called bundle this bundle is nothing but the jar with additional information. This module is deployed into karaf. Following is life cycle diagram for a bundle in karaf.
1) Install bundle into karaf. bundle:install "location of jar file". Bundle is in installed state.
2) Once bundle installed, all required dependency are resolved by karaf means additional jar required for that bundle is downloaded.
3) To run the bundle use start command. start "bundle ID"
4) After bundle started it is in active state.
5) To stop the bundle use command stop "bundle ID"
6) After stop the bundle it is in unresolved state. All dependency are removed.
7) To uninstall bundle use command uninstall "bundle ID"

Features provided by Karaf:

Hot deployment: simply drop a file in the /deploy/ directory, Apache Karaf will detect the type of the file and try to deploy it.
Complete Console: Apache Karaf provides a complete Unix-like console where you can completely manage the container.
Dynamic Configuration: Apache Karaf provides a set of commands focused on managing its own configuration. All configuration files are centralized in the /etc/ folder. Any change in a configuration file is noticed and reloaded.
Advanced Logging System: Apache Karaf supports all the popular logging frameworks (slf4j, log4j, etc). Whichever logging framework you use, Apache Karaf centralizes the configuration in one file.
Provisioning: Apache Karaf supports a large set of URLs where you can install your applications (Maven repository, HTTP, file, etc). It also provides the concept of "Karaf Features" which is a way to describe your application.
Management: Apache Karaf is an enterprise-ready container, providing many management indicators and operations via JMX.
Remote: Apache Karaf embeds an SSHd server allowing you to use the console remotely. The management layer is also accessible remotely.
Security: Apache Karaf provides a complete security framework (based on JAAS), and provides a RBAC (Role-Based Access Control) mechanism for console and JMX access. Instances: multiple instances of Apache Karaf can be managed directly from a main instance (root).
OSGi frameworks: Apache Karaf is not tightly coupled to one OSGi framework. By default, Apache Karaf runs with the Apache Felix Framework, but you can easily switch to Equinox (just change one property in a configuration file).

That's all for Karaf. Now you will have enough information to use KARAF for developing applications.


Post a Comment