Filter blogs by:
- 2017 (21) See months Hide months
- Alex Popov (1)
- Alexis Roos (4)
- Ali LeClerc (30)
- Anil Kumar (9)
- Anne Obendorf (6)
- Arun Gupta (81)
- Austin Gonyou (3)
- Benjamin Young (2)
- Bob Wiederhold (24)
- Brett Lawson (17)
- Cecile Le Pape (2)
- Cihan Biyikoglu (36)
- Damien Katz (3)
- David Maier (1)
- David Maitland (4)
- David Ostrovsky (1)
- David Segleau (1)
- Dipti Borkar (1)
- Don Pinto (40)
- Doug Laird (4)
- Dustin Sallings (8)
- Eric Lambert (1)
- Gareth Powell (1)
- Hod Greeley (22)
- Ilam Siva (4)
- J. Chris Anderson (12)
- James Nocentini (19)
- James Phillips (14)
- Jan Lehnardt (1)
- Jeff Morris (43)
- Jerod Johnson (1)
- John Zablocki (16)
- Justin Michaels (3)
- Keshav Murthy (2)
- Ketaki Gangal (1)
- Kirk Kirkconnell (13)
- Koji Kawamura (1)
- Laura Czajkowski (38)
- Laurent Doguin (34)
- MC Brown (4)
- Manuel Hurtado (3)
- Mark Nunberg (9)
- Martin Esmann (10)
- Marty Schoch (4)
- Matt Ingenthron (8)
- Matthew Groves (41)
- Matthew Revell (33)
- Michael Nitschinger (15)
- Nic Raboy (94)
- Nowrin Joyita (1)
- Pasin Suriyentrakorn (1)
- Patrick Galbraith (5)
- Perry Krug (9)
- Philipp Fehre (2)
- Pranav Mayuram (6)
- Prasad Varakur (3)
- Qi Zhu (2)
- Raghavan Srinivas (7)
- Roi Katz (3)
- Sandhya Krishnamurthy (4)
- Sean Lynch (3)
- Sergey Avseyev (11)
- Shane Johnson (30)
- Simon Baslé (13)
- Steve Yen (2)
- Tim Wong (3)
- Todd Greenstein (12)
- Tom Rosenfeld (1)
- Traun Leyden (1)
- Trond Norbye (12)
- Volker Mische (3)
- Wayne Carter (8)
- Will Gardella (5)
- William Hoang (41)
- See all
- See fewer
If you are an administrator looking for an automated way to deploy Couchbase at scale, look no further - Chef is a great platform solution. Once setup, it is a very clean solution that can work across any number of physical, virtual, or cloud servers, no matter what the size of the infrastructure. Chef enables you to script your infrastructure deployment using code so that you can automate your provisioning and deployment process without much effort.
In this blog, we will go over the chef recipes used to install couchbase, setup a cluster of couchbase nodes, add some buckets and finally add xdcr replication between clusters.
Before you start - Make sure you are familiar with the basics of chef server, cookbooks and chef-clients. Chef has a huge stack of templates, recipes, knife plugins which can be very useful to maintain large scale setups. http://wiki.opscode.com has good examples and information on this.
Setup a chef-server, workstation and have some nodes added on as chef-clients. Once the above 3 are setup, you are ready to write your Couchbase Cookbook. A forked version of the opscode cookbook is here https://github.com/ketakigangal/couchbase
Install the following cookbooks before downloading the couchbase cookbook - yum, apt-get, windows, build-essential
Get the Couchbase cookbook
git clone https://github.com/ketakigangal/couchbase
A quick look into the cookbook resources and available customizations
Based on your system needs, you can add more flexible attributes, resources, templates for the nodes and clusters. Ideally use the data-bags to define your cluster naming, here I have used role to describe very simple implementation of two clusters - “west_cluster” and “east_cluster”, more details ahead.
The server.rb and client.rb have the default settings for server and clients. Make sure to reflect the needful couchbase versions, username/password for the server.rb in attributes. For example, the following installs a server 2.0.1-community edition -
default['couchbase']['server']['edition'] = "community"
default['couchbase']['server']['version'] = "2.0.1"
default['couchbase']['server']['username'] = "Administrator"
default['couchbase']['server']['password'] = "password"
The server.rb and client.rb contain the logic for installing and setting up the Couchbase-Server and Clients respectively. Additionally the test_buckets.rb has sample code to create buckets and play around with the bucket settings.
The setup_cluster.rb can be used to setup a cluster, note this requires a role “west_cluster” ( say) to be assigned to each of the nodes of the cluster. Prerequisite to running this is to make sure each of the nodes have a couchbase server installed and started.
Similarly setup_xdcr.rb recipe is used to setup xdcr between two clusters. Prerequisite to using this is you already have 2 couchbase clusters setup with roles “east_cluster” and “west_cluster”.
* Note : For this script to run, you must have nodes assigned with roles “east_cluster”, “west_cluster” for two separate clusters.
The resources and providers are defined at a node, cluster, bucket level in this directory.
Upload the Cookbook using -
knife cookbook upload couchbase
Add recipes and roles to the node run_list using -
knife node run_list add fqdn-your-node-name "recipe[couchbase::server]"
knife node run_list add fqdn-your-node-name "recipe[couchbase::setup_cluster]"
knife node run_list add fqdn-your-node-name "recipe[couchbase::test_buckets]"
knife node run_list add role fqdn-your-node-name 'role[west_cluster]'
The above will add server, setup_cluster, test_bucket recipes for execution ( in that order) on the chef-client node. Here, we've assigned a role “west_cluster” to nodes to form a west_cluster.
knife show node fqdn-your-node-name
Once you have uploaded the cookbook to the chef-server, you can use the chef-client to execute the cookbook/recipes.
From the chef-client,
sudo chef-client ( you can used -l debug for debug level log information).
As output, you will see a similar message like below -
* couchbase_bucket[modified % modification] action create[2013-07-08T22:57:49-07:00] INFO: Processing couchbase_bucket[modified % modification] action create (couchbase::test_buckets line 77)
[2013-07-08T22:57:49-07:00] INFO: couchbase_bucket[modified % modification] memory_quota_mb changed to 500
[2013-07-08T22:57:49-07:00] INFO: Chef Run complete in 187.264660646 seconds
[2013-07-08T22:57:49-07:00] INFO: Running report handlers
[2013-07-08T22:57:49-07:00] INFO: Report handlers complete
And you are ready to go!
Steps for running recipe “setup_xdcr.rb”
knife role list
knife node edit fqdn-your-node-name
likewise for the west_cluster.
knife search node "role:west_cluster" -i
2 items found
Setup xdcr by adding the “setup_xdcr” recipe to the source cluster, say “east_cluster”
knife node edit fqdn-your-node-name
This will create a xdcr remote cluster reference and start the replication from the “east_cluster” to the “west_cluster”
For large scale clusters, use of data-bags is ideal to define and maintain clusters. Likewise maintaining templates for cluster operations, resource creation will be useful in the initial setup. Enjoy!