ALL COVERED TOPICS

NoSQL Benchmarks NoSQL use cases NoSQL Videos NoSQL Hybrid Solutions NoSQL Presentations Big Data Hadoop MapReduce Pig Hive BigTable Cassandra HBase Hypertable Couchbase CouchDB MongoDB OrientDB RavenDB Jackrabbit Terrastore Redis Riak Project Voldemort Tokyo Cabinet Kyoto Cabinet memcached Membase Amazon SimpleDB MemcacheDB M/DB GT.M Amazon Dynamo Dynomite Mnesia Yahoo! PNUTS/Sherpa Neo4j InfoGrid Sones GraphDB InfiniteGraph AllegroGraph MarkLogic Clustrix CouchDB Case Studies MongoDB Case Studies NoSQL at Adobe NoSQL at Facebook NoSQL at Twitter

NAVIGATE MAIN CATEGORIES

Close

clojure: All content tagged as clojure in NoSQL databases and polyglot persistence

Setting Up, Modeling and Loading Data in HBase With Hadoop and Clojure: NoSQL Tutorials

Even if you are not familiar with Clojure, you’ll still enjoy this fantastic HBase tutorial:

And that’s the thing: if you are loading literally gajigabytes of data into HBase you need to be pretty sure that it’s going to be able to answer your questions in a reasonable amount of time. Simply cramming it in there probably won’t work (indeed, that approach probably won’t work great for anything). I loaded and re-loaded a test set of twenty thousand rows until I had something that worked.

Original title and link: Setting Up, Modeling and Loading Data in HBase With Hadoop and Clojure: NoSQL Tutorials (NoSQL database©myNoSQL)

via: http://twitch.nervestaple.com/2012/01/12/clojure-hbase/


Creating a Query DSL Using Clojure and MongoDB

Christopher Maier:

Not only does creating a DSL make querying easy (particularly with complex conditions), but it also insulates your application from change in a few important ways. Especially in the initial, exploratory stages of a project, it is common to change and evolve a data schema, and NoSQL environments make this very simple. Using a DSL will shield your code from these changes; you only need to change the DSL “atoms” that the schema change affects.

In case you missed it, Foursquare open sourced they type-safe Scala DSL for MongoDB.

Original title and link: Creating a Query DSL Using Clojure and MongoDB (NoSQL database©myNoSQL)

via: http://christophermaier.name/2011/07/17/creating-a-query-dsl-using-clojure-and-mongodb.html


Simhashing in Hadoop with MapReduce, Cascalog and Cascading

Simhashing in MapReduce is a quick way to find clusters in a huge amount of data. By using Cascading and Cascalog we’re able to work with MapReduce jobs at the level of functions rather than individual map-reduce phases.

Chris K.Wensel

Original title and link: Simhashing in Hadoop with MapReduce, Cascalog and Cascading (NoSQL databases © myNoSQL)

via: http://www.xcombinator.com/2011/05/09/cascading-simhash-a-library-to-cluster-by-minhashes-in-hadoop/


Using CouchDB with Clojure

All CouchDB basic features explained using Clojure:

This article shows how to access the CouchDB APIs using Clojure, a dynamic language for the JVM. Examples use the Clutch API and clj-http library in parallel to illustrate a higher-level CouchDB API and lower-level REST-based calls, respectively.

Original title and link: Using CouchDB with Clojure (NoSQL databases © myNoSQL)

via: http://www.ibm.com/developerworks/library/j-couchdb-clojure/


Riak Map/Reduce Queries in Clojure

Over this week I’ve been working on a proof of concept to see if it’s possible to use Clojure as the map/reduce language for Riak, in the same way now we can use Javascript and Erlang for that purpose. To accomplish that I needed a way to call Clojure code from Erlang. So I set up a very simple server in Clojure that runs as an Erlang node using Closerl.

Theoretically nice… practically I’d say there is a fundamental problem with this idea (different than the ones listed in the article). Map and reduce functions are supposed to run on the nodes hosting the data[1]. If you need to wire this data is like implementing mapreduce on your application so the data locality property is lost. Not to mention that adding another variable to the equation (the JVM) your distributed system will become more sensible to failures.


  1. As mentioned in this question about Riak MapReduce, currently Riak runs only the map functions on all nodes, while reduce function is run on the node receiving the request.  ()

Original title and link for this post: Riak Map/Reduce Queries in Clojure (published on the NoSQL blog: myNoSQL)

via: http://videlalvaro.github.com/2010/08/riak-map-reduce-queries-in-clojure.html


Quick Guide for Riak with Clojure

From installation to using the Clojure library for Riak ☞ clj-riak including MapReduce with Riak:

This brief introduction leaves many aspects of Riak unaddressed. For example, we have not looked at throughput, scalability, fault tolerance, conflict resolution, or production operations – all critical to a complete understanding of the datastore.

Quick Guide for Riak with Clojure originally posted on the NoSQL blog: myNoSQL

via: http://mmcgrana.github.com/2010/08/riak-clojure.html


CouchDB: 5.5k inserts/sec with fire-and-forget and bulk ops

After saying that MongoDB’s default fire-and-forget behavior is wrong, CouchDB community welcomed this sample Clojure code showing 5500 inserts/second implemented with a fire-and-forget behavior and bulk inserts:

So I contemplated the problem some and wondered whether Clojure’s STM (Software Transactional Memory) could be leveraged. As requests come in, instead of connecting immediately to the database, why not queue them up until we have an optimal number and then do a bulk insert?


Compojure and MongoDB: Sample App

My fascination for Clojure and a bit of NoSQL flavor made me mention this basic sample app:

We’ll create a small Compojure[1] application that will serve as a backend for the Todos application. The application data will be stored in MongoDB.

Code also available on ☞ GitHub.


  1. ☞ Compojure: a concise web framework for Clojure  ()

via: http://wiki.sproutcore.com/Todos+06-Building+with+Compojure+and+MongoDB


NoSQL Ecosystem News & Links 2010-06-14


Presentations on Hadoop, HBase, PIG and Cascalog from Hadoop Meet-Up

The Yahoo! Developer Network Blog has ☞ posted the materials presented at Hadoop’s monthly user group meeting. I’ve embedded these below for your convenience:

What’s New With Pig: Alan Gates

Pig is one of the solutions used for data processing/analysis in the NoSQL world. For example Pig is heavily used at Twitter.

Recently Pig has released ☞ two new versions (0.6.0 and 0.7.0) and this talk focuses on the new features included with these versions and a compatibility plan with Hadoop[1]

Cascalog: Powerful and easy-to-use data analysis tool for Hadoop: Nathan Marz

Cascalog is a Clojure-based query language solution for Hadoop-stored data analysis. Nathan Marz (BackType) is demoing this cool tool:

HBase and Pig: The Hadoop ecosystem at Twitter: Dmitriy Ryaboy

As already mentioned Twitter is extensively using HBase, Pig and Hadoop — in their words Cassandra is OLTP and HBase is OLAP — and Dmitriy provides an overview of their Hadoop-based ecosystem:

References


Schemaless data modeling with Bigtable and Groovy's Gaelyk or Clojure

A short intro to NoSQL data modeling, an important topic for the NoSQL space, by ☞ Andrew Glover:

When developers talk about non-relational or NoSQL databases, the first thing often said is that they require a change in mindset. In my opinion, that actually depends upon your initial approach to data modeling. If you are accustomed to designing applications by modeling the database structure first (that is, you figure out tables and their associated relationships first), then data modeling with a schemaless datastore like Bigtable will require rethinking how you do things. If, however, you design your applications starting with the domain model, then Bigtable’s schemaless structure will feel more natural.

Somehow related you may also find interesting the Clojure DSL for Google App Engine by ☞ Stefan Richter:

Modeling your data structures for a distributed key-value store for large-scale internet applications differs in several key aspects from ER-modeling: Forget normalization, optimizing for read-access, etc. As a result, we believe that using object-oriented persistence mapping can cause a developer to incorrectly abstract object relationships: You should not have complex object relationships in your datastore. In addition, since Clojure is a functional programming language, it makes less sense to use a persistence mechanism rooted in object oriented practices. In Clojure you are using structs (maps) and not “objects” to hold your data, which means that you already have simple key-value structured data at hand. There’s no need to use object persistence mapping anyway. The most natural way is to use the low-level API to the datastore directly.

via: http://nosql.mypopescu.com/post/507962068/the-role-of-data-modeling-with-key-value-stores


Cascalog: Clojure-based Query Language for Hadoop

I’ve already made the point that storing the data is just the start of the “adventure” and sooner than later you’ll have to put your NoSQL stored data to work.

Cascalog, introduced in the linked article, is a query language for Hadoop featuring:

  • Simple – Functions, filters, and aggregators all use the same syntax. Joins are implicit and natural.
  • Expressive – Logical composition is very powerful, and you can run arbitrary Clojure code in your query with little effort.
  • Interactive – Run queries from the Clojure REPL.
  • Scalable – Cascalog queries run as a series of MapReduce jobs.
  • Query anything – Query HDFS data, database data, and/or local data by making use of Cascading’s “Tap” abstraction
  • Careful handling of null values – Null values can make life difficult. Cascalog has a feature called “non-nullable variables” that makes dealing with nulls painless.
  • First class interoperability with Cascading – Operations defined for Cascalog can be used in a Cascading flow and vice-versa
  • First class interoperability with Clojure - Can use regular Clojure functions as operations or filters, and since Cascalog is a Clojure DSL, you can use it in other Clojure code.

While I do really like Clojure[1] and its conciseness, I kind of agree with the point Kevin Weil from Twitter made during the nosql:eu conference:

I need less Java in my life, not more

in the sense that higher level tools are more productive. And that’s the reason Twitter is using PIG (nb: I’d strongly recommend checking Kevin Weil’s slides) and Cloudera Hadoop distribution will include PIG and Hive.

References

  • [1] Disclaimer: I’m a Clojure absolute beginner though. ()

via: http://nathanmarz.com/blog/introducing-cascalog/