Skip to content

Instantly share code, notes, and snippets.

@tleyden
Created November 14, 2014 17:01
cbfs install instructions

This will walk you through getting a cbfs cluster up and running.

What is CBFS?

cbfs is a distributed filesystem on top of Couchbase Server, not unlike Mongo's GridFS or Riak's CS products. It's an experimental "skunkworks" project, that hasn't quite reached official project status.

Here's a typical deployment architecture:

cbfs overview

but other valid architectures exist. You might want to run the Couchbase Server and cbfsd nodes on different machines for example.

If you want a deeper understanding, check the cbfs presentation or this blog post.

Kick off a Couchbase Cluster

See Running Couchbase Cluster Under CoreOS on AWS for instructions on kicking off a 3 node Couchbase cluster.

ssh in

ssh into one of the machines:

$ ssh -A core@ec2-54-147-199-230.compute-1.amazonaws.com

Run a docker image

Since we're on CoreOS, we'll need to run cbfs in a Docker container. There isn't a pre-built docker image for cbfs yet, so we'll run Ubuntu and install cbfs on it.

$ sudo docker run -ti --net=host ubuntu:14.04 /bin/bash

The reason I'm using --net=host is to avoid any issues of cbfs nodes not being able to see eachother over the network by letting it use the host's networking rather than the docker container instance being assigned it's own ip address. I don't know if this is strictly necessary.

Install cbfs

Let's build cbfs from source.

First install dependencies

# apt-get update
# apt-get install golang git

Configure Go

# mkdir /opt/go
# echo "export GOPATH=/opt/go" >> /etc/profile
# echo "export PATH=\$PATH:$GOPATH/bin" >> /etc/profile
# source /etc/profile

Create a data dir

# mkdir -p /var/lib/cbfs/data

Warning: in fact, this should be using Docker volumes rather than the container fileystem. I need to loop back and update this blog

Go get cbfs

# go get -u -v -t github.com/couchbaselabs/cbfs

At this point you should have the cbfs binary built and on your $PATH. Run cbfs -h and it will output the help options.

Start cbfs daemon

Since Couchbase Server is already running in a different docker container on the same host OS, we can just use the ip of the current host we are on.

I'm also using the local ip for the nodeID, which is probably not the right thing to do.

# ip=$(ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
# cbfs -nodeID=$ip \
       -bucket=cbfs \
       -couchbase=http://$ip:8091/
       -root=/var/lib/cbfs/data \
       -viewProxy

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment