How can I backup piler? where is the body of the message?

Issue #195 resolved
Former user created an issue

Hello All,

I just trying to figure out where and how does piler import messages? I can see that the v_messages table has subject and a piler ID but where is the body? Does piler store any messages as .eml files? I also looked in /var/piler/store however I couldnt find it. This is because I want to see if I can backup the piler store somehow and restore it in case of a hardware problem.

Comments (3)

  1. Janos SUTO repo owner

    when piler imports a message (the same applies for the piler daemon) 3 kind of data is stored:

    • the email and its attachments under /var/piler/store/00/..
    • mysql entries in the metadata, rcpt and attachment tables
    • the message content (including the body) goes to the sph_index table.

    The sph_index table is read by the sphinx indexer utility. It reads its content, then after processing it, empties the table. So the message body can be found for a short time in the sql database.

    So if you want to backup piler data, then save the following:

    • the piler database: it's crucial, you absolutely need it
    • the sphinx database (ie. the /var/piler/sphinx directory). Note that you can rebuild the sphinx index data later on the new machine, but if you had lots of emails, then it would take time, so you'd better copy the sphinx directory.
    • the /var/piler/store/00/* directories,

    It's pretty nasty since it has zillions of subdirs and files, making it unpleasant to rsync or similar. However notice that you have dirs like 527, 528, 529, 52a, ... under /var/piler/store/00. Each of these dirs contains ~12 days of emails, and these values (eg. 52a) come from the timestamp, so if you have 52b, then you can be sure that 52a, and previous dirs (ie. 529, 528, ...) won't change, so you don't have to rsync these older dirs all the time, you can concentrate on the actually directory being written under /var/piler/store/00.

    I hope this makes sense.

  2. Log in to comment