From 7b0005be9dd45a0ce3639a7f5db58c1d2df2e485 Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Fri, 27 Aug 2010 17:42:27 -0400 Subject: my name is BigCouch --- Makefile | 12 +++++----- README.md | 38 ++++++++++++++--------------- apps/chttpd/README.md | 4 ++-- apps/chttpd/src/chttpd_misc.erl | 6 ++--- apps/mem3/test/mem3_util_test.erl | 50 +++++++++++++++++++-------------------- configure | 18 +++++++------- rel/overlay/bin/bigcouch | 28 ++++++++++++++++++++++ rel/overlay/bin/dbcore | 28 ---------------------- rel/overlay/etc/default.ini | 2 +- rel/reltool.config | 6 ++--- rel/sv/README | 2 +- rel/sv/dbcore/run | 4 ++-- 12 files changed, 98 insertions(+), 100 deletions(-) create mode 100755 rel/overlay/bin/bigcouch delete mode 100755 rel/overlay/bin/dbcore diff --git a/Makefile b/Makefile index aee9a70d..3b36e74c 100644 --- a/Makefile +++ b/Makefile @@ -29,22 +29,22 @@ check: @ERL_LIBS="`pwd`/apps" prove apps/couch/test/etap/*.t dist: compile - @rm -rf rel/dbcore + @rm -rf rel/bigcouch @./rebar generate distclean: clean - @rm -rf rel/dbcore + @rm -rf rel/bigcouch include install.mk install: dist @mkdir -p $(prefix) - @cp -R rel/dbcore/* $(prefix) + @cp -R rel/bigcouch/* $(prefix) @mkdir -p $(data_dir) @chown $(user) $(data_dir) @mkdir -p $(view_dir) @chown $(user) $(view_dir) - @touch $(prefix)/var/log/dbcore.log - @chown $(user) $(prefix)/var/log/dbcore.log + @touch $(prefix)/var/log/bigcouch.log + @chown $(user) $(prefix)/var/log/bigcouch.log dev: compile @rm -rf rel/dev1 rel/dev2 rel/dev3 @@ -55,7 +55,7 @@ dev: compile @echo "==> Building development node #3 (ports 35984/35986)" @./rebar generate target_dir=dev3 overlay_vars=dev3.config @echo "\n\ -Development nodes are built, and can be started using ./rel/dev[123]/bin/dbcore.\n\ +Development nodes are built, and can be started using ./rel/dev[123]/bin/bigcouch.\n\ Once the nodes are started, they must be joined together by editing the local\n\ nodes DB. For example, executing\n\ \n\ diff --git a/README.md b/README.md index 10757936..156b1f2a 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,19 @@ -## cloudant-dbcore - ### Overview -Cloudant-dbcore is a highly available, fault-tolerant, clustered, fully api-compliant version of [Apache CouchDB][1]. While it appears to the end-user as one CouchDB instance, it is in fact one or more nodes in an elastic cluster, acting in concert to store and retrieve documents, index and serve views, and serve CouchApps. Dbcore has been developed and is continually maintained by [Cloudant][2] who offer hosted CouchDB as a service. +BigCouch is a highly available, fault-tolerant, clustered, mostly api-compliant version of [Apache CouchDB][1]. While it appears to the end-user as one CouchDB instance, it is in fact one or more nodes in an elastic cluster, acting in concert to store and retrieve documents, index and serve views, and serve CouchApps. BigCouch has been developed and is continually maintained by [Cloudant][2] who offer hosted CouchDB as a service. Clusters behave according to concepts outlined in [Amazon's Dynamo paper][4], namely that each node can accept requests, data is placed on partitions based on a consistent hashing algorithm, and quorum protocols are for read/write operations. ### Contents * README.md this file - * LICENSE open-source license governing dbcore + * LICENSE open-source license governing BigCouch ### Getting Started #### Prerequisites -Cloudant-dbcore has the same dependencies as CouchDB: +BigCouch has the same dependencies as CouchDB: * Erlang (R13B03 or higher) * ICU (4.2 is preferable) @@ -42,35 +40,35 @@ To install Spidermonkey 1.9.2 from PPA: brew install erlang icu4c spidermonkey brew ln icu4c -#### Building and installing dbcore +#### Building and installing BigCouch -`$CLOUDANT_SRC` is the directory holding your downloaded source files, while `$PREFIX` is the prefix to which the software is installed (defaults to `/opt/dbcore`): +`$CLOUDANT_SRC` is the directory holding your downloaded source files, while `$PREFIX` is the prefix to which the software is installed (defaults to `/opt/bigcouch`): cd $CLOUDANT_SRC ./configure -p $PREFIX make sudo make install -`sudo` is only necessary when installing to a prefix which is not user-writeable. In any case, the installer tries to chown the database directory and logfile to the user who configured dbcore. +`sudo` is only necessary when installing to a prefix which is not user-writeable. In any case, the installer tries to chown the database directory and logfile to the user who configured BigCouchbigcouch. -#### Starting dbcore +#### Starting BigCouch - $PREFIX/bin/dbcore + $PREFIX/bin/bigcouch Now, visit http://localhost:5984/_utils in a browser to verify the CouchDB node is operational. -dbcore listens on two ports. Defaults and explanations: +BigCouch listens on two ports. Defaults and explanations: * 5984 - front door, cluster-aware port, appears as a standalone CouchDB. * 5986 - back door, single-node port, used for admin functions -Note: see the rel/sv/README file for information on using runit to stop/start dbcore. +Note: see the `rel/sv/README` file for information on using `runit` to stop/start BigCouch. #### Joining a new node to the cluster -Each dbcore node has a local `nodes` database, accessible through the backend interface on port 5986. Documents in the `nodes` DB name nodes in the cluster. To add a new node, create a document with that node's name as the ID. For example +Each BigCouch node has a local `nodes` database, accessible through the backend interface on port 5986. Documents in the `nodes` DB name nodes in the cluster. To add a new node, create a document with that node's name as the ID. For example - curl -X PUT http://foo.example.com:5986/nodes/dbcore@bar.example.com -d {} + curl -X PUT http://foo.example.com:5986/nodes/bigcouch@bar.example.com -d {} Everything else should be automatic, provided the machines can ping each other and the nodes set the same magic cookie. You are advised to change the magic cookie from the default in `rel/etc/vm.args` when on a public network. @@ -78,9 +76,9 @@ Everything else should be automatic, provided the machines can ping each other a The `make dev` target will build a three-node cluster under the rel/ directory. Get the nodes running, like above, by doing the following (in separate terminals): - ./rel/dev1/bin/dbcore - ./rel/dev2/bin/dbcore - ./rel/dev3/bin/dbcore + ./rel/dev1/bin/bigcouch + ./rel/dev2/bin/bigcouch + ./rel/dev3/bin/bigcouch These development nodes listen on ports 15984/15986 (dev1), 25984/25986 (dev2), and 35984/35986 (dev3). Now, once the nodes are started, join the dev2 node by sending this PUT to dev1's listening backend port: @@ -98,7 +96,7 @@ Add node 3 to the cluster by sending a similar PUT to either of the first two no #### Now What? -If the above steps were successful, you should have a running dbcore cluster that looks just like a standalone CouchDB. You may interact with it the same way you would a standalone CouchDB, via the HTTP REST interface. +If the above steps were successful, you should have a running BigCouch cluster that looks just like a standalone CouchDB. You may interact with it the same way you would a standalone CouchDB, via the HTTP REST interface. Because every node can handle requests equally, you may want to put a load balancer in front of the cluster and set up a round-robin strategy for distributing incoming requests across all of your cluster's nodes. @@ -132,7 +130,7 @@ _W_ - write quorum constant. When writing the N copies, the data store will res ### Troubleshooting -Please see [http://github.com/cloudant/dbcore/wiki/troubleshooting][8] +Please see [http://github.com/cloudant/bigcouch/wiki/troubleshooting][8] ### Contact @@ -150,4 +148,4 @@ Cloudant folks are usually hanging out in IRC. Freenode, channel #cloudant. We [5]: http://loadbalancer:5984/_utils [6]: https://launchpad.net/~commonjs/+archive/ppa/ [7]: http://mxcl.github.com/homebrew/ -[8]: http://github.com/cloudant/dbcore/wiki/troubleshooting +[8]: http://github.com/cloudant/bigcouch/wiki/troubleshooting diff --git a/apps/chttpd/README.md b/apps/chttpd/README.md index 4b42264d..2c2a2cf9 100644 --- a/apps/chttpd/README.md +++ b/apps/chttpd/README.md @@ -1,6 +1,6 @@ ## chttpd -chttpd is a cluster-aware http layer for [CouchDB][1]. It is used in [cloudant-dbcore][2] as the http front-end. +chttpd is a cluster-aware http layer for [CouchDB][1]. It is used in [BigCouch][2] as the http front-end. ### Getting Started Dependencies: @@ -17,7 +17,7 @@ Build with rebar: * [info@cloudant.com][5] [1]: http://couchdb.apache.org -[2]: http://github.com/cloudant/dbcore +[2]: http://github.com/cloudant/bigcouch [3]: http://www.apache.org/licenses/LICENSE-2.0.html [4]: http://cloudant.com [5]: mailto:info@cloudant.com diff --git a/apps/chttpd/src/chttpd_misc.erl b/apps/chttpd/src/chttpd_misc.erl index 9a05f69e..7e6a3a83 100644 --- a/apps/chttpd/src/chttpd_misc.erl +++ b/apps/chttpd/src/chttpd_misc.erl @@ -35,16 +35,16 @@ handle_welcome_req(#httpd{method='GET'}=Req, WelcomeMessage) -> send_json(Req, {[ {couchdb, WelcomeMessage}, {version, list_to_binary(couch:version())}, - {dbcore, get_version()} + {bigcouch, get_version()} ]}); handle_welcome_req(Req, _) -> send_method_not_allowed(Req, "GET,HEAD"). get_version() -> Releases = release_handler:which_releases(), - Version = case [V || {"dbcore", V, _, current} <- Releases] of + Version = case [V || {"bigcouch", V, _, current} <- Releases] of [] -> - case [V || {"dbcore", V, _, permanent} <- Releases] of + case [V || {"bigcouch", V, _, permanent} <- Releases] of [] -> "dev"; [Permanent] -> diff --git a/apps/mem3/test/mem3_util_test.erl b/apps/mem3/test/mem3_util_test.erl index f43410a7..490521cf 100644 --- a/apps/mem3/test/mem3_util_test.erl +++ b/apps/mem3/test/mem3_util_test.erl @@ -52,68 +52,68 @@ build_shards_test() -> DocProps1 = [{<<"changelog">>, [[<<"add">>,<<"00000000-1fffffff">>, - <<"dbcore@node.local">>], + <<"bigcouch@node.local">>], [<<"add">>,<<"20000000-3fffffff">>, - <<"dbcore@node.local">>], + <<"bigcouch@node.local">>], [<<"add">>,<<"40000000-5fffffff">>, - <<"dbcore@node.local">>], + <<"bigcouch@node.local">>], [<<"add">>,<<"60000000-7fffffff">>, - <<"dbcore@node.local">>], + <<"bigcouch@node.local">>], [<<"add">>,<<"80000000-9fffffff">>, - <<"dbcore@node.local">>], + <<"bigcouch@node.local">>], [<<"add">>,<<"a0000000-bfffffff">>, - <<"dbcore@node.local">>], + <<"bigcouch@node.local">>], [<<"add">>,<<"c0000000-dfffffff">>, - <<"dbcore@node.local">>], + <<"bigcouch@node.local">>], [<<"add">>,<<"e0000000-ffffffff">>, - <<"dbcore@node.local">>]]}, + <<"bigcouch@node.local">>]]}, {<<"by_node">>, - {[{<<"dbcore@node.local">>, + {[{<<"bigcouch@node.local">>, [<<"00000000-1fffffff">>,<<"20000000-3fffffff">>, <<"40000000-5fffffff">>,<<"60000000-7fffffff">>, <<"80000000-9fffffff">>,<<"a0000000-bfffffff">>, <<"c0000000-dfffffff">>,<<"e0000000-ffffffff">>]}]}}, {<<"by_range">>, - {[{<<"00000000-1fffffff">>,[<<"dbcore@node.local">>]}, - {<<"20000000-3fffffff">>,[<<"dbcore@node.local">>]}, - {<<"40000000-5fffffff">>,[<<"dbcore@node.local">>]}, - {<<"60000000-7fffffff">>,[<<"dbcore@node.local">>]}, - {<<"80000000-9fffffff">>,[<<"dbcore@node.local">>]}, - {<<"a0000000-bfffffff">>,[<<"dbcore@node.local">>]}, - {<<"c0000000-dfffffff">>,[<<"dbcore@node.local">>]}, - {<<"e0000000-ffffffff">>,[<<"dbcore@node.local">>]}]}}], + {[{<<"00000000-1fffffff">>,[<<"bigcouch@node.local">>]}, + {<<"20000000-3fffffff">>,[<<"bigcouch@node.local">>]}, + {<<"40000000-5fffffff">>,[<<"bigcouch@node.local">>]}, + {<<"60000000-7fffffff">>,[<<"bigcouch@node.local">>]}, + {<<"80000000-9fffffff">>,[<<"bigcouch@node.local">>]}, + {<<"a0000000-bfffffff">>,[<<"bigcouch@node.local">>]}, + {<<"c0000000-dfffffff">>,[<<"bigcouch@node.local">>]}, + {<<"e0000000-ffffffff">>,[<<"bigcouch@node.local">>]}]}}], Shards1 = mem3_util:build_shards(<<"testdb1">>, DocProps1), ExpectedShards1 = [{shard,<<"shards/00000000-1fffffff/testdb1">>, - 'dbcore@node.local',<<"testdb1">>, + 'bigcouch@node.local',<<"testdb1">>, [0,536870911], undefined}, {shard,<<"shards/20000000-3fffffff/testdb1">>, - 'dbcore@node.local',<<"testdb1">>, + 'bigcouch@node.local',<<"testdb1">>, [536870912,1073741823], undefined}, {shard,<<"shards/40000000-5fffffff/testdb1">>, - 'dbcore@node.local',<<"testdb1">>, + 'bigcouch@node.local',<<"testdb1">>, [1073741824,1610612735], undefined}, {shard,<<"shards/60000000-7fffffff/testdb1">>, - 'dbcore@node.local',<<"testdb1">>, + 'bigcouch@node.local',<<"testdb1">>, [1610612736,2147483647], undefined}, {shard,<<"shards/80000000-9fffffff/testdb1">>, - 'dbcore@node.local',<<"testdb1">>, + 'bigcouch@node.local',<<"testdb1">>, [2147483648,2684354559], undefined}, {shard,<<"shards/a0000000-bfffffff/testdb1">>, - 'dbcore@node.local',<<"testdb1">>, + 'bigcouch@node.local',<<"testdb1">>, [2684354560,3221225471], undefined}, {shard,<<"shards/c0000000-dfffffff/testdb1">>, - 'dbcore@node.local',<<"testdb1">>, + 'bigcouch@node.local',<<"testdb1">>, [3221225472,3758096383], undefined}, {shard,<<"shards/e0000000-ffffffff/testdb1">>, - 'dbcore@node.local',<<"testdb1">>, + 'bigcouch@node.local',<<"testdb1">>, [3758096384,4294967295], undefined}], ?assertEqual(ExpectedShards1, Shards1), diff --git a/configure b/configure index e9ce1b07..eb8afd40 100755 --- a/configure +++ b/configure @@ -18,8 +18,8 @@ function quit { exit } -PREFIX="/opt/dbcore" -DBCORE_USER=`whoami` +PREFIX="/opt/bigcouch" +BIGCOUCH_USER=`whoami` ABSPATH="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")" DIRPATH=`dirname "$ABSPATH"` @@ -44,7 +44,7 @@ do shift 2 ;; -u) - DBCORE_USER=$2 + BIGCOUCH_USER=$2 shift 2 ;; *) @@ -57,13 +57,13 @@ done if test ! -n "$DATA"; then DATA="$PREFIX/var/lib"; fi if test ! -n "$VIEW"; then VIEW="$PREFIX/var/lib"; fi -echo "==> configuring dbcore in rel/dbcore.config" -cat > rel/dbcore.config << EOF +echo "==> configuring bigcouch in rel/bigcouch.config" +cat > rel/bigcouch.config << EOF {prefix, "$PREFIX"}. {data_dir, "$DATA"}. {view_dir, "$VIEW"}. -{user, "$DBCORE_USER"}. -{node_name, "-name dbcore"}. +{user, "$BIGCOUCH_USER"}. +{node_name, "-name bigcouch"}. {cluster_port, 5984}. {backend_port, 5986}. EOF @@ -73,7 +73,7 @@ cat > install.mk << EOF prefix = $PREFIX data_dir = $DATA view_dir = $VIEW -user = $DBCORE_USER +user = $BIGCOUCH_USER EOF # finally, a few config files for local development nodes @@ -88,4 +88,4 @@ cat > rel/dev$i.config << EOF EOF done -cat rel/dbcore.config +cat rel/bigcouch.config diff --git a/rel/overlay/bin/bigcouch b/rel/overlay/bin/bigcouch new file mode 100755 index 00000000..22275daf --- /dev/null +++ b/rel/overlay/bin/bigcouch @@ -0,0 +1,28 @@ +#!/bin/bash + +# Licensed 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. + +ERTS_BIN_DIR=$(cd ${0%/*} && pwd) + +export ROOTDIR=${ERTS_BIN_DIR%/*} + +START_ERL=`cat $ROOTDIR/releases/start_erl.data` +ERTS_VSN=${START_ERL% *} +APP_VSN=${START_ERL#* } + +export BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin +export EMU=beam +export PROGNAME=`echo $0 | sed 's/.*\///'` + +exec $BINDIR/erlexec -boot $ROOTDIR/releases/$APP_VSN/bigcouch \ + -args_file $ROOTDIR/etc/vm.args diff --git a/rel/overlay/bin/dbcore b/rel/overlay/bin/dbcore deleted file mode 100755 index ca113a42..00000000 --- a/rel/overlay/bin/dbcore +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -# Licensed 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. - -ERTS_BIN_DIR=$(cd ${0%/*} && pwd) - -export ROOTDIR=${ERTS_BIN_DIR%/*} - -START_ERL=`cat $ROOTDIR/releases/start_erl.data` -ERTS_VSN=${START_ERL% *} -APP_VSN=${START_ERL#* } - -export BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin -export EMU=beam -export PROGNAME=`echo $0 | sed 's/.*\///'` - -exec $BINDIR/erlexec -boot $ROOTDIR/releases/$APP_VSN/dbcore \ - -args_file $ROOTDIR/etc/vm.args diff --git a/rel/overlay/etc/default.ini b/rel/overlay/etc/default.ini index c86eeefb..a3409586 100644 --- a/rel/overlay/etc/default.ini +++ b/rel/overlay/etc/default.ini @@ -28,7 +28,7 @@ backlog = 512 secure_rewrites = true [log] -file = {{prefix}}/var/log/dbcore.log +file = {{prefix}}/var/log/bigcouch.log level = info [couch_httpd_auth] diff --git a/rel/reltool.config b/rel/reltool.config index 6cc5b3f5..1b5868f4 100644 --- a/rel/reltool.config +++ b/rel/reltool.config @@ -14,7 +14,7 @@ {sys, [ {lib_dirs, ["../apps"]}, - {rel, "dbcore", "1.2.4", [ + {rel, "bigcouch", "1.2.4", [ kernel, stdlib, sasl, @@ -33,7 +33,7 @@ chttpd ]}, {rel, "start_clean", "", [kernel, stdlib]}, - {boot_rel, "dbcore"}, + {boot_rel, "bigcouch"}, {profile, embedded}, {excl_sys_filters, ["^bin/.*", "^erts.*/bin/(dialyzer|typer)"]}, {excl_archive_filters, [".*"]}, @@ -48,7 +48,7 @@ {app, chttpd, [{incl_cond, include}]} ]}. -{overlay_vars, "dbcore.config"}. +{overlay_vars, "bigcouch.config"}. {overlay, [ {mkdir, "var/log"}, {copy, "overlay/bin"}, diff --git a/rel/sv/README b/rel/sv/README index 377a2e17..b5cc7404 100644 --- a/rel/sv/README +++ b/rel/sv/README @@ -1 +1 @@ -This is an example of a cloudant-dbcore runit (http://smarden.org/runit/) service. Use it to start/stop/restart cloudant-dbcore. You may need to adjust the "run" script for install location and the home directory cloudant-dbcore will run as. +This is an example of a BigCouch runit (http://smarden.org/runit/) service. Use it to start/stop/restart BigCouch. You may need to adjust the "run" script for install location and the home directory BigCouch will run as. diff --git a/rel/sv/dbcore/run b/rel/sv/dbcore/run index a137fab6..875c3f02 100755 --- a/rel/sv/dbcore/run +++ b/rel/sv/dbcore/run @@ -1,4 +1,4 @@ #!/bin/bash exec 2>&1 -export HOME=/home/dbcore -exec chpst -u dbcore /opt/dbcore/bin/dbcore +export HOME=/home/bigcouch +exec chpst -u bigcouch /opt/bigcouch/bin/bigcouch -- cgit v1.2.3