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.
Here’s a typical deployment architecture:
Although not shown, all cbfs daemons can communicate with all Couchbase Server instances.
It is not required to run cbfs on the same machine as Couchbase Server, but it is meant to be run in the same data center as Couchbase Server.
If you want a deeper understanding of how cbfs works, check the cbfs presentation or this blog post.
Kick off a Couchbase Cluster
cbfs depends on having a Couchbase cluster running.
Follow all of the steps in Running Couchbase Cluster Under CoreOS on AWS to kick off a 3 node Couchbase cluster.
Add security groups
A few ports will need to be opened up for cbfs.
Go to the AWS console and edit the Couchbase-CoreOS-CoreOSSecurityGroup-xxxx security group and add the following rules:
1 2 3 4 |
|
At this point your security group should look like this:
Create a new bucket for cbfs
Open Couchbase Server Admin UI
In the AWS EC2 console, find the public IP of one of the instances (it doesn’t matter which)
In your browser, go to http://<public_ip>:8091/
Create Bucket
Go to Data Buckets / Create New Bucket
Enter cbfs for the name of the bucket.
Leave all other settings as default.
ssh in
In the AWS EC2 console, find the public IP of one of the instances (it doesn’t matter which)
ssh into one of the machines:
1
|
|
Run cbfs
Create a volume dir
Since the fileystem of a docker container is not meant for high throughput io, a volume should be used for cbfs.
Create a directory on the host OS (i.e., on the Core OS instance)
1 2 |
|
This will be mounted by the docker container in the next step.
Generate fleet unit files
1 2 |
|
Start cbfs on all cluster nodes
1
|
|
Run fleetctl list-units
to list the units running in your cluster. You should have the following:
1 2 3 4 5 6 7 8 9 |
|
View cbfs output
1 2 3 4 5 6 7 |
|
Run cbfs client
Run a bash shell in a docker container that has cbfsclient
pre-installed:
1
|
|
Upload a file
From within the docker container launched in the previous step:
1 2 3 |
|
There should be no errors. If you run fleetctl journal cbfs_node.1.service
again on the CoreOS instance, you should see log messages like:
1
|
|
List directory
1 2 |
|
It should list the foo file we uploaded earlier.
Congratulations! You now have cbfs up and running.