-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
We are trying to use Que to schedule jobs in a multi-node environment, allowing nodes to connect to each other and share mnesia information.
What I'm doing:
- Start iex console:
$ mix --sname node1 -S mix
$ mix --sname node2 -S mix
- Connect nodes (on node1 console)
iex> Node.connect(:node2@local_hostname)
-
Check that they are connected with a
Node.list()on both sides -
Spawn 100 jobs of my TestWorker(which puts a log message and waits one second)
for number <- 1..100 do
Que.add(TestQue.TestWorker, number)
end
It works, but all jobs run only on one of the nodes (lets say node1), while on the other (node2) no job is executed.
Also, if I execute the same for on node2, all jobs are executed in node1 too.
is there anything we can do to:
- Run jobs on any node
- Ensure that if one node is down, the tasks in
:mnesiaremains in the rest of the cluster.
Thanks in advace!
PD: I have also tried executing the setup of mnesia persisted in disk, with this result:
iex(node1@patata)2> nodes = [node() | Node.list]
[:node1@patata, :node2@patata]
iex(node1@patata)3> Que.Persistence.Mnesia.setup!(nodes)
[info] Application mnesia exited: :stopped
** (Memento.MnesiaException) Mnesia operation failed
:not_active
Mnesia Error: {:not_active, Que.Persistence.Mnesia.DB.Jobs, :node2@patata}
(memento) lib/memento/table/table.ex:274: Memento.Table.handle_for_bang!/1
dreamingechoes, itSQualL, sergiorjsd, rsierra, enoliglesias and 5 more