[ejabberd] SQL Export, ejabberd 17.04

James Tait james.tait at wyrddreams.org
Fri Jun 9 17:14:44 MSK 2017


Hi Badlop,

On 09/06/17 11:04, Badlop wrote:

> On 8 June 2017 at 19:28, James Tait <james.tait at wyrddreams.org> wrote:
>> I want to export that data and import it into PostgreSQL - for
>> all modules that support this. Is the correct method, then, to change
>> default_db to sql, configure the database connection, restart ejabberd and
>> issue the same command?
> That's right.

Many thanks for the clarification, this seems to have mostly worked.
There were a couple of problems with the exported SQL:

 1. In |privacy_list_data|, the boolean values were provided as
    integers, which PostgreSQL complained about. Wrapping the values in
    single quotes resolved that issue.
 2. In |rostergroups|, the |INSERT| statements were missing trailing
    semicolons.

I can’t say I’m adept enough at Erlang to be confident of making the
correct change for the first issue, but I think I can submit a PR for
the second.

As a general note about this process, requiring the administrator to
switch the storage backend to |sql| *before* performing the data export
more or less guarantees service downtime. What I had hoped would be
possible was:

 1. Perform the data export.
 2. Import the data into PostgreSQL.
 3. Modify the ejabberd configuration to use the PostgreSQL backend
    (|default_db: sql|).
 4. Restart ejabberd.
 5. Be happy. :)

In this particular case it’s not really a problem, but in larger
deployments I can imagine it would be. In such instances, would the
recommended approach be to take a copy of the data and configure a
“shadow” instance on which to perform the export?

Best regards,

JT

​

-- 
---------------------------------------+--------------------------------
James Tait, BSc                        |    xmpp:jayteeuk at wyrddreams.org
Programmer and Free Software advocate  |        Tel: +44 (0)870 490 2407
---------------------------------------+--------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20170609/812b1b2a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 163 bytes
Desc: OpenPGP digital signature
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20170609/812b1b2a/attachment.sig>


More information about the ejabberd mailing list