Getting Comfortable With Couchbase Mobile
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.