
The life of the system administrator threw a new beast on an already thorny path. It was required to the client for the project to use Couchbase without fail.
Under the cut instructions for installing it, adding to the cluster and balancing data. What if it would 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
Our company actively uses OpenVZ virtualization, and for normal operation of couchbase in the openvz container, a memsup file from the erlang-os-mon version 2.2.10 or later is required.
What we do:
Stop couchbase:
service couchbase-server stop
First you need to download erlang itself, for example, from the official site
www.erlang.org/download.htmlAnd compile the necessary library, which is on the way lib / os_mon / priv
Then, from lib / os_mon / priv / bin, take memsup and place it in the /opt/couchbase/lib/erlang/lib/os_mon-2.2.7/priv/bin/ directory
Expose 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 start the couchbase-server server and use it.
Admin default is available on
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 backup database.For example:
/opt/couchbase/bin/cbbackup -u Administrator -p PASSWORD http://localhost:8091/ /tmp/cbbackup/
Or, if you need to backup only one bake, 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 rebalancing does not pass and there will be an error in the log about the following:
<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 hw node, you can try to change vm.swappiness for the time of balancing data and re-run rebalancing:
sysctl -w vm.swappiness=0
If balancing is not passed:
Option 2. (clear or remove the bake)
1. We look through the couchbase
host admin: 8091 / on which batch balancing falls (Server Nodes tab and open the servers themselves)
2. Go to the tab Data Bucket, open the desired bakt, and in it the button (Edit)
3. We are looking at the very bottom, next to the button DELETE button FLUSH. (If it doesn’t exist, just put the Flush-Enable checkbox above.) And press FLUSH, thereby clearing the contents of the bake (we have the same backup)
4. If the bake is cleared normally, we do the rebalancing again. If it has passed then we fill the back.
/opt/couchbase/bin/cbrestore -u Administrator -p PASSWORD /tmp/cbbackup/ http://host:8091/ -b <___>
5. If the bake is not cleared, or if after cleaning the balancing also does not pass on it, then
6. In the edit menu of the bake (Edit) we remember (write) all the information about it and delete it. After that we create a new one with the same parameters and fill in the backup.
And so for each baktu.
And a very useful team, 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.