【Apache之 Karaf 介绍】

一、Apache Karaf 介绍

Apache Karaf is a modern and polymorphic container.

Karaf是Apache旗下的一个开源项目.Karaf同时也是一个基于OSGi的运行环境,Karaf提供了一个轻量级的OSGi容器,可以用于部署各种组件,应用程序.Karaf提供了很多特性用于帮助开发者和用户更加灵活的部署应用.

karaf是一个现代的、多种形态的(polymorphic),轻量的、强大的、经过OSGI认证的企业级容器。这里的多种形态指的是它能够容纳各种应用,诸如OSGI、SPRING、WAR等等。

karaf可以作为一个独立容器使用,也可以使用karaf boot作一个启动器。

It's a lightweight, powerful, and enterprise ready container powered by OSGi.

You can deploy different kind of applications in Karaf, OSGi or non-OSGi.

With this flexibility, Karaf is the perfect container for microservices, systems integration, big data, and much more.

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.

二、Apache Karaf 特性

Here is a short list of provided features:

1)Hot deployment: simply drop a file in the deploy directory, Apache Karaf will detect the type of the file and

try to deploy it.

2)Complete Console: Apache Karaf provides a complete Unix-like console where you can completely manage the container.

3)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.

4)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.

5)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.

6)Management: Apache Karaf is an enterprise-ready container, providing many management indicators and operations

via JMX.

7)Remote: Apache Karaf embeds an SSHd server allowing you to use the console remotely. The management layer is also

accessible remotely.

8)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.

9)Instances: multiple instances of Apache Karaf can be managed directly from a main instance (root).

10)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).

karaf有如下特点:

热部署:你可以直接将你的应用拖到karaf的deploy文件夹下,就可以实现自动部署,用户也可以实现自己的部署器。

动态配置:所有的配置,包括karaf自身和应用的配置都放置在karaf的etc文件夹下。在配置文件中的变化都会立即生效,不需要重启。

日志系统:karaf使用了一个集中式的日志后端,支持多种流行的日志框架,比如log4j,slf4j,logback等

Provisioning:karaf提供了一种提供应用的方法,叫做karaf features

shell控制台:karaf提供一个完善的类unix控制台,用户可以用它来管理容器和应用,这个控制台支持不全、上下文帮助、快捷键等

远程管理:karaf内置了一个ssh服务器,允许你使用一个ssh客户端远程连接,此外,karaf还提供了JMX MBean服务,允许你使用JMX客户端管理你的容器

WEB控制台:通过karaf webconsole提供了基于web的容器管理方式

安全:Karaf完全支持基于JAAS的安全框架。此外还为shell命令和JMX对象支持RBAC控制。用户可以直接在应用中使用karaf的安全层

实例管理:可以在karaf容器的根实例下管理多个子实例,通过子实例可以方便的在不影响已运行实例的情况下进行应用和配置测试。

Apache Karaf体系结构

 

 

四、Apache Karaf 安装目录结构

Karaf安装目录结构如下:

/bin: 启动脚本

/etc: 初始化文件

/data: 工作目录

/cache: OSGi框架包缓存

/generated-bundles: 部署使用的临时文件夹

/log: 日志文件

/deploy: 热部署目录

/instances: 含有子实例的目录

/lib: 包含引导库

/lib/ext:JRE扩展目录

/lib/endorsed: 赞同库目录

/system: OSGi包库,作为一个Maven2存储库

Data文件夹包括karaf所有的工作和临时文件,如果你想从一个初始状态重启,你可以清空这个目录,这和“恢复初始化设置”一样的效果。

猜你喜欢

转载自gaojingsong.iteye.com/blog/2368214