jarajesh
By:
jarajesh

SQLite persistence on Droplet

January 29, 2017 1.1k views
Block Storage MEAN Node.js Ubuntu 16.04 Ubuntu

hi , consider the following situation

1)I configure a droplet with blockstorage attached.
2)I place an sqlite file in the block storage and if read, write the sqlite file from my application(nodejs) in the droplet will the changes be persisted?

3)or Can I keep the file in the droplet itself -no blockstorage attached (since it is cloud will it allow me to read/write)?

which is the best solution?

2 Answers

@jarajesh

Each Droplet comes with it's own set amount of storage -- you don't need to add block storage if you don't actually have a use for it.

You can install and use SQLite on the Droplet itself and read from & write to your databases freely. As for persistence, that all depends on how you setup your SQLite database(s). As long as you choose to setup a file based database, data will persist through a restart, however, if you choose to store your database to RAM (which is an option), then you would need to flush the database to a file if you need for it to persist.

  • Thanks that clears up things for me.

    Is this "persistence upon restart" applicable for Mysql installed in a droplet with no block storage ?

    What is the best use case for a block storage?

@jarajesh

Any database software that relies on the disk for storage, or has disk storage as an option, will persist through a restart including SQLite, MySQL/MariaDB/Percona, PostgeSQL, and even NoSQL based DB.

The defaults for most database software is to use disk, so there's no special setting, you'd simply use the programming language of choice to communicate with the user & database you setup once your chosen software has been installed.

As for block storage, it's designed to be a flexible storage medium. For instance, you can attach it to one Droplet, detach it and then reattach it to another Droplet without losing data.

You could use it to store backups, logs, or even website data, the skies the limit really. There's really not a best use case as everyone tends to use it for their own specific needs.

Have another answer? Share your knowledge.