[erlang-questions] specifying directory for mnesia database

t x txrev319@REDACTED
Mon Apr 7 13:05:01 CEST 2014


This is my fault for not creating a minimal failure case. Working to
remedy this.

On Mon, Apr 7, 2014 at 3:35 AM, Loïc Hoguin <essen@REDACTED> wrote:
> In the .app file you can only put environment for *your* application. Not
> *mnesia*'s. You have to use a sys.config file to put environment for any
> applications.
>
> Your sys.config file should contain
>
>   [{mnesia, [{dir, "/home/x/data/"}]}].
>
> though. This part is right. Where you put it, isn't.
>
> I do not have a handy example, sorry.
>
>
> On 04/07/2014 12:31 PM, t x wrote:
>>
>> I've already tried (in .app.src)
>>
>> {env, [{mnesia, [{dir, "/home/x/data/"}]}]}
>>
>> then, when I run _rel/bin/blah console
>>
>> mnesia:info()
>>
>> it still shows /home/x/code/_rel/...
>>
>>
>> With all due respect, I think this is a case I'd learn much more from
>> seeing the correct config and working backwards rather than trying to
>> brute force all *.app.src combinations
>>
>> On Mon, Apr 7, 2014 at 2:52 AM, Loïc Hoguin <essen@REDACTED> wrote:
>>>
>>> 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
>
>
> --
> Loïc Hoguin
> http://ninenines.eu



More information about the erlang-questions mailing list