Quickstart

Step 1: Download the code

Download the stable release of latest voldemort

Step 2: Start single node cluster

	> bin/voldemort-server.sh config/single_node_cluster > /tmp/voldemort.log &
Note: If your machine has a very small memory(<4G, likely to happen in Virtual Machine environments), you may come across out-of-memory issues. You can reduce the JVM heap memory allocation by changing the "-Xmx2G" option in bin/voldemort-server.sh to a smaller value or leave it out.

Step 3: Start commandline test client and do some operations

	> bin/voldemort-shell.sh test tcp://localhost:6666
	Established connection to test via tcp://localhost:6666
	> put "hello" "world"
	> get "hello"
	version(0:1): "world"
	> delete "hello"
	> get "hello"
	null
	> help 
	...
	> exit
	k k thx bye.

More details

Client

Here is an example showing how to connect to a store as a client to do reads and writes from Java:

 String bootstrapUrl = "tcp://localhost:6666";
 StoreClientFactory factory = new SocketStoreClientFactory(new ClientConfig().setBootstrapUrls(bootstrapUrl));
 
 // create a client that executes operations on a single store
 StoreClient client = factory.getStoreClient("my_store_name");

getStoreClient() method pulls down the metadata (cluster.xml/stores.xml) from the server in the bootstrap url. After initializing the store client for every store once we can reuse it to run our queries as follows:

 
 // do some random pointless operations
 Versioned value = client.get("some_key");
 value.setObject("some_value");
 client.put("some_key", value);

Note that StoreClient is just an interface, so for the purpose of unit testing we can completely mock the storage layer. This is something that is essentially impossible to do with a normal relational db since sql is the interface and it is vendor specific.

Server

There are three methods for using the server:

1. Start from the command line

You must first build the jar file using ant, as described above, then do the following:
$ VOLDEMORT_HOME='/path/to/voldemort'
$ cd $VOLDEMORT_HOME
$ ./bin/voldemort-server.sh
[2011-07-14 18:06:24,921 voldemort.store.metadata.MetadataStore] INFO metadata init(). 
[2011-07-14 18:06:25,309 voldemort.server.VoldemortServer] INFO Using NIO Connector. 
[2011-07-14 18:06:25,331 voldemort.server.VoldemortServer] INFO Using NIO Connector for Admin Service. 
[2011-07-14 18:06:25,332 voldemort.server.VoldemortService] INFO Starting voldemort-server 
[2011-07-14 18:06:25,333 voldemort.server.VoldemortServer] INFO Starting 8 services. 
[2011-07-14 18:06:25,333 voldemort.server.VoldemortService] INFO Starting storage-service 
[2011-07-14 18:06:25,399 voldemort.server.storage.StorageService] INFO Initializing bdb storage engine. 
[2011-07-14 18:06:25,404 voldemort.server.storage.StorageService] INFO Initializing read-only storage engine. 
[2011-07-14 18:06:25,406 voldemort.server.storage.StorageService] INFO Initializing the slop store using bdb 
[2011-07-14 18:06:25,767 voldemort.server.storage.StorageService] INFO Initializing stores: 
[2011-07-14 18:06:25,767 voldemort.server.storage.StorageService] INFO Opening store 'test' (bdb). 
[2011-07-14 18:06:25,834 voldemort.server.storage.StorageService] INFO All stores initialized. 
[2011-07-14 18:06:25,834 voldemort.server.VoldemortService] INFO Starting scheduler-service 
[2011-07-14 18:06:25,834 voldemort.server.VoldemortService] INFO Starting async-scheduler 
[2011-07-14 18:06:25,834 voldemort.server.VoldemortService] INFO Starting http-service 
[2011-07-14 18:06:26,092 voldemort.server.VoldemortService] INFO Starting socket-service 
[2011-07-14 18:06:26,101 voldemort.server.VoldemortService] INFO Starting rebalance-service 
[2011-07-14 18:06:26,109 voldemort.server.VoldemortService] INFO Starting jmx-service 
[2011-07-14 18:06:26,142 voldemort.server.VoldemortServer] INFO Startup completed in 809 ms. 

Alternately we can give VOLDEMORT_HOME on the command line and avoid having to set an environment variable

$ ./bin/voldemort-server.sh /path/to/voldemort
[2011-07-14 18:06:24,921 voldemort.store.metadata.MetadataStore] INFO metadata init(). 
[2011-07-14 18:06:25,309 voldemort.server.VoldemortServer] INFO Using NIO Connector. 
[2011-07-14 18:06:25,331 voldemort.server.VoldemortServer] INFO Using NIO Connector for Admin Service. 
[2011-07-14 18:06:25,332 voldemort.server.VoldemortService] INFO Starting voldemort-server 
...

2. Embedded Server

You can instantiate the server directly in your code.

VoldemortConfig config = VoldemortConfig.loadFromEnvironmentVariable();
VoldemortServer server = new VoldemortServer(config);
server.start();

3. Deploy as a war

To do this build the war file using the

./gradlew war
target and deploy via whatever mechanism your servlet container supports.

Fork me on GitHub