X

DataStax 1.2 on Windows: A guided tour

Getting the DataStax Community distribution of Cassandra up and running on your local PC is a snap. In this gallery, you'll see that for yourself.
By Andrew Brust, Contributor
datastax-thumb-v2.png
1 of 19 Andrew Brust/ZDNET

DataStax 1.2 bring Cassandra to your PC

Cassandra is a major wide column store NoSQL database.  It's popular in standalone form, and can be used with Hadoop to perform MapReduce analyses on Cassandra column families (tables).  DataStax is the company that perhaps yields the most influence over Cassandra and its open source code.  As such, its distribution of Cassandra is a great one to work with.

As you will see in this gallery, you don't need to be a Linux jock to get Cassandra installed, running and working with your applications.  if you're a Windows user or developer, you can run a simple installer, then use a variety of tools or your own code against Cassandra databases.  

fig01.png
2 of 19 Andrew Brust/ZDNET

Download the installer

The first step to getting DataStax 1.2 running on your PC is to download the Windows installer for it. The installer provides a positively Windows-like experience: there are no manual steps required, no scripts to run, or anything of that sort. Just run the installer and everything you need will be on your local machine.

To get the installer, head over to http://www.datastax.com/download/community and grab the appropriate installer.  The Windows 7 64-bit installer (which also works on Windows 8) is highlighted here.

fig02.png
3 of 19 Andrew Brust/ZDNET

For your own protection

If you're running the installer on Windows 8, a screen-width message bar will pop up, making it look as if Windows is preventing the installation.  The solution is easy, though counterintuitive: clik the More Info link, highlighted here.

fig03.png
4 of 19 Andrew Brust/ZDNET

Run anyway

The More Info screen is actually where the needed manual override option is placed.  Click the "Run anyway" button.

fig04.png
5 of 19 Andrew Brust/ZDNET

Let 'er rip!

Now the Welcome screen of the installation wizard should appear.  Click the "Next" button to proceed. 

fig05.png
6 of 19 Andrew Brust/ZDNET

Automatic or manual?

Are you going to be using Cassandra frequently?  If so, have the services run automatically.  But if not, then uncheck the two options shown here.  This way, everything will be installed, but it won't run unless you explicitly start it up.  Once you've made your decision, click the "Next" button.

fig06.png
7 of 19 Andrew Brust/ZDNET

See installer run

The installer should now run without further necessary interaction.

fig07.png
8 of 19 Andrew Brust/ZDNET

Start the services

If you elected to have the services run manually, then you will need to launch Windows' Services applet and scroll down through the alphabetical list to the three DataStax services.  One-by-one, click each service and start it.  You can start the service through its context menu or by clicking on the "play" VCR-style button on the toolbar.  Once all three services are running (they should display "Running" in the "Status" column), you're ready to start working.

fig08.png
9 of 19 Andrew Brust/ZDNET

OpsCenter Dashboard

One value-add you get with DataStax Community (versus the vanilla Apache Cassandra bits) is the OpsCenter utility.  Bring it up on your machine by firing up your browser (as long as it's not Internet Explorer, which is unsupported) and navigating to http://localhost:8888.

Look around the dashboard and then, when you're ready to create a database, click the "DATA MODELING" link on the left nav bar (highlighted).

fig09.png
10 of 19 Andrew Brust/ZDNET

Keyspace inventory

Keyspaces are the units of replication in Cassandra, but you can also think of them as the rough equivalent of databases.  The Data Modeling screen lists all existing keyspaces and provides an "Add Keyspace" button (highlighted) to add a new one.  Click it now.

fig10.png
11 of 19 Andrew Brust/ZDNET

Add keyspace

The Add a Keyspace dialog should now pop up.  Enter a name for for your new keyspace, then click the "I would like to create a column family" checkbox (a column family is Cassandra's rough equivalent of a table) and click the "Save Keyspace" button.

fig11.png
12 of 19 Andrew Brust/ZDNET

All in the (column) family

Now enter a name for your column family and set "column_type" to "Super" (a super column allows variable subcolumns in each row).  Pick data types for the "compare_with" and "default_validation class" options (I used "AsciiType" in this instance), then click the "Save Column Family" button.

fig12.png
13 of 19 Andrew Brust/ZDNET

Keyspace added

Now the dialogs disappear and your keyspace should appear in the list.  At this point we're ready to enter data, but we're going to do that from another tool: the CLI (command line interface) client.

fig13.png
14 of 19 Andrew Brust/ZDNET

The almighty bin folder

Open up a File Explorer window and head over to the bin folder.  The default location for this folder on a 64-bit Windows machine is C:\Program Files (x86)\DataStax Community\apache-cassandra\bin.  A bunch of important files are here, including the cassandra-cli.bat file, which runs the CLI client, and the cqlsh Python script, which runs the Cassandra Query Language (CQL) Shell.

Double-click the cassandra-cli.bat file to load the CLI client now.

fig14.png
15 of 19 Andrew Brust/ZDNET

The CLI client

The CLI client lets you run such commands as USE (to address a specific keyspace) and CREATE COLUMN FAMILY (which is self-explanatory), both of which are shown here.  Make sure to end all commands with a semi-colon.  When you're done, type "exit;" at the prompt (without the quotes) and tap the Enter key.

fig15.png
16 of 19 Andrew Brust/ZDNET

CQL, here we come

CQL, the Cassandra Query Language, looks very much like SQL.  Run the CQL shell by running the "cqlsh" python script back in the bin folder (double click the "cqlsh" file, then specify the application to run it with as the full path to python.exe on your machine).

Once you're in the CQL shell, you can use the USE command as you did in the CLI client.  Then, SQL-like sytax becomes the norm.  Use the CREATE TABLE command to create a column family, and use INSERT and SELECT to create data and query it, respectively.  The commands shown here create a column family called "emp", insert a row of data into it and read the data back.

fig16.png
17 of 19 Andrew Brust/ZDNET

Works from code, too

Connectors and libraries for Cassandra are available for almost any development environment, including Enterprise Windows environments like .NET and C#.  Nick Berardi's Fluent Cassandra client is available as an open source NuGet package for .NET developers.

As shown here in Visual Studio 2012, you can grab Fluent Cassandra by entering the "Install-Package FluentCassandra" command in the Package Manager window. 

fig17.png
18 of 19 Andrew Brust/ZDNET

Reference added

The Install-Package command doesn't just install the bits!  The FluentCassandra assembly reference gets added to your .NET project as well, as shown here.

fig18.png
19 of 19 Andrew Brust/ZDNET

Code is as code does

The code shown here is a slightly modified version of some sample code provided by Nick Berardi.  The code opens up an existing column family, adds a row to it, creates two super columns, adds columns and values into the super columns, adds the super columns as property values into the new row, attaches the row and saves all changes.

------------------------

As you can see, getting the DataStax Community version of Cassandra installed and running is pretty easy.  And once DataStax is on your machine, you have a range of browser, command line and developer clients available to create and query Cassandra NoSQL databases. 

Related Galleries

Holiday wallpaper for your phone: Christmas, Hanukkah, New Year's, and winter scenes
Holiday lights in Central Park background

Related Galleries

Holiday wallpaper for your phone: Christmas, Hanukkah, New Year's, and winter scenes

21 Photos
Winter backgrounds for your next virtual meeting
Wooden lodge in pine forest with heavy snow reflection on Lake O'hara at Yoho national park

Related Galleries

Winter backgrounds for your next virtual meeting

21 Photos
Holiday backgrounds for Zoom: Christmas cheer, New Year's Eve, Hanukkah and winter scenes
3D Rendering Christmas interior

Related Galleries

Holiday backgrounds for Zoom: Christmas cheer, New Year's Eve, Hanukkah and winter scenes

21 Photos
Hyundai Ioniq 5 and Kia EV6: Electric vehicle extravaganza
img-8825

Related Galleries

Hyundai Ioniq 5 and Kia EV6: Electric vehicle extravaganza

26 Photos
A weekend with Google's Chrome OS Flex
img-9792-2

Related Galleries

A weekend with Google's Chrome OS Flex

22 Photos
Cybersecurity flaws, customer experiences, smartphone losses, and more: ZDNet's research roundup
shutterstock-1024665187.jpg

Related Galleries

Cybersecurity flaws, customer experiences, smartphone losses, and more: ZDNet's research roundup

8 Photos
Inside a fake $20 '16TB external M.2 SSD'
Full of promises!

Related Galleries

Inside a fake $20 '16TB external M.2 SSD'

8 Photos