Couchbase 2.1.1 Community Installation Instructions and Basics

The life of the system administrator threw a new beast on an already thorny path. It was necessary for the client for the project to use Couchbase without fail.
Under the cat, instructions for installing it, adding it to the cluster, and balancing data. And suddenly someone will be useful.
Install Couchbase.
Install openssl098e.
Download and install couchbase 2.1.1
wget http://packages.couchbase.com/releases/2.1.1/couchbase-server-community_x86_64_2.1.1.rpm
rpm -Uhv couchbase-server-community_x86_64_2.1.1.rpm
In our company actively uses virtualization OpenVZ, and for the normal operation of the container couchbase openvz needs memsup file from the package erlang-os-mon later version 2.2.10.
What we do:
Stop couchbase:
service couchbase-server stop
First you need to download erlang itself, for example, from the official website www.erlang.org/download.html
and compile the desired library, which is located on the path lib / os_mon / priv
Then, from lib / os_mon / priv / bin we take memsup and put it in directory /opt/couchbase/lib/erlang/lib/os_mon-2.2.7/priv/bin/ We set the
rights to it:
chown bin:bin /opt/couchbase/lib/erlang/lib/os_mon-2.2.7/priv/bin/memsup
chmod a+x /opt/couchbase/lib/erlang/lib/os_mon-2.2.7/priv/bin/memsup
We launch the couchbase-server server and use it.
The default admin panel is available at hostname : 8091 /
Adding a new server to the cluster and balancing data.
Attention!!! Before adding a new server to the cluster, you must remove the database backup.
For example, like this:
/opt/couchbase/bin/cbbackup -u Administrator -p PASSWORD http://localhost:8091/ /tmp/cbbackup/
Or, if you need a backup of only one bucket, the rest are not important:
/opt/couchbase/bin/cbbackup -u Administrator -p PASSWORD http://localhost:8091/ /tmp/cbbackup/ -b SRC_BUCKET
When adding a new server to the couchbase cluster, it is necessary to rebalance the data and it may happen that the rebalance does not work and there will be an error in the log that looks something like this:
<0.20769.2129> exited with {unexpected_exit,
{'EXIT',<0.20785.2129>,
{badmatch,
[{'EXIT',
{{badmatch,{error,closed}},
{gen_server,call,
[<19210.18145.6>,had_backfill,30000]}}}]}}}
Option 1.
On the hw node, you can try changing vm.swappiness to the time of data balancing and restart rebalancing:
sysctl -w vm.swappiness=0
If the balancing fails:
Option 2. (
We clear or delete the bucket) 1. We look through the couchbase host admin interface : 8091 / on which bucket the balancing falls (the Server Nodes tab and open the servers themselves)
2. Go to the Data Bucket tab, open the desired bucket , and in it (Edit) button
3. We are looking at the very bottom, next to the DELETE button, the FLUSH button. (If it is not there, check the Flush-Enable checkbox a little higher.) And press FLUSH, thereby clearing the contents of the bucket (we have a backup)
4. If the bucket clears normally, do rebalancing again. If it is, then fill the bucket back.
/opt/couchbase/bin/cbrestore -u Administrator -p PASSWORD /tmp/cbbackup/ http://host:8091/ -b <_имя_бакета_>
5. If the bucket does not clear, or if the balancing also does not work on it after cleaning, then
6. In the edit menu of the bucket (Edit), we remember (write) all information about it and delete it. After that, create a new one with the same parameters and fill in the backup.
And so for each bucket.
And a very useful command, most often you have to use:
/opt/couchbase/bin/cbrestore -u Administrator -p PASSWORD -b SRC_BUCKET -B DST_BUCKET -k "key1|key2|key3|key...|KeyN" /tmp/cbbackup/ http://localhost:8091
Recovers individual keys.