No description
Find a file
Ben Johnson 2322201bf4 Add slice to BitmapSegment operations.
Previously the `slice` was not copied to each new segment when
`Intersect()`, `Union()`, and `Difference()` operations were performed.
This causes issues when those bitmaps were then operated on later such
as performing a `TopN()` on a source bitmap.
2016-10-13 10:54:40 -06:00
cmd Add profile & bitmap attribute anti-entropy. 2016-09-30 11:47:43 -06:00
datadog Add StatsClient with DataDog implementation. 2016-10-06 15:11:33 -06:00
Godeps refactor in-memory bitmap storage 2016-05-24 15:01:49 -06:00
internal refactor in-memory bitmap storage 2016-05-24 15:01:49 -06:00
pql add bulk call support to the query endpoint 2016-03-08 14:34:37 -07:00
roaring cleaned up constant 2016-09-23 16:04:22 -05:00
.gitignore optimize sparse bitmap block checksums 2016-07-07 10:03:38 -06:00
attr.go Add profile & bitmap attribute anti-entropy. 2016-09-30 11:47:43 -06:00
attr_test.go Add profile & bitmap attribute anti-entropy. 2016-09-30 11:47:43 -06:00
bitmap.go Add slice to BitmapSegment operations. 2016-10-13 10:54:40 -06:00
cache.go Add slice to BitmapSegment operations. 2016-10-13 10:54:40 -06:00
client.go Add profile & bitmap attribute anti-entropy. 2016-09-30 11:47:43 -06:00
client_test.go fix import cache updates 2016-05-11 17:32:28 -06:00
cluster.go forward bitmap & profile attributes 2016-07-19 13:54:01 -06:00
cluster_test.go use db in fragment allocation 2016-06-07 14:01:13 -06:00
db.go active anti-entropy 2016-04-12 19:48:32 -06:00
db_test.go refactor attribute stores 2016-02-16 13:41:37 -07:00
executor.go Optimize TopN() w/ source query. 2016-09-13 14:55:56 -06:00
executor_test.go refactor in-memory bitmap storage 2016-05-24 15:01:49 -06:00
fragment.go Add profile & bitmap attribute anti-entropy. 2016-09-30 11:47:43 -06:00
fragment_test.go Add export command to pilosactl 2016-08-30 16:18:12 -06:00
frame.go serialize cache flush 2016-08-05 14:58:37 -06:00
frame_test.go refactor attribute stores 2016-02-16 13:41:37 -07:00
handler.go Add endpoint for database deletion. 2016-10-04 09:40:59 -06:00
handler_test.go Add endpoint for database deletion. 2016-10-04 09:40:59 -06:00
index.go Add endpoint for database deletion. 2016-10-04 09:40:59 -06:00
index_test.go Add endpoint for database deletion. 2016-10-04 09:40:59 -06:00
iterator.go consensus block merge 2016-05-06 16:19:10 -06:00
iterator_test.go consensus block merge 2016-05-06 16:19:10 -06:00
Makefile add protobuf/testdata, fix Makefile 2016-04-26 08:48:04 -06:00
NOTES refactor 2015-12-02 15:34:49 -07:00
pilosa.go add 'pilosactl bench' command 2016-03-31 15:49:57 -06:00
README.md added docs for TopN attributes 2016-09-27 14:07:29 -05:00
server.go Add profile & bitmap attribute anti-entropy. 2016-09-30 11:47:43 -06:00
stats.go Add StatsClient with DataDog implementation. 2016-10-06 15:11:33 -06:00
time.go add Range() support 2016-02-23 14:53:03 -07:00
time_test.go add Range() support 2016-02-23 14:53:03 -07:00

pilosa

Pilosa is a bitmap index database.

Getting Started

Pilosa requires Go 1.6 or greater.

You can download the source by running go get:

$ go get github.com/umbel/pilosa

Now you can install the pilosa binary:

$ go install github.com/umbel/pilosa/...

Now run pilosa with the default configuration:

pilosa

Configuration

You can specify a configuration by setting the -config flag when running pilosa.

pilosa -config custom-config-file.cfg

The config file uses the TOML configuration file format, and should look like:

data-dir = "/tmp/pil0"
host = "127.0.0.1:15000"

[cluster]
replicas = 2

[[cluster.node]]
host = "127.0.0.1:15000"

[[cluster.node]]
host = "127.0.0.1:15001"

The first two configuration options will be unique to each node in the cluster:

data-dir: directory in which data is stored to disk

host: IP and port of the pilosa node

The remaining configuration options should be the same on every node in the cluster.

replicas: the number of replicas within the cluster

[[cluster.node]]: specifies each node within the cluster

Usage

You can interact with Pilosa via HTTP requests to the host:port on which you have Pilosa running. The following examples illustrate how to do this using curl with a Pilosa cluster running on 127.0.0.1 port 15000.

Return the version of Pilosa:

$ curl "http://127.0.0.1:15000/version"

Return a list of all databases and frames in the index:

$ curl "http://127.0.0.1:15000/schema"

Queries

Queries to Pilosa require sending a POST request where the query itself is sent as POST data. You specify the database on which to perform the query with a URL argument db=database-name.

A query sent to database exampleDB will have the following format:

$ curl -X POST "http://127.0.0.1:15000/query?db=exampleDB" -d 'Query()'

The Query() object referenced above should be made up of one or more of the query types listed below. So for example, a SetBit() query would look like this:

$ curl -X POST "http://127.0.0.1:15000/query?db=exampleDB" -d 'SetBit(id=10, frame="foo", profileID=1)'

Query results have the format {"results":[]}, where results is a list of results for each Query(). This means that you can provide multiple Query() objects with each HTTP request and results will contain the results of all of the queries.

$ curl -X POST "http://127.0.0.1:15000/query?db=exampleDB" -d 'Query() Query() Query()'

SetBit()

SetBit(id=10, frame="foo", profileID=1)

A return value of {"results":[true]} indicates that the bit was toggled from 0 to 1. A return value of {"results":[false]} indicates that the bit was already set to 1 and therefore nothing changed.


ClearBit()

ClearBit(id=10, frame="foo", profileID=1)

A return value of {"results":[true]} indicates that the bit was toggled from 1 to 0. A return value of {"results":[false]} indicates that the bit was already set to 0 and therefore nothing changed.


SetBitmapAttrs()

SetBitmapAttrs(id=10, frame="foo", category=123, color="blue", happy=true)

Returns {"results":[null]}


Bitmap()

Bitmap(id=10, frame="foo")

Returns {"results":[{"attrs":{"category":123,"color":"blue","happy":true},"bits":[1,2]}]} where attrs are the attributes set using SetBitmapAttrs() and bits are the bits set using SetBit().


Union()

Union(Bitmap(id=10, frame="foo"), Bitmap(id=20, frame="foo")))

Returns a result set similar to that of a Bitmap() query, only the attrs dictionary will be empty: {"results":[{"attrs":{},"bits":[1,2]}]}. Note that a Union() query can be nested within other queries anywhere that you would otherwise provide a Bitmap().


Intersect()

Intersect(Bitmap(id=10, frame="foo"), Bitmap(id=20, frame="foo")))

Returns a result set similar to that of a Bitmap() query, only the attrs dictionary will be empty: {"results":[{"attrs":{},"bits":[1]}]}. Note that an Intersect() query can be nested within other queries anywhere that you would otherwise provide a Bitmap().


Difference()

Difference(Bitmap(id=10, frame="foo"), Bitmap(id=20, frame="foo")))

Difference() represents all of the bits that are set in the first Bitmap() but are not set in the second Bitmap(). It returns a result set similar to that of a Bitmap() query, only the attrs dictionary will be empty: {"results":[{"attrs":{},"bits":[2]}]}. Note that a Difference() query can be nested within other queries anywhere that you would otherwise provide a Bitmap().


Count()

Count(Bitmap(id=10, frame="foo"))

Returns the count of the number of bits set in Bitmap(): {"results":[28]}


Range()

Range(id=10, frame="foo", start="1970-01-01T00:00", end="2000-01-02T03:04")

TopN()

TopN(frame="bar", n=20)

Returns the top 20 Bitmaps from frame bar.

TopN(Bitmap(id=10, frame="foo"), frame="bar", n=20)

Returns the top 20 Bitmaps from bar sorted by the count of bits in the intersection with Bitmap(id=10).

TopN(Bitmap(id=10, frame="foo"), frame="bar", n=20, field="category", [81,82])

Returns the top 20 Bitmaps from barin attribute category with values 81 or 82 sorted by the count of bits in the intersection with Bitmap(id=10).

Development

Updating dependencies

To update dependencies, you'll need to install godep:

$ go get -u github.com/tools/godep

Then save the dependencies in your project:

$ godep save ./...

Protobuf

If you update protobuf (pilosa/internal/internal.proto), then you need to run go generate

$ go generate

Version

In order to set the version number, compile Pilosa with the following argument:

$ go install --ldflags="-X main.Version=1.0.0"