Getting Started

The 1,2,3 of getting rockin' with Sensei!

Getting Sensei

Download a release of Sensei at here.

Expand the tar ball: tar -zxf sensei-xxx.tar.tz to your favorite location. We will refer to root directory of your Sensei install as $SENSEI_HOME.

Running the Car example

Sensei comes with a few examples to help you getting started. Let's first take a look at the Cars example, and get that running.

Step 1: Start Zookeeper

Zookeeper manages Sensei's network topology or cluster.

Start your Zookeeper instance: (You can start your own Zookeeper cluster by following instructions here), From $SENSEI_HOME

./bin/zookeeper-server-start.sh \ 
resources/zookeeper.properties

You can shut it down by running:

./bin/zookeeper-server-stop.sh

Step 2: Start Sensei Node

With Zookeeper running, we can start a Sensei node serving Car example listening on port 8080:

In $SENSEI_HOME, start your Sensei node by pointing to the Car example configuration directory:

./bin/start-sensei-node.sh example/cars/conf

This starts a Sensei node with 2 partitions. (click here to learn more about Sensei Clusters)

Step 3: Run the Car example application

You can open the Car example application with your browser (no need to start any other servers.)

Open index.html file with your browser located at:

$SENSEI_HOME/example/cars/webapp/index.html


Using the Sensei Shell

We can also query this Sensei node with BQL via the Sensei Shell:

./bin/sensei-shell.sh

Output:

$ ./bin/sensei-shell.sh localhost 8080 
Welcome to Sensei Shell
Url specified, host: localhost, port: 8080
> desc cars;
+------------+------------+---------+-----------+-------------+---------+
| facet_name | facet_type | runtime | column    | column_type | depends |
+------------+------------+---------+-----------+-------------+---------+
| year       | range      | false   | year      | int         | []      |
| color      | simple     | false   | color     | string      | []      |
| makemodel  | path       | false   | makemodel | string      | []      |
| groupid    | simple     | false   | groupid   | long        | []      |
| city       | path       | false   | city      | string      | []      |
| tags       | multi      | false   | tags      | string      | []      |
| category   | simple     | false   | category  | string      | []      |
| mileage    | range      | false   | mileage   | int         | []      |
| price      | range      | false   | price     | float       | []      |
+------------+------------+---------+-----------+-------------+---------+
> select _uid,color,category where color in ('red','green') and query is "cool" order by category browse by color,category limit 10;
+-------+-------+----------+
| _uid  | color | category |
+-------+-------+----------+
| 11099 | green | compact  |
| 11101 | green | compact  |
| 14929 | green | compact  |
| 15    | green | compact  |
| 105   | green | compact  |
| 133   | green | compact  |
| 149   | green | compact  |
| 195   | green | compact  |
| 1071  | green | compact  |
| 1107  | red   | compact  |
+-------+-------+----------+
10 rows in set, 1626 hits, 15129 total docs (server: 14ms, total: 87ms)
+---------------------+
| category            |
+---------------------+
| compact       (506) |
| sports car    (265) |
| exotic        (253) |
| suv           (199) |
| sedan         (123) |
| mini-van      (109) |
| truck         (75)  |
| sub-compact   (59)  |
| van           (22)  |
| station wagon (15)  |
+---------------------+
+--------------+
| color        |
+--------------+
| red   (1070) |
| green (556)  |
+--------------+
> exit

Using the Web-console

Sensei comes with a web-console (written using Sensei's Javascript API) to help you interact with your Sensei cluster.

Simply point your favorite browser to: http://localhost:8080

Learn details of the Javascript API here.

Shutting down the Sensei node

In $SENSEI_HOME, do:

./bin/kill.sh


Understanding the Car Example

Cars data

We have cooked up some data in the form of json objects for 15,000 cars.

Data is stored in text file containing a json string on each-line. Each json string contains information of a car.

Full dataset can be found here. See the following example:

{
  "id":0,
  "groupid":"0",
  "tags":"hybrid,leather,moon-roof,reliable",
  "category":"compact",
  "mileage":14900,
  "price":7500,
  "contents":"yellow compact hybrid leather moon-roof reliable u.s.a. florida tampa asian acura 1.6el",
  "color":"yellow",
  "year":1994,
  "makemodel":"asian/acura/1.6el",
  "city":"u.s.a./florida/tampa"
}

This example's configuration contains schema and server settings for the Cars store.

Screenshot

See the following screenshot of the cars example:

Tweets example

If you think this is cool, move on to the Tweets Example »