Getting Comfortable With Couchbase Mobile
Learn how to set up your mobile Couchbase Mobile server in six easy steps!
Join the DZone community and get the full member experience.Join For Free
to get comfortable with the whole stack, it’s great to install and run everything on your development machine. in this series of posts, i’ll walk through the steps get to started with each component. i’ll show how to do a little extra exploring along the way, too.
i’ll only do minimal configuration. this is not intended to explain what you need for a production environment. i assume you’re familiar with some basics of nosql, have some understanding of couchbase, and know how to build apps in something like java, android, or ios. if you want to read up on nosql databases or couchbase, you can find lots of resources on the couchbase site.
couchbase is open-source. everything i’ll use here is free to try out. see the end of the post for more resources if you need help.
couchbase server (cbs) is an enterprise-class nosql database.
cbs runs on a wide variety of linux distributions, different versions of windows, and osx from 10.8 on. the initial install of cbs takes around 3-4 steps. the steps depend on the platform. i’ll list what’s needed for osx as an example. for other platforms, you can find the quick version of the setup instructions here . you can also view video tutorials for several linux distributions ( ubuntu , rhel , or centos ), osx , and windows .
initial installation steps
both the enterprise edition and community edition are free to use for evaluation. i’ll illustrate with the enterprise edition, version 4.5.1.
- download couchbase server (zip archive).
- unpack the archive, open the resulting folder.
- drag couchbase server to applications.
- locate couchbase server in applications, click to start.
on successful launch, you’ll see a control icon added to your menu bar. couchbase also automatically launches the web-based setup page ( http://127.0.0.1:8091/index.html ). you should see this:
click “setup” to configure your installation. that will take you to step 1 (of 5).
configuration: step one
you can learn about all the other settings later. the only one i recommend you change is shown circled in red. this sets the maximum amount of main memory this instance of cbs will use. i often set it to 2gb, but you can try it out with anything down to 256mb.
cbs comes with sets of sample data. you don’t need to load any. here i’m showing loading the beer sample. it’s helpful to explore, and i’ll refer to it in a later post, so you might want to include it.
a quick note on terminology. cbs organizes datasets into buckets. these roughly correspond to what other systems refer to as a database.
no need to change any settings here. cbs creates a bucket named “default”. we’ll use this in later examples. you should not deploy a production system with a bucket named “default”. it’s there to get you going. some of the standard sync gateway example configurations use it, too.
here you can set up to get software updates, register your product, and accept terms and conditions of use. to move to the next step only requires accepting the terms and conditions.
finally, you need to set up an administrative account. couchbase fills in a default username (you should change it for production). set a password, and you’re done.
ready to go
that’s it! with those simple steps, you now have an active, configured couchbase server installation.
you should now see the overview panel of the adminstration interface. moving from top to bottom, we can see how the information reflects what we selected during the installation.
the green bar under shows the status of the 2gb of ram we allocated for our server instance. if you look closely, you’ll see 11mb of memory in active use. that includes the beer bucket sample data in memory.
under the buckets heading, you’ll see the active count includes the default bucket plus any sample buckets loaded. the activity graph shows a spike in operations. that corresponds to loading the beer sample data.
under servers, we see we have one server live. we only set up one instance, so the other indicators all show 0 servers.
that’s all for installing couchbase server on your machine. if you want to jump in further, you can look around the admin interface or try out your installation directly using command line tools to make rest calls. you’ve seen how easy it is to get going, so you needn’t worry about breaking anything. if you really get tangled up, just delete the installation and start over.
in the rest of this series, i’ll start by showing some interesting ways to explore couchbase server. this won’t be exhaustive. i’ll focus on a few items to get you comfortable exploring on your own.
next up i’ll show how to get going with sync gateway. sync gateway (sg) is easier to install. it’s worth spending time to understand how sync works, so i’ll spend more time showing some things you can do with it.
i’ll wrap up the series with a demo app using couchbase lite that connects to the cbs and sg, all running on the same machine. we’ll loop back around to see what happens on cbs and sg when running the app.
welcome to couchbase mobile. this is a great tech stack that solves tough problems in a flexible way. it’s currently the only product i know of that addresses all the core issues faced when developing apps that need solid offline availability combined with synchronization and back-end integration. it’s exciting to work with, so i’m looking forward to showing you more ways to explore.
Published at DZone with permission of Hod Greeley. See the original article here.
Opinions expressed by DZone contributors are their own.