Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Newbie question about embedded usage
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Vanessa Williams  
View profile  
 More options Oct 12 2012, 4:15 pm
From: Vanessa Williams <fridgeb...@gmail.com>
Date: Fri, 12 Oct 2012 13:15:01 -0700 (PDT)
Local: Fri, Oct 12 2012 4:15 pm
Subject: Newbie question about embedded usage

Hi, I'm just trying Voldemort for the first time as part of an evaluation.
It's a possible solution to a clustering problem we have.

Anyway, ideally (for now at least) we'd use it in embedded mode. I've got a
simple example working using the "single_node_cluster" config, using BDB.
However, the data I write to Voldemort does not survive re-running the
program. Is this because starting the server overwrites the previous store?
Is there a way to make data survive a server restart? It seems as if there
must be, but I can't find any specific information.

Since my code is so small, I've put the entire contents of the main class
below (minus the package and imports). Note that the output is always "Putting
new value" followed by "All is good".

Regards,
Vanessa

*public* *class* Voldemort {

 /**

 * *@param* args

 */

*public* *static* *void* main(String[] args) {

 *instance* = *new* Voldemort("tcp://localhost:6666");

*instance*.doSomeStuff();

}

 *public* Voldemort(String bootstrapUrl) {

 VoldemortConfig config = VoldemortConfig.*loadFromEnvironmentVariable*();

VoldemortServer server = *new* VoldemortServer(config);

server.start();

 StoreClientFactory factory = *new* SocketStoreClientFactory(*new*ClientConfig().setBootstrapUrls(bootstrapUrl) );

// create a client that executes operations on a single store

client = factory.getStoreClient(*STORE_NAME*);

 }

 *private* *void* doSomeStuff() {

// do some random pointless operations

Versioned<String> value = client.get(*KEY_BASE*);

*if* (value == *null*) {

value = *new* Versioned<String>(*TURTLE_1*);

System.*out*.println("Putting new value");

}

*else* {

value.setObject(*TURTLE_1*);

System.*out*.println("Replaceing existing value");

}

client.put(*KEY_BASE*, value);

 value = client.get(*KEY_BASE*);

*assert* value.equals(*TURTLE_1*);

 System.*out*.println("All is good");

}

 *private* *static* Voldemort *instance*;

 *private* StoreClient<String, String> client;

 *private* *static* *final* String *STORE_NAME* = "directory_store";

*private* *static* *final* String *KEY_BASE* = "foo";

*private* *static* *final* String *TURTLE_1* = "bar";

 *private* *static* *final* Logger *LOG* = Logger.*getLogger*(Voldemort.*
class*);


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Vanessa Williams  
View profile  
 More options Oct 12 2012, 4:54 pm
From: Vanessa Williams <fridgeb...@gmail.com>
Date: Fri, 12 Oct 2012 13:54:05 -0700 (PDT)
Local: Fri, Oct 12 2012 4:54 pm
Subject: Re: Newbie question about embedded usage

Ok, I can half answer my own question. By adding a server.stop() call
before exit, I can make the data survive restart. However, that would imply
that if a node goes down hard the data would be lost. That seems
counterintuitive, so I must be missing something. Any hints much
appreciated.

Regards,
Vanessa


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gxm  
View profile  
 More options Oct 13 2012, 12:40 pm
From: gxm <moull...@gmail.com>
Date: Sat, 13 Oct 2012 09:40:12 -0700 (PDT)
Local: Sat, Oct 13 2012 12:40 pm
Subject: Re: Newbie question about embedded usage

Hi Vanessa,

When you call
   VoldemortConfig config = VoldemortConfig.loadFromEnvironmentVariable();
Voldemort loads the required configuration from the file system.
One of the files, stores.xml defines the what type of persistence to use.
 If you want persistence, I recommend starting with bdb.
Another file, server.properties, lets you define characteristics of bdb's
persistence. Using
   bdb.write.transactions=true
should give you the behavior you are looking for.

You can read more about configurations here
- http://www.project-voldemort.com/voldemort/configuration.html

Cheers,

Greg


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Vanessa Williams  
View profile  
 More options Oct 15 2012, 11:32 am
From: Vanessa Williams <fridgeb...@gmail.com>
Date: Mon, 15 Oct 2012 08:32:29 -0700 (PDT)
Local: Mon, Oct 15 2012 11:32 am
Subject: Re: Newbie question about embedded usage

Thanks, Greg. The gdb.write.transactions=true setting did indeed solve my
problem.

Cheers,
Vanessa


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »