Couchbase backups via command line


Performing backups to couchbase 2.x server via command line. The couchbase server commands are stored in the opt directory. The shell for cbbackup command is located in the bin folder.

cd /opt/couchbase/bin/
./cbbackup http://YOUR_IP:8091 /home/BACKUP_NAME -u YOUR_USERNAME -p YOUR_PASSWORD

To restore the data you specify the backup folder that you created above, then call the bucket name from that backup your want to recover.


Memcached optimization


Swapping out CakePHP’s default file logging for memcache can greatly improve performance. In my case I use couchbase server to manage NoSQL. From there administrative panel you can see every time your app has a page refresh.

Couchbase Server default bucket

Memcached optimization with CakePHP 2.x

To connect CakePHP with memcached place this in your app/Config/core.php

Cache::config('default', array(
	'engine' => 'Memcache',
	'prefix' => Inflector::slug(APP_DIR) . '_',
	'servers' => array(
			'' // localhost, default port 11211
		), //[optional]
	'duration' => 7200,
	'serialize' => false,
	'persistent' => true, // [optional] set this to false for non-persistent connections
	'compress' => false,
	'probability' => 100 

Your application will now benefit from using memcache instead of a standard logging system. In the event that you make major changes to you application you may need to “flush” the memcache bucket to clear the cached schema stored by CakePHP.