Quickstart
Step 1: Download the code
Download either a recent stable release or, for those who like to live more dangerously, the up-to-the-minute build from the build server.Step 2: Start single node cluster
> bin/voldemort-server.sh config/single_node_cluster > /tmp/voldemort.log &
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 > 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 StoreClientclient = factory.getStoreClient("my_store_name"); // 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 [2008-08-11 17:00:32,884] INFO Starting voldemort-server (voldemort.server.VoldemortService) [2008-08-11 17:00:32,886] INFO Starting all services: (voldemort.server.VoldemortServer) [2008-08-11 17:00:32,886] INFO Starting storage-service (voldemort.server.VoldemortService) [2008-08-11 17:00:32,891] INFO Initializing stores: (voldemort.server.storage.StorageService) [2008-08-11 17:00:32,891] INFO Opening test. (voldemort.server.storage.StorageService) [2008-08-11 17:00:32,903] INFO All stores initialized. (voldemort.server.storage.StorageService) [2008-08-11 17:00:32,903] INFO Starting scheduler (voldemort.server.VoldemortService) [2008-08-11 17:00:32,906] INFO Scheduling pusher to run every 60000 milliseconds. (voldemort.server.scheduler.SchedulerService) [2008-08-11 17:00:32,909] INFO Starting http-service (voldemort.server.VoldemortService) [2008-08-11 17:00:33,044] INFO Starting socket-service (voldemort.server.VoldemortService) [2008-08-11 17:00:33,044] INFO Starting voldemort socket server on port 6666. (voldemort.server.socket.SocketServer) [2008-08-11 17:00:33,045] INFO Starting JMX Service (voldemort.server.VoldemortService) [2008-08-11 17:00:33,133] INFO All services started. (voldemort.server.VoldemortServer)
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 [2008-08-11 17:00:32,884] INFO Starting voldemort-server (voldemort.server.VoldemortService) ...
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
ant wartarget and deploy via whatever mechanism your servlet container supports.