Akonadi: Difference between revisions

    From KDE UserBase Wiki
    (Remove factually incorrect information on startServer. startServer handles the local (per user) vs global SQL server usage.)
    (Marked this version for translation)
     
    (18 intermediate revisions by 9 users not shown)
    Line 5: Line 5:


    <!--T:2-->
    <!--T:2-->
    The '''Akonadi''' framework is responsible for providing applications with a centralized database to store, index and retrieve the user's personal information. This includes the user's emails, contacts, calendars, events, journals, alarms, notes, etc. In SC 4.4, [[Special:myLanguage/KAddressBook|KAddressBook]] became the first application to start using the '''Akonadi''' framework. In SC 4.7,
    The '''Akonadi''' framework is responsible for providing applications with a centralized database to store, index and retrieve the user's personal information. This includes the user's emails, contacts, calendars, events, journals, alarms, notes, etc.
    [[Special:myLanguage/KMail|KMail]], [[Special:myLanguage/KOrganizer|KOrganizer]], [[Special:myLanguage/KJots|KJots]], etc. were updated to use '''Akonadi''' as well. In addition, several [[Special:myLanguage/Plasma|Plasma]] widgets also use '''Akonadi''' to store and retrieve calendar events, notes, etc.


    <!--T:12-->
    <!--T:62-->
    At the time of writing, the following applications are enabled to use the '''Akonadi''' framework to centrally store and access user data. Follow through to each application's page to learn more.
    Currently, all [https://kontact.kde.org/ KDE PIM applications] with the exception of [[Special:myLanguage/Akregator|Akregator]] are using '''Akonadi''' to access user's PIM data.


    </translate><span id="ApplicationTable"></span><translate>
    ==Controlling Akonadi== <!--T:15-->
    </translate>
    :{|
    {{AppItem|KMail|<translate>
    <!--T:37-->
    View-pim-mail.png|
    KMail</translate>}}<translate><!--T:38-->
    Mail Client
    Uses '''Akonadi''' to store emails
    </translate>
    |-
    {{AppItem|KAddressBook|<translate>
    <!--T:39-->
    View-pim-contacts.png|
    KAddressBook</translate>}}<translate><!--T:40-->
    Contact Manager
    Uses '''Akonadi''' to store contact information
    </translate>
    |-
    {{AppItem|KOrganizer|<translate>
    <!--T:41-->
    View-pim-calendar.png|
    KOrganizer</translate>}}<translate><!--T:42-->
    Personal Organizer
    Uses '''Akonadi''' to store calendars, events, journals, etc.
    </translate>
    |-
    {{AppItem|KJots|<translate>
    <!--T:43-->
    kjots.png|
    KJots</translate>}}<translate><!--T:44-->
    Note Taking Application
    Uses '''Akonadi''' to store notes
    </translate>
    |-
    {{AppItem|KAlarm|<translate>
    <!--T:49-->
    kalarm.png|
    KAlarm</translate>}}<translate>
    <!--T:50-->
    Personal alarm scheduler
    Uses '''Akonadi''' to store alarms
    </translate>
    |}<translate>


    <!--T:63-->
    '''Akonadi''' will start automatically in the background when any application using it is started.


    <!--T:14-->
    <!--T:64-->
    In addition to this, plasma widgets like the '''Digital Clock''' widget, the '''Notes''' widget also use '''Akonadi''' to store and retrieve events and notes.
    To manually start, stop or restart '''Akonadi''', you can use the <code>akonadictl</code> command from the commandline.
     
    Using this method, you can get additional useful information on the console.
    ==Controlling the Akonadi server== <!--T:15-->
     
    <!--T:16-->
    The '''Akonadi''' control module in '''System Settings''' provides an easy means to starting, stopping, restarting and querying the status of the '''Akonadi''' server. You may also accomplish this from the commandline using the command '''akonadictl'''. Using this method, you can get additional useful information on the console.


    <!--T:17-->
    <!--T:17-->
    Line 92: Line 46:


    <!--T:57-->
    <!--T:57-->
    The '''Akonadi''' server is started by any '''Akonadi'''-enabled application. If you don't want Akonadi to be started after login, you have to ensure that no '''Akonadi'''-enabled application is launched at login or thereafter. Remember to check '''Plasma''' widgets as well — the '''Digital Clock''' widget in the default panel, for instance uses '''Akonadi''' to (optionally) display calendar events and this is enabled in its settings by default (see the "Display Events" option) .  You must remove any widgets that may start it from your start-up, if you wish Akonadi to start only when you start '''KMail''' or other applications.
    The '''Akonadi''' server is automatically started by any '''Akonadi'''-enabled application. If you don't want Akonadi to be started after login, you have to ensure that no '''Akonadi'''-enabled application is launched at login or thereafter. Remember to check '''Plasma''' applets as well — the '''Digital Clock''' widget in the default panel, for instance uses '''Akonadi''' to (optionally) display calendar events and this is enabled in its settings by default (see the "Display Events" option) .  You must remove any widgets that may start it from your start-up, if you wish Akonadi to start only when you start '''KMail''' or other applications.
     
    <!--T:26-->
    {{Remember|1=If you don't want to have '''Akonadi''' running on your system at all, you can not use any of the '''Akonadi'''-enabled applications, such as KMail, KOrganizer or KAddressbook. Such applications will not work when '''Akonadi''' is disabled using the steps below. Also note, that some '''Plasma''' widgets, such as the '''Digital Clock''' uses '''Akonadi'''.}}
     
    <!--T:58-->
    To ensure that '''Akonadi''' is not started, check that no applications require it at login. In particular, open the Plasma clock applet preferences, go to <menuchoice>Calendar</menuchoice> and uncheck <menuchoice>Show events</menuchoice> to prevent Plasma from requesting information from '''Akonadi''' and thus allowing it to start.
     
    ==Some Definitions== <!--T:65-->
     
    <!--T:66-->
    ;Real data
    :By ''real data'' we mean the data, like the contacts or events. These data are stored either on a groupware server or in local files. Where exactly depends on the resource you are using. E.g. the ''Personal Contacts'' resource stores its data under ''$XDG_DATA_HOME/contacts''.
     
    <!--T:67-->
    ;Cached data
    :The ''cached data'' are copies of the real data that are kept in the database for faster access and offline caching. The database also keeps the ''meta data'' which are management data needed by '''Akonadi''' to work correctly.
     
    <!--T:68-->
    ;Configuration data
    :The ''configuration data'' are the data that configure the '''Akonadi''' server and the individual resources. The general configuration data for the server can be found under ''$XDG_CONFIG_HOME/akonadi''. The configuration data for each indvidual resources are stored under ''$XDG_CONFIG_HOME/akonadi_xyz_resourcerc#'' ('''''xyz''''' is name of resource and '''''#''''' its instance number).
     
    <!--T:69-->
    :The '''Akonadi''' server configuration is a couple of files in ''$XDG_CONFIG_HOME/akonadi''. It contains which data sources and helper programs are active and will be started and watched (so they can be restarted on crashes) by one of '''Akonadi's''' server processes '''(akonadi_control)'''.


    <!--T:70-->
    :Each data source handler (called resources) or helper program (called agents) can have its own configuration although some agents or resources don't require configuration. The general rule is that for every entry in ''$XDG_CONFIG_HOME/akonadi/agentsrc'' there is a corresponding configuration file in ''$XDG_CONFIG_HOME''.  For example, if the ''[Instances]'' section in ''agentrc'' contains an entry for ''akonadi_ical_resource_2'', there is also a config file called ''akonadi_ical_resource_2rc'' in the ''$XDG_CONFIG_HOME directory''.


    <!--T:26-->
    <!--T:71-->
    {{Remember|1=If you don't want to have '''Akonadi''' running on your system at all, you can not use any of the '''Akonadi'''-enabled applications. Such applications will not work when '''Akonadi''' is disabled using the steps below. See the list of [[Special:myLanguage/Akonadi#ApplicationTable|Akonadi-enabled applications]]. Also note, that some '''Plasma''' widgets, such as the '''Digital Clock''' uses '''Akonadi''.'}}
    :Depending on the type of data, such config files for resources will have filenames or directory names of where the data is stored.  Common locations are KDE's legacy default files, e.g. ''$HOME/.kde/share/apps/korganizer/std.ics''.  New default locations are files and directories in ''$XDG_DATA_HOME'', e.g. ''$XDG_DATA_HOME/contacts''.


    <!--T:27-->
    ==Backup== <!--T:72-->
    The '''Akonadi''' server is launched automatically at login whenever any '''Akonadi'''-enabled application requests access to it.


    <!--T:28-->
    <!--T:73-->
    To disable the '''Akonadi''' subsystem, shut down the running Akonadi server from the control module or the command line:
    So now we need to decide what to back up.  If you want to backup the "real data", then it depends on the resources you have configured... if you use a groupware server, then the backup should be done there. For contacts, the files under ''$XDG_DATA_HOME/contacts'' will normally be what you need.


    <!--T:29-->
    <!--T:74-->
    {{Input|1=akonadictl stop}}
    To back up the entire ''Akonadi'' configuration, including which resources are active and their configuration, you can use the '''pimdataexporter''' tool. This, however doesn't back up the Akonadi database containing the cached data and, unfortunately, after restoring the configuration (using the '''pimdataexporter'' again), Akonadi will have to re-fetch all data again into its cache. This can cause configuration that points to actual mail folders or calendars to get broken and accidentally point to another folder.


    To ensure that Akonadi is not started, check that no applications require it at login. In particular, open the Plasma clock applet preferences, go to "Calendar" and uncheck "Show events" to prevent Plasma from requesting information from Akonadi and thus allowing it to start.
    <!--T:75-->
    '''After restoring configuration and syncing all data, it's vital to manually check all folder configuration, especially in KMail identities and make sure the folders are configured properly.'''


    ==Frequently Asked Questions== <!--T:34-->
    ==Frequently Asked Questions== <!--T:34-->
    Line 113: Line 92:
    === Where is my data now? === <!--T:45-->
    === Where is my data now? === <!--T:45-->


    <!--T:46-->
    <!--T:76-->
    A full explanation of where the data is stored and Akonadi's interaction with it is available in [http://blogs.kde.org/node/4503 Andras Mantia's blog]
    Your data are safely stored outside of '''Akonadi''' control on your disk (e.g. local maildir folder or iCal calendar), or on a remote server (in case of e.g. email over IMAP or events from a CalDAV calendar). '''Akonadi''' will optionally store a copy of this data in its database to allow applications to quickly retrieve and display them. Any modifications done to data in the '''Akonadi''' database will be synced to the actual storage. The main advantage of using the database as a cache is that remote PIM data are available even when you are offline, and you can still interact with them (e.g. mark emails as read or move them, create new events, reschedule existing meetings etc.) and all the changes will get synced automatically once you connect to the internet again.
     
    <!--T:77-->
    Thus, deleting the '''Akonadi''' database will not cause any data to be lost (as long as all pending changes are synced).
     
    === How to upgrade my PostgreSQL database? === <!--T:60-->
     
    <!--T:61-->
    After updating your PostgreSQL server to a new major version, sometimes you will have to convert your Akonadi database for use with this new version. Instructions can be found on [[Special:myLanguage/Akonadi/Postgres_update|this page]].


    === Migration problems === <!--T:47-->
    === Migration problems === <!--T:47-->


    <!--T:35-->
    <!--T:35-->
    '''Akonadi's''' [[Special:myLanguage/Glossary#Akonadi|Glossary entry]] has a brief description of its purpose and other useful links. [[Special:myLanguage/Akonadi_and_AddressBook|This]] page explains how '''Akonadi''' and '''KAddressBook''' work together.
    '''Akonadi's''' [[Special:myLanguage/Glossary#Akonadi|Glossary entry]] has a brief description of Akonadi's purpose, and other useful links.
     
    === How do I switch from MySQL/PostgreSQL to SQLite? === <!--T:78-->
     
    <!--T:79-->
    Currently, the only option is to delete all Akonadi configuration and data, configure '''Akonadi''' to use SQLite and then configure all the resources and agents from scratch. This also involves checking all application ('''KMail''', '''KOrganizer''', '''KAddressbook''', etc.) configuration, as all references to folders (like configuration of Trash or Sent folders, default calendar etc.) will most likely be wrong now.
     
    <!--T:80-->
    To perform the migration, quit all PIM applications and stop '''Akonadi''' from command line:
     
    <!--T:81-->
    {{Input|1=akonadictl stop}}


    === High CPU or Memory usage === <!--T:48-->
    <!--T:82-->
    Then, delete all Akonadi-related configuration and data directories and files:


    <!--T:36-->
    <!--T:83-->
    If you are experiencing 100% CPU usage by the ''virtuoso-t'' process when using '''Akonadi''' and related applications, try this proposed workaround while it is being investigated: In '''KRunner's''' configuration page, disable the '''Nepomuk''' search plugin and the '''Contact''' plugin. Then, log out and back in. For further information and inputs, report back here or on the Forum or on the IRC channel #kontact.
    * Delete Akonadi configuration: <code>$XDG_CONFIG_HOME/akonadi</code>
    * Delete Akonadi database: <code>$XDG_DATA_HOME/akonadi</code>
    * Delete configuration of all Akonadi resources: <code>$XDG_CONFIG_HOME/akonadi*</code>
    * Delete data of all Akonadi resources: <code>$XDG_DATA_HOME/akonadi*</code>


    === Akonadi and Nepomuk, why? === <!--T:51-->
    <!--T:84-->
    (<code>$XDG_CONFIG_HOME</code> defaults to <code>$HOME/.config</code> when not set, <code>$XDG_DATA_HOME</code> defaults to <code>$HOME/.local/share</code>.)


    <!--T:52-->
    <!--T:85-->
    There is often a good deal of confusion about Akonadi and Nepomuk.  [http://cmollekopf.wordpress.com/2013/02/13/kontact-nepomuk-integration-why-data-from-akonadi-is-indexed-in-nepomuk/ Why data from Akonadi is indexed in Nepomuk] explains exactly why we have both, and what their roles are.  Don't miss the additional information from [http://en.opensuse.org/User:Wstephenson Will Stephenson] in the Comments section.
    Now, create a new Akonadi Server configuration file called ''akonadiserverrc'' in ''$HOME/.config/akonadi/'' with the following contents:


    == Troubleshooting == <!--T:53-->
    <!--T:86-->
    <syntaxhighlight>
    [%General]
    Driver=QSQLITE
    </syntaxhighlight>


    === Can't read  any details of some messages or big delays to read it === <!--T:54-->  
    <!--T:87-->
    This will instruct Akonadi to use SQLite instead of the default (usually MySQL). Finally, you can start Akonadi (via ''akonadictl'' or simply by starting some Akonadi-enabled application) and update configuration of your PIM application.


    <!--T:55-->
    <!--T:88-->
    if you aren't able to read some emails and see a message with " please wait ... ", you may logout and login KDE session to reinitialize all processes, might help.
    This guide can also be used to switch to MySQL or PostgreSQL databases. To switch to MySQL put <code>Driver=QMYSQL</code> into ''akonadiserverrc''. In order to use PostgreSQL, put <code>Driver=QPSQL</code> in there.


    <!--T:9-->
    <!--T:9-->
    [[Category:System]]
    [[Category:System]]
    </translate>
    </translate>

    Latest revision as of 13:04, 6 December 2023

    Introduction

    The Akonadi framework is responsible for providing applications with a centralized database to store, index and retrieve the user's personal information. This includes the user's emails, contacts, calendars, events, journals, alarms, notes, etc.

    Currently, all KDE PIM applications with the exception of Akregator are using Akonadi to access user's PIM data.

    Controlling Akonadi

    Akonadi will start automatically in the background when any application using it is started.

    To manually start, stop or restart Akonadi, you can use the akonadictl command from the commandline. Using this method, you can get additional useful information on the console.

    To start the Akonadi server,

    akonadictl start

    To stop the Akonadi server,

    akonadictl stop

    To restart a running Akonadi server,

    akonadictl restart

    To query the status of the Akonadi server,

    akonadictl status

    Disabling the Akonadi subsystem

    The Akonadi server is automatically started by any Akonadi-enabled application. If you don't want Akonadi to be started after login, you have to ensure that no Akonadi-enabled application is launched at login or thereafter. Remember to check Plasma applets as well — the Digital Clock widget in the default panel, for instance uses Akonadi to (optionally) display calendar events and this is enabled in its settings by default (see the "Display Events" option) . You must remove any widgets that may start it from your start-up, if you wish Akonadi to start only when you start KMail or other applications.

    Remember

    If you don't want to have Akonadi running on your system at all, you can not use any of the Akonadi-enabled applications, such as KMail, KOrganizer or KAddressbook. Such applications will not work when Akonadi is disabled using the steps below. Also note, that some Plasma widgets, such as the Digital Clock uses Akonadi.


    To ensure that Akonadi is not started, check that no applications require it at login. In particular, open the Plasma clock applet preferences, go to Calendar and uncheck Show events to prevent Plasma from requesting information from Akonadi and thus allowing it to start.

    Some Definitions

    Real data
    By real data we mean the data, like the contacts or events. These data are stored either on a groupware server or in local files. Where exactly depends on the resource you are using. E.g. the Personal Contacts resource stores its data under $XDG_DATA_HOME/contacts.
    Cached data
    The cached data are copies of the real data that are kept in the database for faster access and offline caching. The database also keeps the meta data which are management data needed by Akonadi to work correctly.
    Configuration data
    The configuration data are the data that configure the Akonadi server and the individual resources. The general configuration data for the server can be found under $XDG_CONFIG_HOME/akonadi. The configuration data for each indvidual resources are stored under $XDG_CONFIG_HOME/akonadi_xyz_resourcerc# (xyz is name of resource and # its instance number).
    The Akonadi server configuration is a couple of files in $XDG_CONFIG_HOME/akonadi. It contains which data sources and helper programs are active and will be started and watched (so they can be restarted on crashes) by one of Akonadi's server processes (akonadi_control).
    Each data source handler (called resources) or helper program (called agents) can have its own configuration although some agents or resources don't require configuration. The general rule is that for every entry in $XDG_CONFIG_HOME/akonadi/agentsrc there is a corresponding configuration file in $XDG_CONFIG_HOME. For example, if the [Instances] section in agentrc contains an entry for akonadi_ical_resource_2, there is also a config file called akonadi_ical_resource_2rc in the $XDG_CONFIG_HOME directory.
    Depending on the type of data, such config files for resources will have filenames or directory names of where the data is stored. Common locations are KDE's legacy default files, e.g. $HOME/.kde/share/apps/korganizer/std.ics. New default locations are files and directories in $XDG_DATA_HOME, e.g. $XDG_DATA_HOME/contacts.

    Backup

    So now we need to decide what to back up. If you want to backup the "real data", then it depends on the resources you have configured... if you use a groupware server, then the backup should be done there. For contacts, the files under $XDG_DATA_HOME/contacts will normally be what you need.

    To back up the entire Akonadi configuration, including which resources are active and their configuration, you can use the pimdataexporter' tool. This, however doesn't back up the Akonadi database containing the cached data and, unfortunately, after restoring the configuration (using the pimdataexporter again), Akonadi will have to re-fetch all data again into its cache. This can cause configuration that points to actual mail folders or calendars to get broken and accidentally point to another folder.

    After restoring configuration and syncing all data, it's vital to manually check all folder configuration, especially in KMail identities and make sure the folders are configured properly.

    Frequently Asked Questions

    Where is my data now?

    Your data are safely stored outside of Akonadi control on your disk (e.g. local maildir folder or iCal calendar), or on a remote server (in case of e.g. email over IMAP or events from a CalDAV calendar). Akonadi will optionally store a copy of this data in its database to allow applications to quickly retrieve and display them. Any modifications done to data in the Akonadi database will be synced to the actual storage. The main advantage of using the database as a cache is that remote PIM data are available even when you are offline, and you can still interact with them (e.g. mark emails as read or move them, create new events, reschedule existing meetings etc.) and all the changes will get synced automatically once you connect to the internet again.

    Thus, deleting the Akonadi database will not cause any data to be lost (as long as all pending changes are synced).

    How to upgrade my PostgreSQL database?

    After updating your PostgreSQL server to a new major version, sometimes you will have to convert your Akonadi database for use with this new version. Instructions can be found on this page.

    Migration problems

    Akonadi's Glossary entry has a brief description of Akonadi's purpose, and other useful links.

    How do I switch from MySQL/PostgreSQL to SQLite?

    Currently, the only option is to delete all Akonadi configuration and data, configure Akonadi to use SQLite and then configure all the resources and agents from scratch. This also involves checking all application (KMail, KOrganizer, KAddressbook, etc.) configuration, as all references to folders (like configuration of Trash or Sent folders, default calendar etc.) will most likely be wrong now.

    To perform the migration, quit all PIM applications and stop Akonadi from command line:

    akonadictl stop

    Then, delete all Akonadi-related configuration and data directories and files:

    • Delete Akonadi configuration: $XDG_CONFIG_HOME/akonadi
    • Delete Akonadi database: $XDG_DATA_HOME/akonadi
    • Delete configuration of all Akonadi resources: $XDG_CONFIG_HOME/akonadi*
    • Delete data of all Akonadi resources: $XDG_DATA_HOME/akonadi*

    ($XDG_CONFIG_HOME defaults to $HOME/.config when not set, $XDG_DATA_HOME defaults to $HOME/.local/share.)

    Now, create a new Akonadi Server configuration file called akonadiserverrc in $HOME/.config/akonadi/ with the following contents:

    [%General]
    Driver=QSQLITE

    This will instruct Akonadi to use SQLite instead of the default (usually MySQL). Finally, you can start Akonadi (via akonadictl or simply by starting some Akonadi-enabled application) and update configuration of your PIM application.

    This guide can also be used to switch to MySQL or PostgreSQL databases. To switch to MySQL put Driver=QMYSQL into akonadiserverrc. In order to use PostgreSQL, put Driver=QPSQL in there.