[erlang-questions] specifying directory for mnesia database

Loïc Hoguin essen@REDACTED
Mon Apr 7 11:52:00 CEST 2014


Your .app file contains environment keys for your application. To change 
for another application you can use a sys.config file or call 
application:set_env/3 directly from your code.

sys.config isn't very complicated, see: 
http://www.erlang.org/doc/man/config.html

On 04/07/2014 11:45 AM, t x wrote:
> I've tried:
>
> {env, [{mnesia, "/home/x/code/data/"}]}
>
>
> this compiles, but does not change the directory.
>
>
> I've also tried:
>
> {env, [{mnesia, dir, "/home/x/code/data/"}]}
>
>
> but this does not compile.
>
>
> Reading: http://stackoverflow.com/questions/1842462/erlang-specifying-a-working-directory-for-mnesia
> it says I should try application:set_env(mnesia, dir, Dir)
>
>
> How do I encode that into my app.src?
>
>
> Thanks!
>
> On Sun, Apr 6, 2014 at 8:21 PM, t x <txrev319@REDACTED> wrote:
>> Hi,
>>
>>    * I'm learning to use Mnesia (until I run into 2GB table issues.)
>>
>>    * I'm using erlang.mk + relx.
>>
>>    * Everything appears to be working, _EXCEPT_
>>
>>        * mnesia appears to be storing its tables in _rel/'node()'
>>
>>        * these tables appear to get wiped when I type "make"
>>
>>        * I'm not happy when my db gets wiped when I recompile my code.
>>
>>
>>    I've done some googling, and it appears my options are:
>>
>>
>> ## 1) specify directory on erl commandline
>>
>> example: erl -mnesia dir '"/tmp/funky"'
>> documentation: http://www.erlang.org/doc/apps/mnesia/Mnesia_chap2.html
>>
>> I'd prefer to not take this approach, as I don't want to hack erlang.mk/relx.
>>
>>
>> ## 2) specify in env config in app.src
>>
>> documentation: http://www.erlang.org/doc/man/app.html
>>
>> I think this is the approach I want. I also think there's a one line fix.
>>
>> Can someone tell me how to, via app.src, tell mnesia to store all it's
>> dbs in "/tmp/mnesia" ?
>>
>> Thanks!
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>

-- 
Loïc Hoguin
http://ninenines.eu



More information about the erlang-questions mailing list