You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2017/06/03 09:39:14 UTC
[1/4] couchdb-setup git commit: require nodecount on setup
Repository: couchdb-setup
Updated Branches:
refs/heads/master e8d1e32ba -> 401d77627
require nodecount on setup
when setting up a node, require the nodecount from the user. when
setting up a cluster, they will probably know it, if not the ui
other interfaces can count it easily for them. this will remove
the warning for a non matching nodecount for the user, and it
is easy to implement in uis and cli clients (e.g. a wizard for
fauxton or cli client like nmo).
once clusterwide setup lands this gets obviously superfluous.
COUCHDB-2598
This closes COUCHDB-2594
Project: http://git-wip-us.apache.org/repos/asf/couchdb-setup/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-setup/commit/75a7682e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-setup/tree/75a7682e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-setup/diff/75a7682e
Branch: refs/heads/master
Commit: 75a7682e3db9ac021053af025fce5eb1cd78cb55
Parents: ff19be1
Author: Robert Kowalski <ro...@apache.org>
Authored: Fri Jul 24 15:38:46 2015 +0200
Committer: Robert Kowalski <ro...@apache.org>
Committed: Fri Jul 24 15:38:46 2015 +0200
----------------------------------------------------------------------
src/setup.erl | 13 +++++++++++--
src/setup_httpd.erl | 3 ++-
test/t-frontend-setup.sh | 7 +++++--
test/t.sh | 7 +++++--
4 files changed, 23 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-setup/blob/75a7682e/src/setup.erl
----------------------------------------------------------------------
diff --git a/src/setup.erl b/src/setup.erl
index 2118349..4816309 100644
--- a/src/setup.erl
+++ b/src/setup.erl
@@ -24,6 +24,11 @@ require_admins(undefined, {undefined, undefined}) ->
require_admins(_,_) ->
ok.
+require_clustersize(undefined) ->
+ throw({error, "Cluster setup requires node_count to be configured"});
+require_clustersize(_) ->
+ ok.
+
error_bind_address() ->
throw({error, "Cluster setup requires bind_addres != 127.0.0.1"}).
@@ -83,7 +88,8 @@ enable_cluster_http(Options) ->
{<<"username">>, couch_util:get_value(username, Options)},
{<<"password">>, couch_util:get_value(password, Options)},
{<<"bind_address">>, couch_util:get_value(bind_address, Options)},
- {<<"port">>, couch_util:get_value(port, Options)}
+ {<<"port">>, couch_util:get_value(port, Options)},
+ {<<"node_count">>, couch_util:get_value(node_count, Options)}
]}),
Headers = [
@@ -134,6 +140,10 @@ enable_cluster_int(Options, no) ->
config:set("httpd", "bind_address", binary_to_list(NewBindAddress))
end,
+ NodeCount = couch_util:get_value(node_count, Options),
+ ok = require_clustersize(NodeCount),
+ config:set("cluster", "n", integer_to_list(NodeCount)),
+
Port = proplists:get_value(port, Options),
case Port of
undefined ->
@@ -142,7 +152,6 @@ enable_cluster_int(Options, no) ->
config:set("httpd", "port", integer_to_list(Port))
end,
couch_log:notice("Enable Cluster: ~p~n", [Options]).
- %cluster_state:set(enabled).
maybe_set_admin(Username, Password) ->
case couch_auth_cache:get_admin(Username) of
http://git-wip-us.apache.org/repos/asf/couchdb-setup/blob/75a7682e/src/setup_httpd.erl
----------------------------------------------------------------------
diff --git a/src/setup_httpd.erl b/src/setup_httpd.erl
index f84112b..21e81cd 100644
--- a/src/setup_httpd.erl
+++ b/src/setup_httpd.erl
@@ -58,7 +58,8 @@ handle_action("enable_cluster", Setup) ->
{port, <<"port">>},
{remote_node, <<"remote_node">>},
{remote_current_user, <<"remote_current_user">>},
- {remote_current_password, <<"remote_current_password">>}
+ {remote_current_password, <<"remote_current_password">>},
+ {node_count, <<"node_count">>}
], Setup),
case setup:enable_cluster(Options) of
{error, cluster_enabled} ->
http://git-wip-us.apache.org/repos/asf/couchdb-setup/blob/75a7682e/test/t-frontend-setup.sh
----------------------------------------------------------------------
diff --git a/test/t-frontend-setup.sh b/test/t-frontend-setup.sh
index 1c610b6..74743bb 100755
--- a/test/t-frontend-setup.sh
+++ b/test/t-frontend-setup.sh
@@ -16,10 +16,10 @@ HEADERS="-HContent-Type:application/json"
curl a:b@127.0.0.1:15986/_nodes/_all_docs
# Enable Cluster on node A
-curl a:b@127.0.0.1:15984/_cluster_setup -d '{"action":"enable_cluster","username":"foo","password":"baz","bind_address":"0.0.0.0"}' $HEADERS
+curl a:b@127.0.0.1:15984/_cluster_setup -d '{"action":"enable_cluster","username":"foo","password":"baz","bind_address":"0.0.0.0","node_count":2}' $HEADERS
# Enable Cluster on node B
-curl a:b@127.0.0.1:15984/_cluster_setup -d '{"action":"enable_cluster","remote_node":"127.0.0.1","port":"25984","remote_current_user":"a","remote_current_password":"b","username":"foo","password":"baz","bind_address":"0.0.0.0"}' $HEADERS
+curl a:b@127.0.0.1:15984/_cluster_setup -d '{"action":"enable_cluster","remote_node":"127.0.0.1","port":"25984","remote_current_user":"a","remote_current_password":"b","username":"foo","password":"baz","bind_address":"0.0.0.0","node_count":2}' $HEADERS
# Add node B on node A
curl a:b@127.0.0.1:15984/_cluster_setup -d '{"action":"add_node","username":"foo","password":"baz","host":"127.0.0.1","port":25984}' $HEADERS
@@ -57,4 +57,7 @@ curl a:b@127.0.0.1:25984/_replicator
curl a:b@127.0.0.1:25984/_metadata
curl a:b@127.0.0.1:25984/_global_changes
+# Number of nodes is set to 2
+curl a:b@127.0.0.1:25984/_node/node2@127.0.0.1/_config/cluster/n
+
echo "YAY ALL GOOD"
http://git-wip-us.apache.org/repos/asf/couchdb-setup/blob/75a7682e/test/t.sh
----------------------------------------------------------------------
diff --git a/test/t.sh b/test/t.sh
index 62abb61..c569caa 100755
--- a/test/t.sh
+++ b/test/t.sh
@@ -16,10 +16,10 @@ HEADERS="-HContent-Type:application/json"
curl a:b@127.0.0.1:15986/_nodes/_all_docs
# Enable Cluster on node A
-curl a:b@127.0.0.1:15984/_cluster_setup -d '{"action":"enable_cluster","username":"foo","password":"baz","bind_address":"0.0.0.0"}' $HEADERS
+curl a:b@127.0.0.1:15984/_cluster_setup -d '{"action":"enable_cluster","username":"foo","password":"baz","bind_address":"0.0.0.0","node_count":2}' $HEADERS
# Enable Cluster on node B
-curl a:b@127.0.0.1:25984/_cluster_setup -d '{"action":"enable_cluster","username":"foo","password":"baz","bind_address":"0.0.0.0"}' $HEADERS
+curl a:b@127.0.0.1:25984/_cluster_setup -d '{"action":"enable_cluster","username":"foo","password":"baz","bind_address":"0.0.0.0","node_count":2}' $HEADERS
# Add node B on node A
curl a:b@127.0.0.1:15984/_cluster_setup -d '{"action":"add_node","username":"foo","password":"baz","host":"127.0.0.1","port":25984}' $HEADERS
@@ -57,4 +57,7 @@ curl a:b@127.0.0.1:25984/_replicator
curl a:b@127.0.0.1:25984/_metadata
curl a:b@127.0.0.1:25984/_global_changes
+# Number of nodes is set to 2
+curl a:b@127.0.0.1:25984/_node/node2@127.0.0.1/_config/cluster/n
+
echo "YAY ALL GOOD"
[3/4] couchdb-setup git commit: fix wording
Posted by ja...@apache.org.
fix wording
Project: http://git-wip-us.apache.org/repos/asf/couchdb-setup/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-setup/commit/b107042a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-setup/tree/b107042a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-setup/diff/b107042a
Branch: refs/heads/master
Commit: b107042a3193047bdf66fa5c5154c7f2f586814a
Parents: dd68945
Author: Robert Kowalski <ro...@apache.org>
Authored: Fri Jul 24 18:46:49 2015 +0200
Committer: Robert Kowalski <ro...@apache.org>
Committed: Fri Jul 24 18:46:49 2015 +0200
----------------------------------------------------------------------
src/setup.erl | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-setup/blob/b107042a/src/setup.erl
----------------------------------------------------------------------
diff --git a/src/setup.erl b/src/setup.erl
index a456a74..f81abb7 100644
--- a/src/setup.erl
+++ b/src/setup.erl
@@ -24,9 +24,9 @@ require_admins(undefined, {undefined, undefined}) ->
require_admins(_,_) ->
ok.
-require_clustersize(undefined) ->
+require_node_count(undefined) ->
throw({error, "Cluster setup requires node_count to be configured"});
-require_clustersize(_) ->
+require_node_count(_) ->
ok.
error_bind_address() ->
@@ -141,7 +141,7 @@ enable_cluster_int(Options, no) ->
end,
NodeCount = couch_util:get_value(node_count, Options),
- ok = require_clustersize(NodeCount),
+ ok = require_node_count(NodeCount),
config:set_integer("cluster", "n", NodeCount),
Port = proplists:get_value(port, Options),
[2/4] couchdb-setup git commit: use config:setineger/3
Posted by ja...@apache.org.
use config:setineger/3
Project: http://git-wip-us.apache.org/repos/asf/couchdb-setup/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-setup/commit/dd68945a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-setup/tree/dd68945a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-setup/diff/dd68945a
Branch: refs/heads/master
Commit: dd68945a20c9662f0f8912312c2320195c470a00
Parents: 75a7682
Author: Robert Kowalski <ro...@apache.org>
Authored: Fri Jul 24 16:10:41 2015 +0200
Committer: Robert Kowalski <ro...@apache.org>
Committed: Fri Jul 24 16:10:41 2015 +0200
----------------------------------------------------------------------
src/setup.erl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-setup/blob/dd68945a/src/setup.erl
----------------------------------------------------------------------
diff --git a/src/setup.erl b/src/setup.erl
index 4816309..a456a74 100644
--- a/src/setup.erl
+++ b/src/setup.erl
@@ -142,7 +142,7 @@ enable_cluster_int(Options, no) ->
NodeCount = couch_util:get_value(node_count, Options),
ok = require_clustersize(NodeCount),
- config:set("cluster", "n", integer_to_list(NodeCount)),
+ config:set_integer("cluster", "n", NodeCount),
Port = proplists:get_value(port, Options),
case Port of
[4/4] couchdb-setup git commit: Merge remote-tracking branch
'robertkowalski/2594-2598-number-of-nodes'
Posted by ja...@apache.org.
Merge remote-tracking branch 'robertkowalski/2594-2598-number-of-nodes'
* robertkowalski/2594-2598-number-of-nodes:
fix wording
use config:setineger/3
require nodecount on setup
Project: http://git-wip-us.apache.org/repos/asf/couchdb-setup/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-setup/commit/401d7762
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-setup/tree/401d7762
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-setup/diff/401d7762
Branch: refs/heads/master
Commit: 401d7762792878f5787744ae2f6b8c7e31241cb8
Parents: e8d1e32 b107042
Author: Jan Lehnardt <ja...@apache.org>
Authored: Sat Jun 3 11:38:30 2017 +0200
Committer: Jan Lehnardt <ja...@apache.org>
Committed: Sat Jun 3 11:38:30 2017 +0200
----------------------------------------------------------------------
src/setup.erl | 13 +++++++++++--
src/setup_httpd.erl | 3 ++-
test/t-frontend-setup.sh | 7 +++++--
test/t.sh | 7 +++++--
4 files changed, 23 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-setup/blob/401d7762/src/setup.erl
----------------------------------------------------------------------
diff --cc src/setup.erl
index b27c6c6,f81abb7..e58c32d
--- a/src/setup.erl
+++ b/src/setup.erl
@@@ -137,22 -135,23 +143,25 @@@ enable_cluster_int(Options, no) -
case NewBindAddress of
undefined ->
- config:set("httpd", "bind_address", "0.0.0.0");
+ config:set("chttpd", "bind_address", "0.0.0.0");
NewBindAddress ->
- config:set("httpd", "bind_address", binary_to_list(NewBindAddress))
+ config:set("chttpd", "bind_address", binary_to_list(NewBindAddress))
end,
+ NodeCount = couch_util:get_value(node_count, Options),
+ ok = require_node_count(NodeCount),
+ config:set_integer("cluster", "n", NodeCount),
+
Port = proplists:get_value(port, Options),
case Port of
undefined ->
ok;
- Port ->
- config:set("httpd", "port", integer_to_list(Port))
+ Port when is_binary(Port) ->
+ config:set("chttpd", "port", binary_to_list(Port));
+ Port when is_integer(Port) ->
+ config:set_integer("chttpd", "port", Port)
end,
couch_log:notice("Enable Cluster: ~p~n", [Options]).
- %cluster_state:set(enabled).
maybe_set_admin(Username, Password) ->
case couch_auth_cache:get_admin(Username) of
http://git-wip-us.apache.org/repos/asf/couchdb-setup/blob/401d7762/src/setup_httpd.erl
----------------------------------------------------------------------