Getting Started

Download the Server

Retrieve the server.jar.

curl http://treode.github.io/jars/server.jar -o server.jar

Throughout the discussions, we’ll create database files. To keep it tidy, you may want to make a temporary directory and move the jar there.

Initialize the Database

Next, initialize the database file, which we’ll call store.3kv.

java -jar server.jar init -host 0xF47F4AA7602F3857 -cell 0x3B69376FF6CE2141 store.3kv
Jul 04, 2015 10:17:18 AM com.treode.disk.DiskEvents changedDisks
INFO: Attached disks: "store.3kv"

We’ll discuss the flags -host and -cell in managing peers. We’ll say more about init in managing disks.

Run the Server

Now start the server.

java -jar server.jar serve -solo store.3kv
I 0703 14:57:51.775 THREAD1: /admin => com.twitter.server.handler.SummaryHandler
…
I 0704 17:17:20.039 THREAD1: Serving admin http on 0.0.0.0/0.0.0.0:9990
I 0704 17:17:20.054 THREAD1: Finagle version 6.26.0 (rev=f8ea987f8da7dbe34a4fe1cb481446b5a0d34b56) built at 20150625-094005
I 0704 17:17:20.449 THREAD32: Reattaching disks: "store.3kv"
I 0704 17:17:20.633 THREAD32: Accepting peer connections to Host:F47F4AA7602F3857 for Cell:3B69376FF6CE2141 on 0.0.0.0/0.0.0.0:6278
I 0704 17:17:20.886 THREAD1: Tracer: com.twitter.finagle.zipkin.thrift.SamplingTracer

We’ll discuss the -solo flag in managing peers, and the serve command in managing disks.

Upload a Schema

Each table is identified by a 64 bit number, but we want to use symbolic names in our URLs. The schema maps names to IDs.

table <name> {
    id: <number>;
};

...more tables...

Upload the schema by performing an HTTP PUT to /admin/treode/schema.

curl -i -w'\n' -XPUT -d@- http://localhost:9990/admin/treode/schema << EOF
table fruit {
    id: 1;
};
EOF
HTTP/1.1 200 OK
Content-Length: 0

We will use the fruit table in the examples for read and write, and scan.