Name Date Size

..11-Feb-20204 KiB

.gitignoreH A D11-Feb-2020408

cluster_connectH A D11-Feb-20202.7 KiB

cluster_runH A D11-Feb-20205.3 KiB

common_tests/H11-Feb-20204 KiB

configureH A D11-Feb-2020935

deps/H11-Feb-20204 KiB

doc/H11-Feb-20204 KiB

etc/H11-Feb-20204 KiB

include/H11-Feb-20204 KiB

LICENSEH A D11-Feb-202011.1 KiB

MakefileH A D11-Feb-20205.7 KiB

mbbrowse_logs.inH A D11-Feb-2020360

mbbrowse_logs_clusterH A D11-Feb-2020218

mbcollect_infoH A D11-Feb-202010.3 KiB

membase-server.sh.inH A D11-Feb-20201.2 KiB

priv/H11-Feb-20204 KiB

README.markdownH A D11-Feb-20202.3 KiB

README_multinode.markdownH A D11-Feb-20205.2 KiB

rebarH A D11-Feb-202081.6 KiB

rebar.configH A D11-Feb-202062

scripts/H11-Feb-20204 KiB

src/H11-Feb-20204 KiB

test/H11-Feb-20204 KiB

README.markdown

1# The Membase Server
2
3This application represents the top of the hierarchy of all memcached
4smart services.  It is an application in the Erlang OTP sense.
5
6TODO: this picture needs updating
7
8<div>
9    <img src="https://github.com/membase/ns_server/raw/master/doc/images/ns_server.png"
10         alt="[ns server]" style="float: right"/>
11</div>
12
13## Building
14
15Build dependencies include...
16
17* erlang R14 (make sure to have functional crypto)
18
19Building...
20
21You should use top level make file and repo manifest as explained
22here: https://github.com/membase/manifest/blob/master/README.markdown
23
24## Runtime dependencies
25
26Before you start the server, you may need to do the following
27  * Make sure the needed ports are not being used (these include
28    8091, 11211, 11212, etc).
29
30
31## Running
32
33After building everything via top level makefile you'll have
34membase-server script in your $REPO/install/bin (or other prefix if
35you specified so). You can run this script for normal single node
36startup.
37
38During development it's convenient to have several 'nodes' on your
39machine. There's ./cluster_run script in root directory for achiving
40that. Feel free to ask --help. You normally need something like -n2
41where 2 is number of nodes you want.
42
43It'll start REST API on ports 9000...9000+n. memcached on ports
4412000+2*i and moxi ports on 12001+2*i ports.
45
46Note that blank nodes are not configured and need to be setup. I
47suggest trying web UI first to get the feeling of what's
48possible. Just visit REST API port(s) via browser. For development
49mode clusters it's port 9000 and higher. For production mode it's port
508091.
51
52Other alternative is setting up and clustering nodes via REST
53API. membase-cli allows that. And you can easily write your own
54script(s).
55
56There's ./cluster_connect script that eases cluster configuration for
57development clusters. Ask --help.
58
59Sometimes during debugging/development you want smaller number of
60vbuckets. You can change vbuckets number by setting
61MEMBASE_NUM_VBUCKET environment variable to desired number of vbuckets
62before creating new membase bucket.
63
64### Other tools
65
66Membase ships with a bunch of nice tools. Feel free to check
67$REPO/install/bin (or $PREFIX/bin). One of notable tools is
68mbstats. It allows you to query buckets for all kinds of internal
69stats.
70
71Another notable tool is membase-cli. Script is called just membase.
72
73* * * * *
74Copyright (c) 2011, Couchbase, Inc.
75

README_multinode.markdown

1# Running Multiple Nodes per machine
2
3During testing or development, you might want to run more than one
4node per box.  For example, you might want to run two nodes ("ns_1"
5and "ns_2") on your development laptop.  To do so requires priv/config
6file propery overrides.  Here are the step by step instructions...
7
8There are helper scripts that help generate the right multi-node
9configuration files.  To get a 5 node cluster config file, so that
10all the nodes (n_0, n_1, ...) run on 127.0.0.1...
11
12    ./test/gen_cluster_scripts.rb 5
13
14To start the cluster...
15
16    ./cluster_run.sh
17
18Now, you can point your web browser to...
19
20    http://localhost:9000
21    http://localhost:9001
22    ...
23    http://localhost:9004
24
25And, you can join the nodes together with the web console UI.
26
27The memcached direct servers will be running on even port numbers...
28
29   12000, 12002, 12004, ...
30
31The emoxi servers will be running on odd port numbers
32
33   12001, 12003, 12005, ...
34
35To stop the cluster press Ctrl-D or Ctrl-C.
36
37After you've joined nodes together, they will remember their join
38configuration (in the ./config directory) and when you start/stop
39the cluster, they should automatically rejoin.
40
41-------------------
42
43Below are the old manual instructions for joining nodes together into
44a cluster...
45
46Make a copy of the priv/config file...
47
48    cp priv/config priv/config2
49
50Start erlang...
51
52    erl -name ns_1
53
54Make a note of your "node name" at erlang's shell prompt.  For
55example, below my node name is "ns_1@stevenmb.gateway.2wire.net"...
56
57    stevenmb:ns_server steveyen$ erl -name ns_1
58    Erlang R13B03 (erts-5.7.4) [source]
59    Eshell V5.7.4  (abort with ^G)
60    (ns_1@stevenmb.gateway.2wire.net)1>
61
62Quit/ctrl-C from the erlang shell.
63
64Next, open up your favorite text editor to edit the priv/config2 file.
65You'll need to edit everywhere you see a port number, and add extra
66"per-node" entries.  One by one...
67
68In your priv/config2 file, if you see...
69
70    {rest, [{'_ver', {0, 0, 0}},
71            {port, 8091}
72           ]}.
73
74Add an additional "per-node" entry right below it, so it looks like...
75
76    {rest, [{'_ver', {0, 0, 0}},
77            {port, 8091}
78           ]}.
79    {{node, 'ns_2@stevenmb.gateway.2wire.net', rest},
80         [{'_ver', {0, 0, 0}},
81          {port, 8081}
82         ]}.
83
84With the above change, the priv/config2 file is saying that by default
85the rest key has a port value of 8091.  And, on node
86ns_2@stevenmb.gateway.2wire.net, the value of the rest key will have a
87port number of 8081.  So, when ns_1 and ns_2 run on the same machine,
88they won't have a REST admin api port conflict.
89
90By the way, you can add more than one "per-node" entries, which is
91useful in case you move your machine between networks.  For example, I
92have 3 extra entries, one for the office, one for home, and one for
93when I'm not connected.  So, my per-node overrides in my priv/config2
94file look like...
95
96    {rest, [{'_ver', {0, 0, 0}},
97            {port, 8091}
98           ]}.
99    {{node, 'ns_2@stevenmb.gateway.2wire.net', rest},
100         [{'_ver', {0, 0, 0}},
101          {port, 8081}
102         ]}.
103    {{node, 'ns_2@stevenmb.hsd1.ca.comcast.net', rest},
104         [{'_ver', {0, 0, 0}},
105          {port, 8081}
106         ]}.
107    {{node, 'ns_2@stevenmb.local', rest},
108         [{'_ver', {0, 0, 0}},
109          {port, 8081}
110         ]}.
111
112Let's keep going, as there are more "per-node" entries to handle more
113port conflicts...
114
115Do the same for the "port_servers" key.  For example...
116
117    {port_servers,
118      [{'_ver', {0, 0, 0}},
119       {memcached, "./memcached",
120        [
121         "-E", "engines/default_engine.so",
122         "-p", "11212"
123         ],
124        [{env, [{"MEMCACHED_CHECK_STDIN", "thread"},
125                {"ISASL_PWFILE", "/tmp/isasl.pw"} % Also isasl_path above.
126               ]}]
127       }
128      ]}.
129    {{node, 'ns_2@stevenmb.gateway.2wire.net', port_servers},
130      [{'_ver', {0, 0, 0}},
131       {memcached, "./memcached",
132        [
133         "-E", "engines/default_engine.so",
134         "-p", "11222"
135         ],
136        [{env, [{"MEMCACHED_CHECK_STDIN", "thread"},
137                {"ISASL_PWFILE", "/tmp/isasl.pw"} % Also isasl_path above.
138               ]}]
139       }
140      ]}.
141
142Above, ns_1 will start a memcached running on port 11212 since that's
143the default setting; and ns_2 will start a memcached running on port
14411222.
145
146And, the same for your pools port number.  This one is a little
147special, where the per-node overrides are inside the nested value.
148
149So, instead of the default config...
150
151    {pools, [
152      {'_ver', {0, 0, 0}},
153      {"default", [
154        {port, 11213},
155        {buckets, [
156          {"default", [
157            {auth_plain, undefined},
158            {size_per_node, 64} % In MB.
159          ]}
160        ]}
161      ]}
162    ]}.
163
164You will make it instead look like, adding per-node port overrides
165inside the value.
166
167    {pools, [
168      {'_ver', {0, 0, 0}},
169      {"default", [
170        {port, 11213},
171        {{node, 'ns_2@stevenmb.gateway.2wire.net', port}, 11223},
172        {{node, 'ns_2@stevenmb.hsd1.ca.comcast.net', port}, 11223},
173        {{node, 'ns_2@stevenmb.local', port}, 11223},
174        {buckets, [
175          {"default", [
176            {auth_plain, undefined},
177            {size_per_node, 64} % In MB.
178          ]}
179        ]}
180      ]}
181    ]}.
182
183* * * * *
184Copyright (c) 2011, Membase, Inc.
185
186