File: README.md

package info (click to toggle)
rabbitmq-server 4.0.5-6
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 37,948 kB
  • sloc: erlang: 257,835; javascript: 22,466; sh: 2,796; makefile: 2,517; python: 1,966; xml: 646; cs: 335; java: 244; ruby: 212; php: 100; perl: 63; awk: 13
file content (109 lines) | stat: -rw-r--r-- 2,758 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# `khepri_mnesia_migration`: Mnesia⬌Khepri migration toolkit

[![Hex.pm](https://img.shields.io/hexpm/v/khepri_mnesia_migration)](https://hex.pm/packages/khepri_mnesia_migration/)
[![Test](https://github.com/rabbitmq/khepri_mnesia_migration/actions/workflows/test.yaml/badge.svg)](https://github.com/rabbitmq/khepri_mnesia_migration/actions/workflows/test.yaml)
[![Codecov](https://codecov.io/gh/rabbitmq/khepri_mnesia_migration/branch/main/graph/badge.svg?token=R0OGKZ2RK2)](https://codecov.io/gh/rabbitmq/khepri_mnesia_migration)

`khepri_mnesia_migration` is a library providing helpers to migrate data
between the Mnesia and Khepri databases.

Currently, only the migration from Mnesia to Khepri is supported.

<img align="right" height="150" src="/doc/kmm-logo.svg">

## Project maturity

`khepri_mnesia_migration` is still under active development and should be
considered *Alpha* at this stage.

## Documentation

* A short tutorial in the [Getting started](#getting-started) section below
* [Documentation and API reference](https://rabbitmq.github.io/khepri_mnesia_migration/)

## Getting started

### Add as a dependency

Add `khepri_mnesia_migration` as a dependency of your project:

Using Rebar:

```erlang
%% In rebar.config
{deps, [{khepri_mnesia_migration, "0.7.1"}]}.
```

Using Erlang.mk:

```make
# In your Makefile
DEPS += khepri_mnesia_migration
dep_khepri_mnesia_migration = hex 0.7.1
```

Using Mix:

```elixir
# In mix.exs
defp deps do
  [
    {:khepri_mnesia_migration, "0.7.1"}
  ]
end
```

### Synchronize cluster members

To ensure a Khepri store has the same members as the Mnesia cluster, use
`mnesia_to_khepri:synchronize_cluster_membership/{0,1}`:

```erlang
mnesia_to_khepri:synchronize_cluster_membership(StoreId).
```

### Copy Mnesia tables to a Khepri store

You can copy Mnesia tables records to a Khepri store using
`mnesia_to_khepri:copy_tables/{2,3}`. It takes a converter module which takes
care of actually processing each Mnesia records (if needed) and storing them in
the Khepri store. A converter module called
`mnesia_to_khepri_example_converter` is provided for common use cases and as an
example.

```erlang
mnesia_to_khepri:copy_all_tables(mnesia_to_khepri_example_converter).
```

## How to build

### Build

```
rebar3 compile
```

### Build documentation

```
rebar3 edoc
```

### Test

```
rebar3 xref
rebar3 eunit
rebar3 ct --sname ct
rebar3 as test dialyzer
```

## Copyright and License

© 2022-2024 Broadcom. All Rights Reserved. The term "Broadcom" refers to
Broadcom Inc. and/or its subsidiaries.

This work is dual-licensed under the Apache License 2.0 and the Mozilla Public
License 2.0. You can choose between one of them if you use this work.

SPDX-License-Identifier: Apache-2.0 OR MPL-2.0