<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jean-Baptiste Onofré&#039;s Blog &#187; Apache</title>
	<atom:link href="http://blog.nanthrax.net/category/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.nanthrax.net</link>
	<description></description>
	<lastBuildDate>Sun, 28 Apr 2013 08:59:43 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Load balancing with Apache Karaf Cellar, and mod_proxy_balancer</title>
		<link>http://blog.nanthrax.net/2013/02/load-balancing-with-apache-karaf-cellar-and-mod_proxy_balancer/</link>
		<comments>http://blog.nanthrax.net/2013/02/load-balancing-with-apache-karaf-cellar-and-mod_proxy_balancer/#comments</comments>
		<pubDate>Sun, 03 Feb 2013 18:09:44 +0000</pubDate>
		<dc:creator>jbonofre</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Apache Karaf]]></category>
		<category><![CDATA[cellar]]></category>
		<category><![CDATA[karaf]]></category>
		<category><![CDATA[pax-web]]></category>

		<guid isPermaLink="false">http://blog.nanthrax.net/?p=359</guid>
		<description><![CDATA[Thanks to Cellar, you can deploy your applications, CXF services, Camel routes, &#8230; on several Karaf nodes. When you use Cellar with web applications, or CXF/HTTP endpoints, a &#8220;classic&#8221; need is to load balance the HTTP requests on the Karaf nodes. You have different ways to do that: - using Camel Load Balancer EIP: it&#8217;s [...]]]></description>
				<content:encoded><![CDATA[<p>Thanks to Cellar, you can deploy your applications, CXF services, Camel routes, &#8230; on several Karaf nodes.</p>
<p>When you use Cellar with web applications, or CXF/HTTP endpoints, a &#8220;classic&#8221; need is to load balance the HTTP requests on the Karaf nodes.</p>
<p>You have different ways to do that:<br />
- using Camel Load Balancer EIP: it&#8217;s an interesting EIP, working with any kind of endpoints. However, it requires to have a Karaf running the Load Balancer routes, so it&#8217;s not always possible depending of the user security policy (for instance, putting it in DMZ or so)<br />
- using hardware appliances like F5, Juniper, Cisco: it&#8217;s a very good solution, &#8220;classic&#8221; solution in network teams. However, it requires expensive hardwares, not easy to buy and setup for test or &#8220;small&#8221; solution.<br />
- using Apache httpd with mod_proxy_balancer: it&#8217;s the solution that I&#8217;m going to detail. It&#8217;s a very stable solution, powerful and easy to setup. And it costs nothing <img src='http://blog.nanthrax.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>For instance, you have three Karaf nodes, exposing the following services and the hostname:<br />
- http://192.168.134.3:8040/services<br />
- http://192.168.134.4:8040/services<br />
- http://192.168.134.5:8040/services</p>
<p>We want to load balance those three nodes.</p>
<p>On a dedicated server (it could be installed on one hosting Karaf), we just install Apache httpd:</p>
<p><code><br />
# on Debian/Ubuntu system<br />
aptitude install apache2<br />
</code></p>
<p><code><br />
# on RHEL/CentOS/Fedora system<br />
yum install httpd<br />
# enable network connect on httpd<br />
/usr/sbin/setsebool -P httpd_can_network_connect 1<br />
</code></p>
<p>Apache httpd comes with mod_proxy, mod_proxy_http, and mod_proxy_balancer modules. Just check if those modules are loaded in the main httpd.conf.</p>
<p>You can now create a new configuration for your load balancer (directly in the main httpd.conf or by creating a conf file in etc/httpd/conf.d):</p>
<p><code><br />
&lt;Proxy balancer://mycluster&gt;<br />
&nbsp; BalancerMember http://192.168.134.3:8040<br />
&nbsp; BalancerMember http://192.168.134.4:8040<br />
&nbsp; BalancerMember http://192.168.134.5:8040<br />
&lt;/Proxy&gt;<br />
ProxyPass /services balancer://mycluster<br />
</code></p>
<p>The load balancer will proxy the /services requests to the different Karaf nodes.</p>
<p>By default, the mod_proxy_balancer module uses a byrequests algorithm: all nodes will receive the same number of requests.<br />
You can switch to bytraffic (using the lbmethod=bytraffic in the proxy configuration): in that case, all nodes will receive the same amount of traffic (by KB).</p>
<p>The mod_proxy_balancer module is able to support session &#8220;affinity&#8221; if your application needs it.<br />
When a request is proxied to some back-end, then all following requests from the same user should be proxied to the same back-end.<br />
For instance, you can use the cookie in header to define the session affinity:</p>
<p><code><br />
Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED<br />
&lt;Proxy balancer://mycluster&gt;<br />
&nbsp; BalancerMember http://192.168.134.3:8040 route=1<br />
&nbsp; BalancerMember http://192.168.134.4:8040 route=2<br />
ProxySet stickysession=ROUTEID<br />
&lt;/Proxy&gt;<br />
ProxyPass /myapp balancer://mycluster<br />
</code></p>
<p>The mod_proxy_balancer module also provide a web manager allowing you to see if your Karaf nodes are up or not, the number of requests received by each node, and the current lbmethod in use.</p>
<p>To enable this balancer manager, you just have to add a dedicated handler:</p>
<p><code><br />
&lt;Location /balancer-manager&gt;<br />
&nbsp; SetHandler balancer-manager<br />
&nbsp; Order allow,deny<br />
&nbsp; Allow from all<br />
&lt;/Location&gt;<br />
</code></p>
<p>Point your browser to http://host/balancer-manager and you will see the manager page.</p>
<p>You can find more information about mod_proxy_balancer here: <a href="http://httpd.apache.org/docs/2.2/mod/mod_proxy_balancer.html">http://httpd.apache.org/docs/2.2/mod/mod_proxy_balancer.html</a>.</p>
<p>Apache httpd with mod_proxy_balancer is an easy and good HTTP load balancer solution in front of Karaf and Cellar.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nanthrax.net/2013/02/load-balancing-with-apache-karaf-cellar-and-mod_proxy_balancer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multiple HTTP connectors in Apache Karaf</title>
		<link>http://blog.nanthrax.net/2013/02/multiple-http-connectors-in-apache-karaf/</link>
		<comments>http://blog.nanthrax.net/2013/02/multiple-http-connectors-in-apache-karaf/#comments</comments>
		<pubDate>Sun, 03 Feb 2013 17:26:30 +0000</pubDate>
		<dc:creator>jbonofre</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Apache Karaf]]></category>
		<category><![CDATA[karaf]]></category>
		<category><![CDATA[pax-web]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://blog.nanthrax.net/?p=352</guid>
		<description><![CDATA[Installing the http feature in Karaf leverages Pax Web to embed a Jetty webcontainer. By default, Karaf create a Jetty connector on the 8181 http port (and 8443 for https). You can change this port number by providing etc/org.ops4j.pax.web.cfg file. But, you can also create new connector in the embedded Jetty. You may see several [...]]]></description>
				<content:encoded><![CDATA[<p>Installing the http feature in Karaf leverages Pax Web to embed a Jetty webcontainer.</p>
<p>By default, Karaf create a Jetty connector on the 8181 http port (and 8443 for https). You can change this port number by providing etc/org.ops4j.pax.web.cfg file.</p>
<p>But, you can also create new connector in the embedded Jetty.</p>
<p>You may see several advantages for multiple connectors:</p>
<ul>
<li>you can isolate a set of applications, CXF services, Camel routes on a dedicated port number</li>
<li>you can setup a different configuration for each connector. For instance, you can create two SSL connectors, each with a different keystore, truststore, &#8230;</li>
</ul>
<p>You can find etc/jetty.xml configuration file where you can create custom Jetty configuration.</p>
<p>NB: if you want to have both etc/org.ops4j.pax.web.cfg and etc/jetty.xmll, don&#8217;t forget to reference jetty.xml in org.ops4j.pax.web.cfg using the org.ops4j.pax.web.config.file property pointing to the jetty.xml, for instance:</p>
<p><code><br />
# in etc/org.ops4j.pax.web.cfg<br />
org.ops4j.pax.web.config.file=${karaf.home}/etc/jetty.xml<br />
</code></p>
<p>To configure a new connector, you can add a addConnector call in this configuration. For instance, we can create a new connector on 9191 http port number (and 9443 https port number):</p>
<p><code><br />
&nbsp; &lt;Call name="addConnector"&gt;<br />
&nbsp; &nbsp; &lt;Arg&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;New class="org.eclipse.jetty.server.nio.SelectChannelConnector"&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;Set name="host"&gt;0.0.0.0&lt;/Set&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;Set name="port"&gt;9191&lt;/Set&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;Set name="maxIdleTime"&gt;300000&lt;/Set&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;Set name="Acceptors"&gt;1&lt;/Set&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;Set name="statsOn"&gt;false&lt;/Set&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;Set name="confidentialPort"&gt;9443&lt;/Set&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;Set name="name"&gt;myConnector&lt;/Set&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;/New&gt;<br />
&nbsp; &nbsp; &lt;/Arg&gt;<br />
&nbsp; &lt;/Call&gt;<br />
</code></p>
<p>Now, Karaf will listen on 8181 and 9191 (for http), 8443 and 9443 (for https).</p>
<p>You can also define a connector dedicated to https with dedicated configuration for this connection, especially keystore, truststore, and client authentication:</p>
<p><code><br />
&nbsp; &lt;Call name="addConnector"&gt;<br />
&nbsp; &nbsp; &lt;Arg&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector"&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;Set name="port"&gt;9443&lt;/Set&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;Set name="maxIdleTime"&gt;30000&lt;/Set&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;Set name="keystore"&gt;./etc/keystore&lt;/Set&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;Set name="password"&gt;password&lt;/Set&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;Set name="keyPassword"&gt;password&lt;/Set&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;/New&gt;<br />
&nbsp; &nbsp; &lt;/Arg&gt;<br />
&nbsp; &lt;/Call&gt;<br />
</code></p>
<p>By default, the web application will be bind on all connectors. If you want that your web application use a specific connector, you have to define it in the MANIFEST using the following properties:</p>
<p><code><br />
Web-Connectors: myConnector<br />
Web-VirtualHosts: localhost<br />
</code></p>
<p>If you use CXF services or Camel routes, if you use a connetor hostname and port number in the endpoint, it will use the corresponding connector.</p>
<p>For instance, the following CXF endpoint of a Camel route will use myConnector:</p>
<p><code><br />
...<br />
&nbsp; &lt;cxf:cxfEndpoint id="cxfEndpoint" address="http://localhost:9191/services/myservice" wsdlUrl="..."/&gt;<br />
...<br />
</code></p>
<p>Karaf allows you a fine grained Jetty configuration. Karaf becomes a real complete WebContainer, with custom configuration on several connectors. It&#8217;s especially interesting for SSL connector where each connector can have a dedicated keystore and truststore, and client authentication configuration.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nanthrax.net/2013/02/multiple-http-connectors-in-apache-karaf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create custom log4j appender for Karaf and Pax Logging</title>
		<link>http://blog.nanthrax.net/2012/12/create-custom-log4j-appender-for-karaf-and-pax-logging/</link>
		<comments>http://blog.nanthrax.net/2012/12/create-custom-log4j-appender-for-karaf-and-pax-logging/#comments</comments>
		<pubDate>Sat, 15 Dec 2012 18:12:03 +0000</pubDate>
		<dc:creator>jbonofre</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Apache Karaf]]></category>
		<category><![CDATA[karaf]]></category>

		<guid isPermaLink="false">http://blog.nanthrax.net/?p=333</guid>
		<description><![CDATA[Karaf leverages Pax Logging for the logging layer. Pax Logging provides an abstraction service for most popular logging frameworks, like SLF4J, Log4j, commons-logging, etc. Karaf provides a default logging configuration in etc/org.ops4j.pax.logging.cfg file. By default, all INFO log messages (rootLogger) are send into a file appender (in data/log/karaf.log). The file appender &#8220;maintains&#8221; one file of [...]]]></description>
				<content:encoded><![CDATA[<p>Karaf leverages Pax Logging for the logging layer. Pax Logging provides an abstraction service for most popular logging frameworks, like SLF4J, Log4j, commons-logging, etc.</p>
<p>Karaf provides a default logging configuration in etc/org.ops4j.pax.logging.cfg file.</p>
<p>By default, all INFO log messages (rootLogger) are send into a file appender (in data/log/karaf.log). The file appender &#8220;maintains&#8221; one file of 1MB, and store up to 10 backup files.</p>
<h2>Adding a new appender configuration, example with Syslog appender</h2>
<p>We can add new appender configuration in the Karaf logging module.</p>
<p>For instance, we can add a syslog appender in etc/org.ops4j.pax.logging.cfg:</p>
<p><code><br />
log4j.rootLogger = INFO, out, syslog, osgi:*<br />
...<br />
# Syslog appender<br />
log4j.appender.syslog=org.apache.log4j.net.SyslogAppender<br />
log4j.appender.syslog.layout=org.apache.log4j.PatternLayout<br />
log4j.appender.syslog.layout.ConversionPattern=[%p] %c:%L - %m%n<br />
log4j.appender.syslog.syslogHost=localhost<br />
log4J.appender.syslog.facility=KARAF<br />
log4j.appender.syslog.facilityPrinting=false<br />
...<br />
</code> </p>
<p>We create the syslog appender configuration, and we use this appender for the rootLogger.</p>
<p>Pax Logging provides all default Log4j appenders.</p>
<h2>Creating a custom appender</h2>
<p>It&#8217;s also possible to create your own appender.</p>
<p>For instance, you want to create MyJDBCAppender, extending the standard Log4J JDBCAppender. MyJDBCAppender has a better management of the quote in the SQL query for a DB2 backend for instance:</p>
<p><code><br />
package org.apache.karaf.blog.logging.appender;</p>
<p>import org.apache.log4j.spi.LoggingEvent;<br />
import org.apache.log4j.jdbc.JDBCAppender;</p>
<p>/**<br />
 * Override apache log4j JDBCAppender for DB2 use (escaping of ' char in data)<br />
 * Need proper substitution of the ' char by {@link SQL_APOS} in the writing of the log4j sql property<br />
 */<br />
public class MyJDBCAppender extends JDBCAppender {</p>
<p>    private static final String SQL_APOS = "{sql_apos}";<br />
    private static final String XML_APOS = "&apos;";</p>
<p>    /** {@inheritDoc} */<br />
    @Override<br />
    protected String getLogStatement(LoggingEvent event) {<br />
        String sqlLayout = getLayout().format(event);<br />
        // escape ' as standard sequence (&apos;) in the sql statement after layout<br />
        sqlLayout = sqlLayout.replace("'", XML_APOS);<br />
        // revert specific sequence as ' to have final executable sql statement<br />
        sqlLayout = sqlLayout.replace(SQL_APOS, "'");<br />
        return sqlLayout;<br />
    }</p>
<p>}<br />
</code></p>
<p>We put the MyJDBCAppender java file in a src/main/java/org/apache/karaf/blog/logging folder.</p>
<p>We package this appender as an OSGi bundle. This bundle is a fragment to the Pax Logging service bundle:</p>
<p><code><br />
&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br />
&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;</p>
<p>&nbsp; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;</p>
<p>&nbsp; &lt;groupId&gt;org.apache.karaf.blog.logging.appender&lt;/groupId&gt;<br />
&nbsp; &lt;artifactId&gt;org.apache.karaf.blog.logging.appender.jdbc&lt;/artifactId&gt;<br />
&nbsp; &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;<br />
&nbsp; &lt;packaging&gt;bundle&lt;/packaging&gt;</p>
<p>&nbsp; &lt;dependencies&gt;<br />
&nbsp; &nbsp; &lt;dependency&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;groupId&gt;org.ops4j.pax.logging&lt;/groupId&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;artifactId&gt;pax-logging-service&lt;/artifactId&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;version&gt;1.6.9&lt;/version&gt;<br />
&nbsp; &nbsp; &lt;/dependency&gt;<br />
&nbsp; &lt;/dependencies&gt;</p>
<p>&nbsp; &lt;build&gt;<br />
&nbsp; &nbsp; &lt;plugins&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;plugin&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;groupId&gt;org.apache.felix&lt;/groupId&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;artifactId&gt;maven-bundle-plugin&lt;/artifactId&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;version&gt;2.3.7&lt;/version&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;extensions&gt;true&lt;/extensions&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;configuration&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;instructions&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Bundle-SymbolicName&gt;org.apache.karaf.blog.logging.appender.jdbc&lt;/Bundle-SymbolicName&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Export-Package&gt;org.apache.karaf.blog.logging.appender&lt;/Export-Package&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Import-Package/&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Private-Package&gt;org.apache.log4j.jdbc&lt;/Private-Package&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Fragment-Host&gt;org.ops4j.pax.logging.pax-logging-service&lt;/Fragment-Host&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;_failok&gt;true&lt;/_failok&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/instructions&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/configuration&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;/plugin&gt;<br />
&nbsp; &nbsp; &lt;/plugins&gt;<br />
&nbsp; &lt;/build&gt;</p>
<p>&lt;/project&gt;<br />
</code></p>
<p>We can use our appender in etc/org.ops4j.pax.logging.cfg file, for instance:</p>
<p><code><br />
log4j.rootLogger = INFO, out, myappender, osgi:*<br />
...<br />
log4j.appender.myappender=org.apache.karaf.blog.logging.appender.MyJDBCAppender<br />
log4j.appender.myappender.url=jdbc:db2:....<br />
log4j.appender.myappender.driver=com.ibm.db2.jcc.DB2Driver<br />
log4j.appender.myappender.user=username<br />
log4j.appender.myappender.password=password<br />
log4j.appender.myappender.sql=insert into logs values({{sql_apos}%x{sql_apos}, {sql_apos}%d{sql_apos}, {sql_apos}%C{sql_apos}, {sql_apos}%p{sql_apos}, {sql_apos}%m{sql_apos})<br />
log4j.appender.myappender.layout=org.apache.log4j.PatternLayout<br />
</code></p>
<p>In order to be loading very early in the Karaf bootstrap, our appender bundle should be present in the system folder and defined in etc/startup.properties.</p>
<p>The system folder has a &#8220;Maven repo like&#8221; structure. So you have to copy with:</p>
<p><code><br />
system/groupId/artifactId/version/artifactId-version.jar<br />
</code></p>
<p>In our example, it means:</p>
<p><code><br />
mkdir -p $KARAF_HOME/system/org/apache/karaf/blog/logging/appender<br />
cp target/org.apache.karaf.blog.logging.appender.jdbc-1.0-SNAPSHOT.jar $KARAF_HOME/system/org/apache/karaf/blog/logging/appender/org.apache.karaf.blog.logging.appender.jdbc/1.0-SNAPSHOT/org.apache.karaf.blog.logging.appender.jdbc-1.0-SNAPSHOT.jar<br />
</code></p>
<p>and in etc/startup.properties, we define the appender bundle just after the pax-logging-service bundle:</p>
<p><code><br />
...<br />
org/ops4j/pax/logging/pax-logging-api/1.6.9/pax-logging-api-1.6.9.jar=8<br />
org/ops4j/pax/logging/pax-logging-service/1.6.9/pax-logging-service-1.6.9.jar=8<br />
org/apache/karaf/blog/logging/appender/org.apache.karaf.blog.logging.appender.jdbc/1.0-SNAPSHOT/org.apache.karaf.blog.logging.appender.jdbc-1.0-SNAPSHOT.jar=8<br />
...<br />
</code></p>
<p>You can now start Karaf, it will use our new custom appender.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nanthrax.net/2012/12/create-custom-log4j-appender-for-karaf-and-pax-logging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to enable HTTPS certificate client auth with Karaf</title>
		<link>http://blog.nanthrax.net/2012/12/how-to-enable-https-certificate-client-auth-with-karaf/</link>
		<comments>http://blog.nanthrax.net/2012/12/how-to-enable-https-certificate-client-auth-with-karaf/#comments</comments>
		<pubDate>Wed, 12 Dec 2012 14:39:48 +0000</pubDate>
		<dc:creator>jbonofre</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Apache Karaf]]></category>
		<category><![CDATA[karaf]]></category>

		<guid isPermaLink="false">http://blog.nanthrax.net/?p=316</guid>
		<description><![CDATA[I received many times messages from users asking how we can &#8220;trust&#8221; HTTP clients in Karaf. The purpose is to exchange certificates and allow only &#8220;trusted&#8221; clients to use the Karaf HTTP service. Enable HTTP client auth First of all, we have to enable the HTTP client auth support in Karaf. When you install the [...]]]></description>
				<content:encoded><![CDATA[<p>I received many times messages from users asking how we can &#8220;trust&#8221; HTTP clients in Karaf.</p>
<p>The purpose is to exchange certificates and allow only &#8220;trusted&#8221; clients to use the Karaf HTTP service.</p>
<h2>Enable HTTP client auth</h2>
<p>First of all, we have to enable the HTTP client auth support in Karaf.</p>
<p>When you install the HTTP feature, Karaf leverages Pax-Web to provide HTTP OSGi service:</p>
<p><code><br />
karaf@root> features:install http<br />
</code></p>
<p>Now, we have to add a custom etc/org.ops4j.pax.web.cfg file:</p>
<p><code><br />
org.osgi.service.http.port=8181</p>
<p>org.osgi.service.http.port.secure=8443<br />
org.osgi.service.http.secure.enabled=true<br />
org.ops4j.pax.web.ssl.keystore=./etc/keystores/keystore.jks<br />
org.ops4j.pax.web.ssl.password=password<br />
org.ops4j.pax.web.ssl.keypassword=password<br />
#org.ops4j.pax.web.ssl.clientauthwanted=false<br />
org.ops4j.pax.web.ssl.clientauthneeded=true<br />
</code></p>
<p>NB: clientauthwanted and clientauthneeded properties are valid for Karaf 2.2.x which use Pax Web 1.0.x.</p>
<p>Thanks to the clientauthneeded property, we &#8220;force&#8221; the client to be trusted.</p>
<h2>Create the trusted client certificate</h2>
<p>We are going to use keytool (provided with the JDK) to manipulate the keys and certificates.</p>
<p>The first step is to create two key pairs:</p>
<ul>
<li>one for the server side (use for SSL)</li>
<li>one as a example of client side (use for &#8220;trust&#8221;, should be performed for each client, on the client side)</li>
</ul>
<p><code><br />
mkdir -p etc/keystores<br />
cd etc/keystores<br />
keytool -genkey -keyalg RSA -validity 365 -alias serverkey -keypass password -storepass password -keystore keystore.jks<br />
keytool -genkey -keyalg RSA -validity 365 -alias clientkey -keypass password -storepass password -keystore client.jks<br />
</code></p>
<p>NB: these key are self-signed. In a production system, you should use a Certificate Authority (CA).</p>
<p>Now, we can export the client certificate to be imported in the server keystore:</p>
<p><code><br />
keytool -export -rfc -keystore clientKeystore.jks -storepass password -alias clientkey -file client.cer<br />
keytool -import -trustcacerts -keystore keystore.jdk -storepass password -alias clientkey -file client.cer<br />
</code></p>
<p>We can now check that the client certificate is trusted in our keystore:</p>
<p><code><br />
keytool -list -v -keystore keystore.jks<br />
...<br />
Alias name: clientkey<br />
Creation date: Dec 12, 2012<br />
Entry type: trustedCertEntry<br />
...<br />
</code></p>
<p>and we can now remove the client.cer certificate.</p>
<h2>Start Karaf and test with WebConsole</h2>
<p>Now we can start Karaf:</p>
<p><code><br />
bin/karaf<br />
</code></p>
<p>and install the WebConsole feature:</p>
<p><code><br />
karaf@root> features:install webconsole<br />
</code></p>
<p>If we try to access to the WebConsole (using a simple browser) using https://localhost:8443/system/console, we have:</p>
<p><code><br />
An error occurred during a connection to localhost:8443.</p>
<p>SSL peer cannot verify your certificate.</p>
<p>(Error code: ssl_error_bad_cert_alert)<br />
</code></p>
<p>which is normal as the browser doesn&#8217;t have any trusted certificate.</p>
<p>Now, we can add the client certificate in the browser.</p>
<p>Firefox supports the import of PKCS12 keystore. So, we are going to &#8220;transform&#8221; the JKS keystore into a PKCS12 keystore:</p>
<p><code><br />
keytool -importkeystore -srckeystore clientKeystore.jks -srcstoretype JKS -destkeystore client.pfx -deststoretype PKCS12<br />
Enter destination keystore password:<br />
Re-enter new password:<br />
Enter source keystore password:<br />
Entry for alias clientkey successfully imported.<br />
Import command completed:  1 entries successfully imported, 0 entries failed or cancelled<br />
</code></p>
<p>Now, we can import the client certificate in Firefox. To do so, open the Preferences window (in Edit menu), and click on the Advanced tab.<br />
You can go in Encryption tab and click on &#8220;View Certificates&#8221; button.</p>
<p>In &#8220;Your Certificates&#8221; tab, you can click on the Import button and choose the client.pfx keystore file.</p>
<p>If you try to access to https://localhost:8443/system/console again, you will have access as a trusted client and use it.</p>
<h2>Conclusion</h2>
<p>It&#8217;s the same with any kind of HTTP client that try to use the HTTPs layer of Karaf.</p>
<p>Now, we can disable the HTTP support in Karaf (to force the usage of HTTPs), and we can allow only &#8220;trusted&#8221; clients to use the HTTPs layer of Karaf.</p>
<p>It&#8217;s a simple mechanism if you want to limit access to HTTP resources only for trusted clients.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nanthrax.net/2012/12/how-to-enable-https-certificate-client-auth-with-karaf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache Karaf Cellar 2.2.5 released !</title>
		<link>http://blog.nanthrax.net/2012/12/apache-karaf-cellar-2-2-5-released/</link>
		<comments>http://blog.nanthrax.net/2012/12/apache-karaf-cellar-2-2-5-released/#comments</comments>
		<pubDate>Thu, 06 Dec 2012 08:26:29 +0000</pubDate>
		<dc:creator>jbonofre</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Apache Karaf]]></category>

		<guid isPermaLink="false">http://blog.nanthrax.net/?p=307</guid>
		<description><![CDATA[During the ApacheCon EU, I made a demo of Karaf and Cellar all together. During this demo, I used Cellar 2.2.5-SNAPSHOT. Now, Cellar 2.2.5 is released ! But, what&#8217;s new in this version ? Groups are now persistent In Cellar 2.2.4, the empty groups disappear after a restart. You created a new cluster group without [...]]]></description>
				<content:encoded><![CDATA[<p>During the <a href="http://www.apachecon.eu/">ApacheCon EU</a>, I made a demo of Karaf and Cellar all together. During this demo, I used Cellar 2.2.5-SNAPSHOT.</p>
<p>Now, Cellar 2.2.5 is released ! But, what&#8217;s new in this version ?</p>
<h2>Groups are now persistent</h2>
<p>In Cellar 2.2.4, the empty groups disappear after a restart. </p>
<p>You created a new cluster group without any member (empty group) with:</p>
<p><code><br />
karaf@root> cluster:group-create foobar<br />
karaf@root> cluster:group-list|grep -i foobar<br />
foobar     []<br />
</code></p>
<p>If you restart Cellar (or Karaf), the empty groups were lost:</p>
<p><code><br />
karaf@root> cluster:group-list|grep -i foobar<br />
</code></p>
<p>To avoid this, in Cellar 2.2.5, the cluster groups are now persistent on each node. We introduced a new groups property in etc/org.apache.karaf.cellar.groups.cfg to store the list of groups. Cellar now reads this property as startup to populate the cluster groups not present on the cluster.</p>
<p>On the other hand, the groups property in etc/org.apache.karaf.cellar.node.cfg defines the group membership of the local node.</p>
<p>If you restart Karaf (or Cellar), this group disappeared from </p>
<h2>Cluster producers, consumers, and handlers persistency</h2>
<p>Like for groups, with Cellar 2.2.4, the status of cluster event producers, consumers and handlers was not persistent. It means that if you stop the cluster event producer, for instance, after a restart, the producer was start again. So we loosed the status before the restart.</p>
<p>In Cellar 2.2.5, to avoid that, the status of cluster event producers, consumers and handlers is now persistent in etc/org.apache.karaf.cellar.node.cfg (it&#8217;s the current status on the local node). Cellar now reads the properties from this file at startup to set the previous status (before the restart).</p>
<h2>Bundles blacklist and whitelist</h2>
<p>In Cellar 2.2.4, the bundles blacklist and whitelist were not correct by default in etc/org.apache.karaf.cellar.groups.cfg: all bundles were blocked (inbound and outbound). If you tried to install a bundle on the cluster, you saw a &#8220;Bundle xxxx is BLOCKED &#8230;&#8221; in the log.</p>
<p>We changed the default setup to allow all bundle cluster events.</p>
<h2>Config sync enhancement</h2>
<p>In Cellar 2.2.4, to avoid infinite loop, we introduced a karaf.cellar.sync property appended to all synchronized configuration PID. This property contained the timestamp of the last Cellar configuration synchronization. This mechanism has two issues:</p>
<ul>
<li>it pollutes the configuration PID (it can be confusing for the users to see a &#8220;not usable&#8221; property)</li>
<li>if a configuration change occurs between the timestamp and the Cellar configuration timeout, it&#8217;s not synchronized on the cluster</li>
</ul>
<p>We changed the configuration synchronization mechanism in Cellar 2.2.5. The karaf.cellar.sync property has been removed. Now we compare the dictionary of configuration PID in the cluster (distributed map) and the local.</p>
<h2>Bundle state, name, and symbolic name</h2>
<p>The bundle distributed map stored only the bundle name. It was a little bit restrictive.</p>
<p>In Cellar 2.2.5, both bundle name and symbolic name are stored in the cluster distributed map.</p>
<p>It allows the users to select a bundle (on the cluster) using both name and symbolic name.</p>
<h2>Improvements on the cluster:* commands and MBeans</h2>
<p>In order to mimic the Karaf core commands and MBeans, the Cellar commands and MBeans have been improved.</p>
<p>The cluster:feature-install (and the corresponding MBeans) now supports norefresh and noclean options, as supported by features:install Karaf command.</p>
<p>The cluster:bundle-list supports the -l option (to display the bundle location) and -s option (to display the bundle symbolic name), as the bundles:list/osgi:list Karaf command.</p>
<p>The cluster:config-list command now allows to display directly a configuration PID dictionary.</p>
<p>A new command has been introduced in Cellar 2.2.5: cluster:sync. This command forces a synchronization on the local node. It&#8217;s particulary interesting when the node loosed the communication with the other nodes (for instance, due to a network issue), the cluster:sync forces the resynchronization of the node and the cluster (in both direction).</p>
<h2>Restart issues</h2>
<p>Cellar uses a LocalBundleListener to listen for changes on the local bundles, and broadcast these changes as a bundle cluster event.</p>
<p>In Cellar 2.2.4, this listener was a simple BundleListener. The problem was that this listener get the &#8220;bundle stop&#8221; local event when stopping the framework and broadcast it to the cluster (including to the local node). It means that the &#8220;latest&#8221; state on the bundle was &#8220;stopped&#8221;. At restart, the OSGi framework reset the bundle in &#8220;stopped&#8221; status (instead of &#8220;started&#8221;).</p>
<p>In Cellar 2.2.5, the listener has been changed to a SynchronousBundleListener. Thanks to this listener, we are able to get the stopping event from the OSGi framework. When the framework stops, Cellar disable the bundle listener in order to avoid to change the bundle states.</p>
<p>Like this, we restart the bundle in the correct state.</p>
<p>We hope that you will like this new Cellar 2.2.5 release. We mostly focused on the bug fixes to provide a more stable cluster solution for Karaf.</p>
<p>Now, we are preparing Cellar 2.2.6 with new bug fixes, new feature, etc. In the mean time, Cellar 2.3.0 is in preparation, supporting Karaf 2.3.x and new Hazelcast version.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nanthrax.net/2012/12/apache-karaf-cellar-2-2-5-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache Karaf 2.3.0 released !</title>
		<link>http://blog.nanthrax.net/2012/10/apache-karaf-2-3-0-released/</link>
		<comments>http://blog.nanthrax.net/2012/10/apache-karaf-2-3-0-released/#comments</comments>
		<pubDate>Tue, 16 Oct 2012 06:10:24 +0000</pubDate>
		<dc:creator>jbonofre</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Apache Karaf]]></category>
		<category><![CDATA[Apache ServiceMix]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[karaf]]></category>
		<category><![CDATA[servicemix]]></category>

		<guid isPermaLink="false">http://blog.nanthrax.net/?p=301</guid>
		<description><![CDATA[Waiting for Karaf 3.0.0, we worked hard in the Karaf team to provide Apache Karaf 2.3.0. The Karaf 2.2.x branch is now only in maintenance mode: it means that no new features will be implemented in this branch, only major bug fixes. The new &#8220;stable&#8221; branch is now Karaf 2.3.x which is a perfect transition [...]]]></description>
				<content:encoded><![CDATA[<p>Waiting for Karaf 3.0.0, we worked hard in the Karaf team to provide Apache Karaf 2.3.0.</p>
<p>The Karaf 2.2.x branch is now only in maintenance mode: it means that no new features will be implemented in this branch, only major bug fixes.</p>
<p>The new &#8220;stable&#8221; branch is now Karaf 2.3.x which is a perfect transition branch between Karaf 2.2.x (heavely used) and the future Karaf 3.x (which should arrive very soon).</p>
<p>What&#8217;s new in this 2.3.0 release:</p>
<p>* <strong>OSGi r4.3</strong>: Karaf 2.2.x branch was powered by OSGi frameworks implementing OSGi r4.2 norm. Karaf 2.3.0 is now powered by the new OSGi r4.3 framework (Apache Felix 4.0.3 and Equinox 3.8.x), for both OSGi core and compendium. It provides new features like weaving, etc.<br />
* <strong>Aries Blueprint 1.0.x</strong>: Karaf 2.3.0 uses the new Aries Blueprint version at different level (core, JMX, etc).<br />
* <strong>Update to ASM 4.0</strong>: in order to work with Aries proxies, we updated to new ASM bundle. We also provided configuration that allows you to enable/disable weaving.<br />
* <strong>OSGi Regions and SCR support</strong>: Karaf 2.3.0 provides both Regions and SCR support.<br />
* <strong>JMX improvement</strong>: the previous MBeanRegistrer from Karaf 2.2.x has been removed to be replaced by Aries JMX. It allows an easier way to integrate MBeans by registering OSGi services. The MBeans have been improved to provide new operations and options corresponding with what you can do using the shell commands.<br />
* <strong>Complete itest framework</strong>: Karaf 2.3.0 provides a new tool: Karaf exam. This tool provides a framework to very easily implements integration tests. It&#8217;s able to download and bootstrap a Karaf version on which you can run your commands, deploy your features and bundles, etc. It allows you to run a complete integration tests chain from Maven.<br />
* <strong>Dependencies upgrade</strong>: a lot of dependencies have been updated. Karaf 2.3.0 uses Pax Logging 1.7.0 including bug fixes and SLF4J 1.7.1 support, new Pax Web and Jetty version for the web container, new JLine, SSHD and Mina versions which especially fix weird behavior on Windows for certain keys, etc.<br />
* <strong>KAR improvements</strong>: if Karaf 3.x will provide a lot of enhancements around the KAR files, Karaf 2.3.0 already provides fixes in the KAR lifecycle.<br />
* <strong>JAAS commands improvements</strong>: the jaas:* commands have been enhanced to allow you a fine-grained management of the realms and login modules.</p>
<p>You can find the Karaf 2.3.0 content details on the <a href="http://karaf.apache.org/index/community/download/karaf-2.3.0-release.html">Release Notes</a>.</p>
<p>The Karaf team is proud to provide this release to you. We hope you will enjoy it !</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nanthrax.net/2012/10/apache-karaf-2-3-0-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache Karaf 2.2.9</title>
		<link>http://blog.nanthrax.net/2012/08/apache-karaf-2-2-9/</link>
		<comments>http://blog.nanthrax.net/2012/08/apache-karaf-2-2-9/#comments</comments>
		<pubDate>Sat, 18 Aug 2012 14:53:57 +0000</pubDate>
		<dc:creator>jbonofre</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Apache Karaf]]></category>

		<guid isPermaLink="false">http://blog.nanthrax.net/?p=284</guid>
		<description><![CDATA[The Apache Karaf team is proud to announce a new version on the Karaf 2.2.x branch. The 2.2.9 version is a major bug fixes release. We fixed 52 issues in this release, and we are inline with our release cycle (around every 2 months). Especially, it includes: Work with the latest JRE/JDK 1.6.0 and 1.7.0 [...]]]></description>
				<content:encoded><![CDATA[<p>The Apache Karaf team is proud to announce a new version on the Karaf 2.2.x branch.</p>
<p>The 2.2.9 version is a major bug fixes release.</p>
<p>We fixed 52 issues in this release, and we are inline with our release cycle (around every 2 months).</p>
<p>Especially, it includes:</p>
<ul>
<li><b>Work with the latest JRE/JDK 1.6.0 and 1.7.0 updates</b>: some changes in the Java Virtual Machine resulted to issues in previous Karaf releases. It&#8217;s now fixed in Karaf 2.2.9, allowing Karaf to work with Java 1.6.0_33 or 34 for instance, but fixed in Karaf itself and an upgrade to Aries Proxy 0.3.1.</li>
<li><b>New OSGi frameworks</b>: this release upgrade to the latest minor versions of the OSGi frameworks, especially Apache Felix Framework 3.2.2.</li>
<li><b>Dependencies minor version updates</b>: in order to fix several minor issues, some dependencies have been upgraded (javax.mail 1.4.5, ServiceMix bundles, etc).</li>
<li><b>Stopping the shell console doesn&#8217;t stop the OSGi framework</b>: previously, when you stopped the Karaf shell console bundle, it also stopped the OSGi framework. No, the bundles are no more coupled, allowing you to stop the shell console but let your application bundles running in the OSGi framework.</li>
<li><b>MBeans and shell commands are consistent</b>: some options present in the shell commands (for instance, -c and -r options in features:install command) were not present for the same action using MBeans. Now, you can find the same options in both commands and MBeans.</li>
<li><b>Features installation optimisation</b>: Karaf now avoid to resolve the same bundles many times when installing features in cascade. It improves the features installation time.</li>
</ul>
<p>You can have more information and download this release here:</p>
<p><a href="http://karaf.apache.org/index/community/download/karaf-2.2.9-release.html">http://karaf.apache.org/index/community/download/karaf-2.2.9-release.html</a></p>
<p>Now, we are working on Karaf 2.3.0 and 3.0.0-RC1. Karaf 2.3.0 should arrive very soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nanthrax.net/2012/08/apache-karaf-2-2-9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dell Vostro with Ubuntu: use the AMD Catalyst drivers</title>
		<link>http://blog.nanthrax.net/2012/08/dell-vostro-used-on-ubuntu-use-the-amd-catalyst-drivers/</link>
		<comments>http://blog.nanthrax.net/2012/08/dell-vostro-used-on-ubuntu-use-the-amd-catalyst-drivers/#comments</comments>
		<pubDate>Sat, 18 Aug 2012 02:35:51 +0000</pubDate>
		<dc:creator>jbonofre</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Unix/Linux]]></category>

		<guid isPermaLink="false">http://blog.nanthrax.net/?p=279</guid>
		<description><![CDATA[I have a Dell Vostro 3550 with Ubuntu 12.04 since around one year now. The laptop worked fine, it was pretty fast, building a lot of projects in the same time, etc. I complained with: the temperature was really hot (sensors said between 80°C and 95°C all of the time). Sometime, the temperature was critical [...]]]></description>
				<content:encoded><![CDATA[<p>I have a Dell Vostro 3550 with Ubuntu 12.04 since around one year now.</p>
<p>The laptop worked fine, it was pretty fast, building a lot of projects in the same time, etc.</p>
<p>I complained with:</p>
<ul>
<li>the temperature was really hot (sensors said between 80°C and 95°C all of the time). Sometime, the temperature was critical and the system shutted down.</li>
<li>due to the previous point, the fan was very noisy</li>
<li>the battery autonomy was average</li>
</ul>
<p>This laptop use dual graphic cards: Intel SGI graphic card (to reduce energy consumption), and AMD Radeon HD 6600M (for 3D enhanced graphics and HD videos).</p>
<p>When I got this laptop, I tried to install the fglrx open source drivers a couple of times. Without success: it seems that the Radeon card was not fully supported.</p>
<p>As the laptop ran really fine (unity was fast, vlc was able to read HD videos without problem, etc), I stayed with the Intel Xorg driver.</p>
<p>Yesterday evening, watching a movie, the laptop was so hot that I have to use a pillow to avoid to burn my legs <img src='http://blog.nanthrax.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>So today, I decided to find a solution.</p>
<p>As the fglrx open source drivers didn&#8217;t work, I try to proprietary AMD Catalyst drivers.</p>
<p>And now, ALL IS DIFFERENT <img src='http://blog.nanthrax.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>The temperature stays around 70/80°C, so the fan are pretty quite, and the system is even faster than before.</p>
<p>More over, the admcccle (Catalyst Console) allows you to tweak the graphic card configuration. You can also choose and switch between the Intel SGI card or the RADEON one (it required a reboot).</p>
<p>To summarize, for all Dell Vostro users on Ubuntu (and more generally on Linux), install the ADM Catalyst graphics drivers <img src='http://blog.nanthrax.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nanthrax.net/2012/08/dell-vostro-used-on-ubuntu-use-the-amd-catalyst-drivers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache Karaf Cellar 2.2.4</title>
		<link>http://blog.nanthrax.net/2012/05/apache-karaf-cellar-2-2-4/</link>
		<comments>http://blog.nanthrax.net/2012/05/apache-karaf-cellar-2-2-4/#comments</comments>
		<pubDate>Sun, 20 May 2012 05:30:36 +0000</pubDate>
		<dc:creator>jbonofre</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Apache Karaf]]></category>
		<category><![CDATA[Apache ServiceMix]]></category>
		<category><![CDATA[cellar]]></category>
		<category><![CDATA[karaf]]></category>
		<category><![CDATA[servicemix]]></category>

		<guid isPermaLink="false">http://blog.nanthrax.net/?p=260</guid>
		<description><![CDATA[Apache Karaf Cellar 2.2.4 has been released. This release is a major release, including a bunch of bug fixes and new features. Here&#8217;s the list of key things included in this release. Consistent behavior Cellar is composed by two parts: the distributed resources which is a datagrid maintained by each cluster nodes and containing the [...]]]></description>
				<content:encoded><![CDATA[<p>Apache Karaf Cellar 2.2.4 has been released. This release is a major release, including a bunch of bug fixes and new features.</p>
<p>Here&#8217;s the list of key things included in this release.</p>
<h2>Consistent behavior</h2>
<p>Cellar is composed by two parts:</p>
<ul>
<li>the distributed resources which is a datagrid maintained by each cluster nodes and containing the current cluster status (for instance of the bundles, features, etc)</li>
<li>the cluster event which is broadcasted from a node to the others</li>
</ul>
<p>Cluster shell commands, cluster MBeans, synchronizers (called at startup) and listeners (called when a local event is fired, such as feature installed) update the distributed resource and broadcast cluster events.</p>
<p>To broadcast cluster events, we use an event producer. The cluster event is consommed by a consumer which delegates the handling of the cluster event to a handler. We have a handler for feature, bundle, etc.</p>
<p>Now, all Cellar &#8220;producers&#8221; do:</p>
<ol>
<li>check if the cluster event producer is ON</li>
<li>check if the resource is allowed, checking in the blacklist/whitelist configuration</li>
<li>update the distributed resources</li>
<li>broadcast the cluster event</li>
</ol>
<h2>Only use hazelcast.xml</h2>
<p>The org.apache.karaf.cellar.instance.cfg file has disappear. It&#8217;s now fully replaced by the hazelcast.xml.</p>
<p>It fixes issue around the network configuration and allows new configuration, especially around the encryption.</p>
<h2>OSGi event support</h2>
<p>cellar-event feature now provides OSGi event support in Cellar. It uses eventadmin layer. All local event generates a cluster event which is broadcasted to the cluster. It allows to sync remote nodes.</p>
<h2>Better shell commands</h2>
<p>Now, all cluster:* shell commands mimic the core Karaf commands. It means that we will find quite the same arguments and options and similar output.</p>
<p>The cluster:group-* shell commands have been improved and fixed.</p>
<p>A new shell command has been introduced: cluster:config-propappend to append a String to a config property.</p>
<h2>Check everywhere</h2>
<p>We added a bunch of check to be sure to have a consistent situation on the cluster and predictable behavior.</p>
<p>It means that the MBeans and shell commands check if a cluster group exists, if a cluster event producer is on, if a resource is allowed on the cluster (for the given cluster group), etc.</p>
<p>You have clean messages informing you about the current status of your commands.</p>
<h2>Improvement on the config layer</h2>
<p>The Cellar config layer has been improved. It now uses a karaf.cellar.sync property to avoid infinite loop. The config delete operation support has been added, including the cluster:config-delete commands.</p>
<h2>Feature repositories</h2>
<p>Previously, the feature repositories handling was hidden for the users.</p>
<p>Now, you have a full access to the distributed features repositories set. It means that you can see the distributed repositories for a cluster group, add a new features repository to a cluster group, and remove a features repository from a cluster group.</p>
<p>To do that, you have the cluster:feature-url-* shell commands.</p>
<h2>CellarOBRMBean</h2>
<p>Cellar provides a MBean for all parts of the cluster resources (bundles, features, config, etc).</p>
<p>However, if an user installed cellar-obr feature, he got the cluster:obr-* shell commands but no corresponding MBean.</p>
<p>The CellarOBRMBean has been introduced and is installed with the cellar-obr feature.</p>
<h2>Summary</h2>
<p>Karaf Cellar 2.2.4 is really a major release, and I think it should have been named 2.3.0 due to the bunch of the bug fixes and new features: we fixed 77 Jiras in this release and performed lot of manual tests.</p>
<p>The quality has been heavily improved in this release comparing to the previous one.</p>
<p>I encourage all Cellar users to update to Karaf Cellar 2.2.4 and I hope you will be pleased with this new release <img src='http://blog.nanthrax.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nanthrax.net/2012/05/apache-karaf-cellar-2-2-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache Karaf Cellar and central management</title>
		<link>http://blog.nanthrax.net/2012/02/apache-karaf-cellar-and-central-management/</link>
		<comments>http://blog.nanthrax.net/2012/02/apache-karaf-cellar-and-central-management/#comments</comments>
		<pubDate>Wed, 29 Feb 2012 06:34:17 +0000</pubDate>
		<dc:creator>jbonofre</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Apache Karaf]]></category>
		<category><![CDATA[cellar]]></category>
		<category><![CDATA[karaf]]></category>
		<category><![CDATA[servicemix]]></category>

		<guid isPermaLink="false">http://blog.nanthrax.net/?p=246</guid>
		<description><![CDATA[Introduction One of the first purpose of Apache Karaf Cellar is to synchronize the state of each Karaf instances in the Cellar cluster. It means that any change performed on one node (install a feature, start a bundle, add a config, etc) generates a &#8220;cluster event&#8221; which is broadcasted by Cellar to all others nodes. [...]]]></description>
				<content:encoded><![CDATA[<h4>Introduction</h4>
<p>One of the first purpose of Apache Karaf Cellar is to synchronize the state of each Karaf instances in the Cellar cluster.</p>
<p>It means that any change performed on one node (install a feature, start a bundle, add a config, etc) generates a &#8220;cluster event&#8221; which is broadcasted by Cellar to all others nodes. The target node handles the &#8220;cluster event&#8221; and performed the corresponding action (install a feature, start a bundle, add a config, etc).</p>
<p>By default, the nodes have the same role. It means that you can perform actions on any node.</p>
<p>But, you may prefer to have one node dedicated to the management. It&#8217;s what we name &#8220;central management&#8221;.</p>
<h4>Central management</h4>
<p>With central management, one node is identified by the manager. It means that cluster actions will be performed only on this node. The manager is the only one which is able to produce cluster event. The managed nodes are only able to receive and handle events, not to produce.</p>
<p>With this approach, you can give access (for instance grant ssh or JMX access) to the manager node to an operator and manage the cluster (and all cluster groups) from this manager node.</p>
<p>We will see now how to implement central management.</p>
<p>We assume that we have three nodes:</p>
<ul>
<li>manager</li>
<li>node1</li>
<li>node2</li>
</ul>
<p>First, we install Cellar on the three nodes:</p>
<p><code><br />
karaf@manager> features:addurl mvn:org.apache.karaf.cellar/apache-karaf-cellar/2.2.4-SNAPSHOT/xml/features<br />
karaf@manager> features:install cellar<br />
</code></p>
<p><code><br />
karaf@node1> features:addurl mvn:org.apache.karaf.cellar/apache-karaf-cellar/2.2.4-SNAPSHOT/xml/features<br />
karaf@node1> features:install cellar<br />
</code></p>
<p><code><br />
karaf@node2> features:addurl mvn:org.apache.karaf.cellar/apache-karaf-cellar/2.2.3/xml/features<br />
karaf@node2> features:install cellar<br />
</code></p>
<p>It&#8217;s a default installation, nothing special here.</p>
<p>Now, we disable the event producing on node1 and node2.</p>
<p>To do that, from the manager:</p>
<p><code><br />
karaf@manager> cluster:producer-stop node1:5702<br />
Node                 Status<br />
node1:5702           false<br />
karaf@manager> cluster:producer-stop node2:5703<br />
Node                 Status<br />
node2:5703           false<br />
</code></p>
<p>We can check that the producer are really stopped:</p>
<p><code><br />
karaf@manager> cluster:producer-status node1:5702<br />
Node                 Status<br />
node1:5702           false<br />
karaf@manager> cluster:producer-status node2:5703<br />
Node                 Status<br />
node2:5703           false<br />
</code></p>
<p>Whereas the manager is always able to produce event:</p>
<p><code><br />
karaf@manager> cluster:producer-status<br />
Node                 Status<br />
manager:5701         true<br />
</code></p>
<p>Now, for instance, we can install eventadmin feature from the manager:</p>
<p><code><br />
karaf@manager> cluster:features-install default eventadmin<br />
</code></p>
<p>We can see that this feature has been installed on node1:</p>
<p><code><br />
karaf@node1> features:list|grep -i eventadmin<br />
[installed  ] [2.2.5          ] eventadmin                            karaf-2.2.5<br />
</code></p>
<p>and node2:</p>
<p><code><br />
karaf@node2> features:list|grep -i eventadmin<br />
[installed  ] [2.2.5          ] eventadmin                            karaf-2.2.5<br />
</code></p>
<p>Now, we uninstall this feature from the manager:</p>
<p><code><br />
karaf@manager> cluster:features-uninstall default eventadmin<br />
</code></p>
<p>We can see that the feature has been uninstall from node1:</p>
<p><code><br />
karaf@node1> features:list|grep -i eventadmin<br />
[uninstalled] [2.2.5          ] eventadmin                            karaf-2.2.5<br />
</code></p>
<p>And now, we try to install the eventadmin feature on the cluster from the node1:</p>
<p><code><br />
karaf@node1> cluster:features-install default eventadmin<br />
</code></p>
<p>The event is not generated and the others nodes are not updated.</p>
<p>However, two kind of events are always produced (even if the producer is stopped):</p>
<ul>
<li>the events with the &#8220;force&#8221; flag. When you create an event (programmatically), you can use setForce(true) to force the event producing.</li>
<li>the &#8220;admin&#8221; events, like the events produced to stop/start a producer, consumer, handler in the cluster.</li>
</ul>
<p>NB: the event produce handling has been largely improved for Cellar 2.2.4.</p>
<h4>Coming in next Cellar release</h4>
<p>Currently, the cellar feature install the cellar core bundles, but also the cellar shell commands, and the MBeans.</p>
<p>If it makes sense for the manager, the managed nodes should not &#8220;display&#8221; the cluster:* commands as they are managed by the manager.</p>
<p>I will make a little refactoring of the Cellar features to split in two parts:</p>
<ul>
<li>the cellar-core feature will install hazelcast, and Cellar core bundles</li>
<li>the cellar-manager feature will install the cluster:* shell commands and the MBeans</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.nanthrax.net/2012/02/apache-karaf-cellar-and-central-management/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
