Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storing data in memory #2727

Closed
thdxr opened this issue Sep 30, 2015 · 5 comments
Closed

Storing data in memory #2727

thdxr opened this issue Sep 30, 2015 · 5 comments

Comments

@thdxr
Copy link

thdxr commented Sep 30, 2015

Is there a better way to do this than tmpfs and is it even worth doing this or are there better solutions when I don't care about the data being durable?

I see this: https://github.com/cockroachdb/cockroach/blob/master/storage/engine/in_mem.go

@thdxr
Copy link
Author

thdxr commented Sep 30, 2015

Found it here:

"stores": `

@thdxr thdxr closed this as completed Sep 30, 2015
@thdxr thdxr reopened this Sep 30, 2015
@thdxr
Copy link
Author

thdxr commented Sep 30, 2015

Unfortunately could not get it to work, any guidance would be appreciated

@tbg
Copy link
Member

tbg commented Sep 30, 2015

I'm assuming your node just sat there with a message like

connected to gossip but missing sentinel. Has the cluster been initialized? Use "cockroach init" to initialize.

We do support in-memory engines (as you noticed) but have been using them mostly for our unit tests. The problem in practice is that while you can start such a node, you can't bootstrap one (that would mean running cockroach init for that engine, but the engine gets destroyed when that process ends, so the subsequent start wouldn't behave any differently).

One way to get around it is bootstrapping with an on-disk store which can be removed once you have an otherwise in-mem cluster running, but honest support for this likely entails changes to how the initialization process is exposed through the command line tool.

So, short answer - what you're asking for is going to work at some point, but not yet. You can have a single-node in-mem instance for playing around with though; see the --dev flag.

@thdxr
Copy link
Author

thdxr commented Sep 30, 2015

Thanks for that response, that's exactly the same conclusion that I arrived that.

@knz
Copy link
Contributor

knz commented Feb 7, 2016

This is now possible thanks to #4027.
You can start a new node ready for replication with a memory-only data store using this command:

   cockroach start --stores=mem=12312312 

(or possibly with --join if joining an existing cluster) and this will not store the data persistently.

@knz knz closed this as completed Feb 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants