Difference between revisions of "Projects/PIM/Akonadi/Multi-Instance"

< Projects‎ | PIM‎ | Akonadi
Jump to: navigation, search
(Missing Features)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{warning|This does not yet work with any akonadi agents/resource as they need to be ported first (only akonadiconsole has been ported so far). Don't use it unless you know what you're doing.}}
 +
 
== Akonadi Multi-Instance Setup ==
 
== Akonadi Multi-Instance Setup ==
  
The multi-instance akonadi setup allows to run multiple akonadi-servers in parallel, using the same posix-user. DBus service names are postfixed with an instance identifier, so multiple instances can run on the same DBus.
+
The multi-instance Akonadi setup allows to run multiple Akonadi servers in parallel, using the same posix-user and D-Bus session bus. D-Bus service names are postfixed with an instance identifier and  all relevant configuration files/directories are either postfixed or put in a separate directory, to avoid any clashes, making it safe to run multiple instances in parallel.
Also all relevant configuration files/direcories are either postfixed or put in a separate directory, to avoid any clashes, making it safe to run multiple instances in parallel.
+
  
The behavior of a normal akonadi instance is not changed.
+
The behavior of a normal Akonadi instance is not changed.
  
To run multiple akonadi instances in parallel it is required to assign to each instance a unique identifier using:
+
To run multiple Akonadi instances in parallel it is required to assign to each instance a unique identifier using:
 
<pre>
 
<pre>
akonadictl --identifier IDENTIFIER start
+
akonadictl --instance IDENTIFIER start
 
</pre>
 
</pre>
  
You can run a normal akonadi instance (without --identifier) in parallel with multi-instance akonadi instances.
+
An application will then connect to a server depending on the AKONADI_INSTANCE environment variable (set to IDENTIFIER).
 +
 
 +
You can run a normal Akonadi instance (without --instance) in parallel with multi-instance Akonadi instances.
 +
 
 +
Each instance will run it's own Mysql server by default, just like a regular Akonadi instance does.
 +
 
 +
== Usage ==
 +
start instance:
 +
<pre>
 +
export AKONADI_DISABLE_AGENT_AUTOSTART
 +
akonadictl --instance IDENTIFIER start
 +
</pre>
 +
 
 +
connect any Akonadi client (see also risks section below):
 +
<pre>
 +
export AKONADI_INSTANCE=IDENTIFIER
 +
akonadiconsole
 +
</pre>
 +
 
 +
stop instance:
 +
<pre>
 +
akonadictl --instance IDENTIFIER stop
 +
</pre>
  
Each instance will run it's own mysql server.
 
  
 
=== Directories ===
 
=== Directories ===
Line 23: Line 45:
 
To cleanup an instance, just delete all the directories and configs above.
 
To cleanup an instance, just delete all the directories and configs above.
  
=== Akonadiconsole ===
+
=== Akonadi Clients ===
  
To connect to an instance using akonadiconsole export the following environment variable first (with inst1 being the instance identifier):
+
To connect to an instance using a Akonadi client application, export the following environment variable first (with inst1 being the instance identifier):
 
<pre>
 
<pre>
 
export AKONADI_INSTANCE=inst1
 
export AKONADI_INSTANCE=inst1
 
</pre>
 
</pre>
  
A couple of features, such as the debugging facilities or the mysql console do not work, but managing agents and browsing the collection tree should work just fine.
+
=== Akonadi Console ===
Note that you might get an error message on startup that your mysql database socket couldn't be found, this is safe to ignore.
+
  
You can connect to the mysql instance directly using the mysql console (standalone, not the akonadiconsole one):
+
Unlike regular client applications, ''akonadiconsole'' will automatically detect the presence of multiple Akonadi instances and asks to which one to connect to if more than one was found.
 +
 
 +
Some of the debugging facilities do not work correctly yet, these are the known issues:
 +
* Raw socket always connects to the main instance.
 +
* Protocol debugger always uses the main instance.
 +
* Job tracker and resource scheduler view show activity from all instances.
 +
* Notification monitor always uses the main instance.
 +
 
 +
You can also connect to the Mysql instance directly using the Mysql console (standalone, not the akonadiconsole one):
 
<pre>
 
<pre>
mysql --protocol=SOCKET --socket=.local/share/akonadi/instance/inst1/socket-myhost2/mysql.socket
+
mysql --protocol=SOCKET --socket=~/.local/share/akonadi/instance/<inst1>/socket-<hostname>/mysql.socket
 
</pre>
 
</pre>
  
=== Missing Features ===
+
=== Risks and Missing Features ===
* Debugging facilities as mentioned above
+
* Debugging facilities in akonadiconsole as mentioned above
 
* Firstrun: Is disabled in servermanager.cpp, otherwise the firstrun code will crash (an assert prevents running the code since it is unsafe so far).
 
* Firstrun: Is disabled in servermanager.cpp, otherwise the firstrun code will crash (an assert prevents running the code since it is unsafe so far).
 
* It is not safe to run a multi-instance setup without exporting AKONADI_DISABLE_AGENT_AUTOSTART first, because the default setup desktop files contain configs with hardcoded paths, which would result in every akonadi instance creating a resource for the same default path.
 
* It is not safe to run a multi-instance setup without exporting AKONADI_DISABLE_AGENT_AUTOSTART first, because the default setup desktop files contain configs with hardcoded paths, which would result in every akonadi instance creating a resource for the same default path.
 +
* Most client applications do not namespace their configuration files according to the Akonadi instance they connect to. Using the same configuration on two different instances can have arbitrary side-effects. It is for example not safe to run Kontact/KMail against a second instance.
  
 
=== Development ===
 
=== Development ===
In order to make akonadi code work in the multi-instance setup all unique identifiers need to be made distinguishable between instances. That includes most prominently:
+
In order to make Akonadi code work in the multi-instance setup all unique identifiers need to be made distinguishable between instances. That includes most prominently:
* dbus service names
+
* D-Bus service names
* configfile names
+
* configuration file names
 
* default directory paths
 
* default directory paths
  
You only need to change these, if you add/use dbus interfaces, or access configfiles directly. Most things have already been taken care of using the agentbase/resourcebase classes.
+
You only need to change these, if you add/use D-Bus interfaces, or access configuration files directly. Most things have already been taken care of using the AgentBase/ResourceBase classes.
 +
 
 +
* kdepimlibs/akonadi/servermanager.h contains a couple of helper functions to help with that.
  
* kdepimlibs/akonad/servermanager.h contains a couple of helper functions to help with that.
+
Note that it is not possible to change the D-Bus names or the prefixed directories just in kdepimlibs, as the Akonadi server makes assumptions on where to find the directories and D-Bus services.

Latest revision as of 18:14, 3 May 2013

noframe
 
Warning
This does not yet work with any akonadi agents/resource as they need to be ported first (only akonadiconsole has been ported so far). Don't use it unless you know what you're doing.


Contents

[edit] Akonadi Multi-Instance Setup

The multi-instance Akonadi setup allows to run multiple Akonadi servers in parallel, using the same posix-user and D-Bus session bus. D-Bus service names are postfixed with an instance identifier and all relevant configuration files/directories are either postfixed or put in a separate directory, to avoid any clashes, making it safe to run multiple instances in parallel.

The behavior of a normal Akonadi instance is not changed.

To run multiple Akonadi instances in parallel it is required to assign to each instance a unique identifier using:

akonadictl --instance IDENTIFIER start

An application will then connect to a server depending on the AKONADI_INSTANCE environment variable (set to IDENTIFIER).

You can run a normal Akonadi instance (without --instance) in parallel with multi-instance Akonadi instances.

Each instance will run it's own Mysql server by default, just like a regular Akonadi instance does.

[edit] Usage

start instance:

export AKONADI_DISABLE_AGENT_AUTOSTART
akonadictl --instance IDENTIFIER start

connect any Akonadi client (see also risks section below):

export AKONADI_INSTANCE=IDENTIFIER
akonadiconsole

stop instance:

akonadictl --instance IDENTIFIER stop


[edit] Directories

The multi-instance setup puts it's files in the following directories:

  • .config/akonadi/instance/$IDENTIFIER
  • .local/share/akonadi/instance/$IDENTIFIER
  • .kde4/share/config/akonadi/akonadi_imap_resource_0_$IDENTIFIERrc

To cleanup an instance, just delete all the directories and configs above.

[edit] Akonadi Clients

To connect to an instance using a Akonadi client application, export the following environment variable first (with inst1 being the instance identifier):

export AKONADI_INSTANCE=inst1

[edit] Akonadi Console

Unlike regular client applications, akonadiconsole will automatically detect the presence of multiple Akonadi instances and asks to which one to connect to if more than one was found.

Some of the debugging facilities do not work correctly yet, these are the known issues:

  • Raw socket always connects to the main instance.
  • Protocol debugger always uses the main instance.
  • Job tracker and resource scheduler view show activity from all instances.
  • Notification monitor always uses the main instance.

You can also connect to the Mysql instance directly using the Mysql console (standalone, not the akonadiconsole one):

mysql --protocol=SOCKET --socket=~/.local/share/akonadi/instance/<inst1>/socket-<hostname>/mysql.socket

[edit] Risks and Missing Features

  • Debugging facilities in akonadiconsole as mentioned above
  • Firstrun: Is disabled in servermanager.cpp, otherwise the firstrun code will crash (an assert prevents running the code since it is unsafe so far).
  • It is not safe to run a multi-instance setup without exporting AKONADI_DISABLE_AGENT_AUTOSTART first, because the default setup desktop files contain configs with hardcoded paths, which would result in every akonadi instance creating a resource for the same default path.
  • Most client applications do not namespace their configuration files according to the Akonadi instance they connect to. Using the same configuration on two different instances can have arbitrary side-effects. It is for example not safe to run Kontact/KMail against a second instance.

[edit] Development

In order to make Akonadi code work in the multi-instance setup all unique identifiers need to be made distinguishable between instances. That includes most prominently:

  • D-Bus service names
  • configuration file names
  • default directory paths

You only need to change these, if you add/use D-Bus interfaces, or access configuration files directly. Most things have already been taken care of using the AgentBase/ResourceBase classes.

  • kdepimlibs/akonadi/servermanager.h contains a couple of helper functions to help with that.

Note that it is not possible to change the D-Bus names or the prefixed directories just in kdepimlibs, as the Akonadi server makes assumptions on where to find the directories and D-Bus services.


This page was last modified on 3 May 2013, at 18:14. This page has been accessed 1,448 times. Content is available under Creative Commons License SA 3.0 as well as the GNU Free Documentation License 1.2.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal