Anonymous avatar Anonymous committed 49dda6c

get rid of doorbell_port in configuration files and docs, delete riak_doorbell.erl

Comments (0)

Files changed (8)

config/riak-demo.erlenv

 %% open files (using ulimit/sysctl) when creating larger ring sizes. 
 {ring_creation_size, 16}.
 {gossip_interval, 60000}.
-{doorbell_port, 9000}.
 {storage_backend, riak_ets_backend}.
 %{riak_dets_backend_root, "priv/store/dets"}.
 {riak_cookie, riak_demo_cookie}.

config/riak-dets.erlenv

 %% open files (using ulimit/sysctl) when creating larger ring sizes. 
 {ring_creation_size, 16}.
 {gossip_interval, 60000}.
-{doorbell_port, 9000}.
 {storage_backend, riak_dets_backend}.
 {riak_dets_backend_root, "/path/to/riak/dets-store"}.
 {riak_cookie, default_riak_cookie}.

config/riak-ets-jiak.erlenv

 %% open files (using ulimit/sysctl) when creating larger ring sizes. 
 {ring_creation_size, 16}.
 {gossip_interval, 60000}.
-{doorbell_port, 9000}.
 {storage_backend, riak_ets_backend}.
 {riak_cookie, default_riak_cookie}.
 {riak_heart_command, "(cd /path/to/riak; ./start-restart.sh /path/to/riak/config/riak-ets-jiak.erlenv)"}.

config/riak-osmos.erlenv

 %% open files (using ulimit/sysctl) when creating larger ring sizes. 
 {ring_creation_size, 16}.
 {gossip_interval, 60000}.
-{doorbell_port, 9000}.
 {storage_backend, riak_osmos_backend}.
 {riak_osmos_backend_root, "/path/to/riak/osmos-store"}.
 {riak_cookie, default_riak_cookie}.

config/riak.erlenv

 %%  Making it larger will reduce chatter, but will cause greater delays
 %%  in ring convergence between nodes.
 {gossip_interval, 60000}.
-%% doorbell_port is the UDP port used by clients and other nodes to connect
-%%  to the cluster via this node.  If this is undefined the node will be
-%%  storage-only and cannot be an entry point for API requests or joins.
-{doorbell_port, 9000}.
 %% storage_backend specifies the Erlang module defining the storage mechanism
 %%  that will be used on this node. 
 {storage_backend, riak_dets_backend}.

demo/stickynotes/riak-config.erlenv

 {ring_state_dir, "priv/ringstate"}.
 {ring_creation_size, 16}.
 {gossip_interval, 60000}.
-{doorbell_port, 9000}.
 {storage_backend, riak_ets_backend}.
 {riak_cookie, stickynotes_cookie}.
 {riak_heart_command, "(cd $RIAK_HOME; ./start-restart.sh $RIAK_HOME/demo/stickynotes/riak-config.erlenv)"}.

src/riak_doorbell.erl

-%% This file is provided to you under the Apache License,
-%% Version 2.0 (the "License"); you may not use this file
-%% except in compliance with the License.  You may obtain
-%% a copy of the License at
-
-%%   http://www.apache.org/licenses/LICENSE-2.0
-
-%% Unless required by applicable law or agreed to in writing,
-%% software distributed under the License is distributed on an
-%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-%% KIND, either express or implied.  See the License for the
-%% specific language governing permissions and limitations
-%% under the License.    
-
-%% @doc The doorbell (and door knocker) is a UDP socket server that provides a discovery mechanism for other nodes to connect into the Riak cluster.
-
--module(riak_doorbell).
-
--behaviour(gen_server).
--export([start_link/0]).
--export([init/1, handle_call/3, handle_cast/2, handle_info/2,
-	 terminate/2, code_change/3]).
--export([ring/2,knock/3, stop/0]).
-
--include_lib("eunit/include/eunit.hrl").
-	 
--record(state, {port, sock}).
-
-%% @spec start_link() -> {ok, pid()}
-start_link() ->
-    Port = riak:get_app_env(doorbell_port),
-    pong = net_adm:ping(node()), % fail if not distributed
-    gen_server:start_link({local, ?MODULE}, ?MODULE, [Port], []).
-
-%% @spec knock(IP :: list(), Port :: integer(), RiakCookie :: atom()) ->
-%%       ok | {error, Reason}
-%% @doc This is used by a node not seeking to be a member of the cluster,
-%%      to establish a distributed-erlang connection used by a riak_client.
-knock(IP, Port, RiakCookie) ->
-    % for non-riak nodes seeking a client proc
-    Nonce = random:uniform(),
-    {ok, SendSock} = gen_udp:open(0),
-    gen_udp:send(SendSock, IP, Port,term_to_binary({
-              {knock,Nonce,self(),erlang:get_cookie(),RiakCookie},node()})),
-    gen_udp:close(SendSock),
-    Nonce.
-
-%% @spec ring(IP :: list(), Port :: integer()) ->
-%%       ok | {error, Reason}
-%% @doc This is used by a node joining the riak cluster.
-ring(IP, Port) ->
-    % for riak nodes joining
-    {ok, SendSock} = gen_udp:open(0),
-    Res = gen_udp:send(SendSock, IP, Port, term_to_binary({ring,node()})),
-    gen_udp:close(SendSock),
-    Res.
-
-stop() -> gen_server:cast(?MODULE, stop).
-    
-% @private
-init([Port]) ->
-    Opts = [{active, true},
-            list,
-            {reuseaddr, true}],
-    {ok, Sock} = gen_udp:open(Port, Opts),
-    {ok, #state{port=Port,sock=Sock}}.
-
-% @private
-handle_info({udp, _Socket, IP, _InPortNo, Packet0},State) ->
-    {RingType, Node} = binary_to_term(list_to_binary(Packet0)),
-    case RingType of
-        ring ->
-            case net_adm:ping(Node) of
-                pong -> riak_eventer:notify(riak_doorbell,connected,{IP,Node});
-                pang -> riak_eventer:notify(riak_doorbell,connectfail,{IP,Node})
-            end;
-        {knock,Nonce,Pid,Cookie,RiakCookie} ->
-            case riak:get_app_env(riak_cookie) of
-                RiakCookie ->
-                    riak_eventer:notify(riak_doorbell, client_connected,
-                                        {IP, Pid, Node}),
-                    erlang:set_cookie(Node,Cookie),
-                    Pid ! {riak_connect, Nonce, node()};
-                _ ->
-                    riak_eventer:notify(riak_doorbell, client_connectfail,
-                                        {IP, Pid, Node})
-            end
-    end,
-    {noreply, State};
-handle_info(_Info, State) -> {noreply, State}.
-
-%% @private
-handle_cast(stop, State) -> {stop, normal,State}.
-
-%% @private
-handle_call(_Request, _From, State) -> {reply, no_call, State}.
-
-%% @private
-terminate(_Reason, _State=#state{sock=Sock}) ->
-    gen_udp:close(Sock),
-    ok.
-
-%% @private
-code_change(_OldVsn, State, _Extra) ->  {ok, State}.
-
-knock_test() ->
-    application:set_env(riak, doorbell_port, 9001),
-    application:set_env(riak, riak_cookie, default_riak_cookie),
-    {ok, _Pid} = riak_doorbell:start_link(),
-    Nonce = riak_doorbell:knock("127.0.0.1", 9001, default_riak_cookie),
-    receive
-        {riak_connect, Nonce, _} ->
-            ok
-    after 1000 ->
-            throw(knock_test_timeout)
-    end,
-    riak_doorbell:stop().
-       
-    
-            
-    
-
-    
-

www/basic-setup.html

   ring configuration.  All nodes in a cluster should have the same
   cluster name.  This parameter is required.
 </dd>
-<dt><code>doorbell_port: integer</code></dt>
-<dd>
-  Network port (UDP) on which this node will listen for connections from
-  clients and other nodes.  If this parameter is not specified, the node
-  cannot be used to service client requests, but can still participate
-  in storage.
-</dd>
 <dt><code>riak_cookie: atom</code></dt>
 <dd>
   The Erlang cookie for the riak cluster.  All nodes in a cluster
 <pre>
 {cluster_name, "default"}.
 {ring_creation_size, 16}.
-{doorbell_port, 9000}.
 {storage_backend, riak_dets_backend}.
 {riak_dets_backend_root, "/var/riak/store"}.
 {riak_cookie, default_riak_cookie}.
 <pre>
 {cluster_name, "default"}.
 {ring_creation_size, 1024}.
-{doorbell_port, 9000}.
 {storage_backend, riak_dets_backend}.
 {riak_dets_backend_root, "/var/riak/store"}.
 {riak_cookie, default_riak_cookie}.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.