Skip to content

Commit

Permalink
Adding sample configs for Voldemort Coordinator
Browse files Browse the repository at this point in the history
  • Loading branch information
vinothchandar committed Jun 6, 2013
1 parent f6e7b9c commit 8db2a31
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 3 deletions.
56 changes: 56 additions & 0 deletions bin/voldemort-coordinator.sh
@@ -0,0 +1,56 @@
#!/bin/bash

#
# Copyright 2008-2013 LinkedIn, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# Start up a Voldemort REST Coordinator speaking to a Voldemort Cluster.
# Example :
# 1. Bring up a Voldemort single node cluster
# $ bin/voldemort-server.sh config/single_node_cluster
# 2. Bring up a Voldemort Coordinator
# $ bin/voldemort-coordinator.sh config/coordinator_sample_config/config.properties
# 3. Do operations
# See config/coordinator_sample_config/curl_samples.txt
if [ $# -gt 1 ];
then
echo 'USAGE: bin/voldemort-coordinator.sh <coordinator-config-file>'
exit 1
fi

base_dir=$(dirname $0)/..

for file in $base_dir/dist/*.jar;
do
CLASSPATH=$CLASSPATH:$file
done

for file in $base_dir/lib/*.jar;
do
CLASSPATH=$CLASSPATH:$file
done

for file in $base_dir/contrib/*/lib/*.jar;
do
CLASSPATH=$CLASSPATH:$file
done

CLASSPATH=$CLASSPATH:$base_dir/dist/resources

if [ -z "$VOLD_OPTS" ]; then
VOLD_OPTS="-Xmx1G -server -Dcom.sun.management.jmxremote"
fi

java -Dlog4j.configuration=src/java/log4j.properties $VOLD_OPTS -cp $CLASSPATH voldemort.coordinator.CoordinatorService $@
3 changes: 3 additions & 0 deletions config/coordinator_sample_config/config.properties
@@ -0,0 +1,3 @@
bootstrap_urls=tcp://localhost:6666
fat_clients_config_file_path=config/coordinator_sample_config/fatclients_config.avro

46 changes: 46 additions & 0 deletions config/coordinator_sample_config/curl_samples.txt
@@ -0,0 +1,46 @@
Once you have a coordinator up and running against a Voldemort cluster, here is how you perform the basic operations using Curl:

********************** Voldemort PUT *****************************************
# a2V5MQ== is "key1" in base64
$ curl -X POST http://localhost:8080/test/a2V5MQ== --data "value1"

# a2V5Mg== is "key2" in base64
$ curl -X POST http://localhost:8080/test/a2V5Mg== --data "value2"

# a2V5Mw== is "key3" in base64
$ curl -X POST http://localhost:8080/test/a2V5Mw== --data "value3"

*********************** Voldemort GET ****************************************
# retrieve key1
$ curl http://localhost:8080/test/a2V5MQ==
value1

*********************** Voldemort GET_ALL ************************************
# retrive all keys
$ curl http://localhost:8080/test/a2V5MQ==,a2V5Mg==,a2V5Mw==
------=_Part_0_1624485351.1370561996547
Content-Location: /test/a2V5Mw==
ETag: {"timestamp":1370561962575,"versions":[{"version":1,"nodeId":0}]}
Content-Length: 6

value3
------=_Part_0_1624485351.1370561996547
Content-Location: /test/a2V5Mg==
ETag: {"timestamp":1370561938302,"versions":[{"version":1,"nodeId":0}]}
Content-Length: 6

value2
------=_Part_0_1624485351.1370561996547
Content-Location: /test/a2V5MQ==
ETag: {"timestamp":1370561912292,"versions":[{"version":1,"nodeId":0}]}
Content-Length: 6

value1
------=_Part_0_1624485351.1370561996547--

************************ Voldemort DELETE ************************************
# delete key1
$ curl -X DELETE http://localhost:8080/test/a2V5MQ==
$ curl http://localhost:8080/test/a2V5MQ==
Failure: 404 Not Found. Requested Key does not exist

7 changes: 7 additions & 0 deletions config/coordinator_sample_config/fatclients_config.avro
@@ -0,0 +1,7 @@
[
{
"store_name": "test",
"connection_timeout_ms": "500",
"socket_timeout_ms": "1500"
}
]
5 changes: 2 additions & 3 deletions src/java/voldemort/coordinator/CoordinatorService.java
Expand Up @@ -53,7 +53,6 @@
import voldemort.common.service.AbstractService;
import voldemort.common.service.SchedulerService;
import voldemort.common.service.ServiceType;
import voldemort.server.VoldemortServer;
import voldemort.store.StoreDefinition;
import voldemort.store.metadata.MetadataStore;
import voldemort.store.stats.StoreStats;
Expand Down Expand Up @@ -286,8 +285,8 @@ public static void main(String[] args) throws Exception {
CoordinatorConfig config = null;
try {
if(args.length != 1) {
croak("USAGE: java " + VoldemortServer.class.getName()
+ " [coordinator_config_file]");
croak("USAGE: java " + CoordinatorService.class.getName()
+ " <coordinator_config_file>");

System.exit(-1);
}
Expand Down

0 comments on commit 8db2a31

Please sign in to comment.