summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rabbit.erl11
-rw-r--r--src/rabbit_node_monitor.erl13
2 files changed, 18 insertions, 6 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl
index 9a938d1067..92bc8802f4 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -230,7 +230,16 @@ start(normal, []) ->
print_banner(),
[ok = run_boot_step(Step) || Step <- boot_steps()],
io:format("~nbroker running~n"),
-
+ io:format("informing other clustered brokers: ~p~n",
+ [rabbit_mnesia:running_clustered_nodes()]),
+ %% notify other rabbits of this rabbit
+ [ rpc:call(Node, rabbit_node_monitor, rabbit_running_on, [node()])
+ || Node <- rabbit_mnesia:running_clustered_nodes(),
+ Node =/= node() ],
+ %% register other active rabbits with this rabbit
+ [ rabbit_node_monitor:rabbit_running_on(Node)
+ || Node <- rabbit_mnesia:running_clustered_nodes(),
+ Node =/= node() ],
{ok, SupPid};
Error ->
Error
diff --git a/src/rabbit_node_monitor.erl b/src/rabbit_node_monitor.erl
index bce5ec12a1..c36a1dfb35 100644
--- a/src/rabbit_node_monitor.erl
+++ b/src/rabbit_node_monitor.erl
@@ -22,6 +22,7 @@
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
terminate/2, code_change/3]).
+-export([rabbit_running_on/1]).
-define(SERVER, ?MODULE).
@@ -30,6 +31,9 @@
start_link() ->
gen_server:start_link({local, ?SERVER}, ?MODULE, [], []).
+rabbit_running_on(Node) ->
+ gen_server:cast(rabbit_node_monitor, {rabbit_running_on, Node}).
+
%%--------------------------------------------------------------------
init([]) ->
@@ -39,14 +43,14 @@ init([]) ->
handle_call(_Request, _From, State) ->
{noreply, State}.
-handle_cast(_Msg, State) ->
- {noreply, State}.
-
-handle_info({nodeup, Node}, State) ->
+handle_cast({rabbit_running_on, Node}, State) ->
rabbit_log:info("node ~p up", [Node]),
erlang:monitor(process, {rabbit, Node}),
io:format("monitored 'rabbit' on ~p~n", [Node]),
{noreply, State};
+handle_cast(_Msg, State) ->
+ {noreply, State}.
+
handle_info({nodedown, Node}, State) ->
rabbit_log:info("node ~p down", [Node]),
%% TODO: This may turn out to be a performance hog when there are
@@ -68,4 +72,3 @@ code_change(_OldVsn, State, _Extra) ->
{ok, State}.
%%--------------------------------------------------------------------
-