Skip to content

Commit

Permalink
[doc] Riak backend for MAM [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
michalwski committed Oct 13, 2015
1 parent 57a59c4 commit 0d99f9e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 6 deletions.
23 changes: 19 additions & 4 deletions doc/advanced-configuration/database-backends-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,37 +139,52 @@ Configure the database section as follows:
* users (credentials)
* private storage
* vCard and vCard search
* MAM (experimental feature for one-to-one archives)

**Setup**

We are using the riak data types, so the minimal supported version is 2.0.
To be able to store above persistent date one have to run the following command:

```bash
# user base
riak-admin bucket-type create users '{"props":{"datatype":"map"}}'
riak-admin bucket-type activate users

# private storage
riak-admin bucket-type create private '{"props":{"last_write_wins":true}}'
riak-admin bucket-type activate private

# vCard
RIAK_HOST="http://localhost:8098"

curl -XPUT $RIAK_HOST/search/schema/vcard \
-H 'Content-Type:application/xml' \
--data-binary @tools/vcard_search_schema.xml

curl $RIAK_HOST/search/schema/vcard

curl -XPUT $RIAK_HOST/search/index/vcard \
-H 'Content-Type: application/json' \
-d '{"schema":"vcard"}'

riak-admin bucket-type create vcard '{"props":{"last_write_wins":true, "search_index":"vcard"}}'
riak-admin bucket-type activate vcard

#MAM
curl -XPUT $RIAK_HOST/search/schema/mam \
-H 'Content-Type:application/xml' \
--data-binary @tools/mam_search_schema.xml

curl -XPUT $RIAK_HOST/search/index/mam \
-H 'Content-Type: application/json' \
-d '{"schema":"mam"}'

riak-admin bucket-type create mam_yz '{"props":{"datatype":"map", "search_index":"mam"}}'
riak-admin bucket-type activate mam_yz

```

This will create a bucket type required for storing **users credentials** and it will
activate it.
This will create backed types, search schemas and indexes required
for storing above persitent date and it will activate them.

You should also configure Riak in `ejabberd.cfg` file.
Please refer to [Advanced configuration/Database setup](../Advanced-configuration.md) for more information.
Expand Down
21 changes: 19 additions & 2 deletions doc/modules/mod_mam.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
### Module Description
# Module Description
This module implements revision 0.2 of [XEP-0313 (Message Archive Management)](http://xmpp.org/extensions/attic/xep-0313-0.2.html). It is a highly customizable module, that requires some skill and knowledge to operate properly and efficiently.

## Configuring MAM with ODBC backend

### Options
* **mod_mam_odbc_prefs, mod_mam_mnesia_prefs, mod_mam_dirty_prefs**
Consider the process as a kind of recipe. For each step you can enable none ("optional"), one ("single") or more ("multi") modules, according to instructions. Provided there are any, please use the options described in a specific step. All config parameters are boolean, so you can enable them by adding an atom to the configuration list, e.g. `{mod_mam_odbc_arch, [pm, no_writer]}`
Expand Down Expand Up @@ -63,4 +65,19 @@ Enabling asynchronous writers will make debugging more difficult.

Enabling asynchronous writers will make debugging more difficult.

* **mod_mam_muc_odbc_async_pool_writer** - Asychronous writer, will insert batches of messages, grouped by archive ID.
* **mod_mam_muc_odbc_async_pool_writer** - Asychronous writer, will insert batches of messages, grouped by archive ID.

## Configuring MAM with Riak backend

In order to use Riak as the backend for one-to-one archives, the following configuration must be used:

```erlang
{mod_mam, []}.
{mod_mam_riak_timed_arch_yz, []}.
```

The Riak backend for MAM stores messages in weekly buckets so it's easier to remove old buckets.
Archive querying is done using Riak 2.0 [search mechanism](http://docs.basho.com/riak/2.1.1/dev/using/search/)
called Yokozuna. Your instance of Riak must be configured with Yokozuna enabled.

This backend works with Riak 2.0 and above, but the recommend version is 2.1.1

0 comments on commit 0d99f9e

Please sign in to comment.