[erlang-questions] Multi-node setup: Adding nodes with mnesia and gproc?
Oliver Korpilla
Oliver.Korpilla@REDACTED
Sun May 29 17:16:37 CEST 2016
Hello, Ulf.
Thanks for the help. I was able to let one node bring up the DB and the tables and the other access them, and I switched the names of distributed processes from node-local to global and the application still works. (I had to turn one direct-call API into RPC but not much more.)
Ironically it already works for something close to an actual setup, but now I have to write a script that brings up all together for interacting with the test anti-product.
WBR,
Oliver
Gesendet: Freitag, 27. Mai 2016 um 16:36 Uhr
Von: "Ulf Wiger" <ulf.wiger@REDACTED>
An: "Oliver Korpilla" <Oliver.Korpilla@REDACTED>
Cc: "erlang questions" <erlang-questions@REDACTED>
Betreff: Re: [erlang-questions] Multi-node setup: Adding nodes with mnesia and gproc?
For the longest time, I’ve viewed the global name registration in gproc as … ‘experimental’, initially because gen_leader had no support for the dynamic adding/removal of nodes.
Later versions of gen_leader have this, but the master branch of gproc is still a bit weak on merging. There is an ‘uw-locks_leader’ branch, which I believe has a better* approach to dynamic node handling and merge scenarios (including conflict resolution support), but it is a little bit behind the master branch. I plan to make that the new default eventually, but the merge was non-trivial, so I’ve put it on ice for the time being.
BR,
Ulf W
* In all fairness, gen_leader is much more battle-tested than locks_leader. That of course means that with gen_leader, you can find out what the known issues are, whereas with locks_leader, you will have to discover them. The latter is of course much more fun!
> On 27 May 2016, at 15:04, Oliver Korpilla <Oliver.Korpilla@REDACTED> wrote:
>
> Hello, Ulf.
>
> And how about gproc? (You're the author, right? Love its feature set!)
>
> Thank you,
> Oliver
>
>
> Gesendet: Freitag, 27. Mai 2016 um 14:32 Uhr
> Von: "Ulf Wiger" <ulf.wiger@REDACTED>
> An: "Oliver Korpilla" <Oliver.Korpilla@REDACTED>
> Cc: "erlang questions" <erlang-questions@REDACTED>
> Betreff: Re: [erlang-questions] Multi-node setup: Adding nodes with mnesia and gproc?
>> On 27 May 2016, at 14:06, Oliver Korpilla <Oliver.Korpilla@REDACTED> wrote:
>>
>> Hello.
>>
>> We are trying to build a setup that will scale in an OpenStack cloud. Currently I as developer only know that the orchestrator will bring up additional instances as needed.
>>
>> I restructured my application in such a way that I have a central node that does not scale and provides services to all other nodes. It comes up first. Then at least one worker node is started which only starts one kind of worker, but possibly a lot of them - on demand.
>>
>> Me and my coworkers are new to the Erlang world and experimented a bit with gproc and mnesia when it comes to multi-node. The model we would be looking for is that a worker instance comes up and then gets access to all gproc global names and properties and also to the DB tables. So far our examples only worked if we connected the nodes first and then started gproc.
>>
>> Can gproc and mnesia accomodate nodes that were added to the cluster after they were started? Is anything special necessary?
>
> With mnesia, you can start the new nodes with the mnesia environment variable {extra_db_nodes, [CentralNode]}, where you could obviously add more nodes to the list. This will make mnesia fetch the schema from one of those nodes and make all tables available (remember, you don’t have to have a local copy of a table for it to be accessible). With this setting, mnesia will also automatically connect as it starts.
>
> Basically, you will always have to either manually connect, or instruct some application to do so via configuration. Using mnesia as indicated above is one way to do it.
>
> BR,
> Ulf W
More information about the erlang-questions
mailing list