ON the following page: Database FAQ, the limits of databases are given as follows:
- 50 MB per database (sum of keys and values)
- 5,000 keys per database
- 1000 bytes per key
- 5 MB per value
But is there a way to create multiple database objects (and access those after restarting the server) ?
And if that is the case, how many database objects are possible to create? Will the upper storage limit of 5 GB decide how many you can create?
Hey, @HiwaMobaraz welcome to the forums!
Unforetnly you cannot. Though Replit db is per repl and not account wide if that helps you. You can use Mongo db and you get up to 5GB of storage for free. And you can get up to 1TB for very little money.
Theoretically speaking, if you create a number of Repls, each one will have its own database. You could then manually connect to each database using them as a cluster of databases.
To get the database URL from each Repl, enter
echo $REPLIT_DB_URL in the shell.
Not sure what language you are using, but in NodeJS you could do this:
// get Replit's library for interaction with their databases
const Client = require("@replit/database");
// connect to each database
const db1 = new Client("<url 1>");
const db2 = new Client("<url 2>");
const db3 = new Client("<url 3>");
// set a value in each database
db1.set("some key", "some value");
db2.set("some key", "some value");
db3.set("some key", "some value");
// get a value in each database
I can’t say for sure whether there is a limit to the number of databases you can have, you can have unlimited Repls (in theory), so you should be able to have a database for each one. Obviously, you have to take into account the account storage limit, so if you cannot create any more Repls because you have reached this limit, then you cannot create anymore databases.
Is there no paid version from this site that offers any database =( ?
I’m not sure what you mean… Could you elaborate and maybe explain what you are trying to achieve?
@MattDESTROYER I just want a simple way to store data (up to 2 GB) without the need of setting up a database from another provider (I am new to servers/databases). I thought each account can have up to 5 GB of data for storage, but that was not the case.
Another thought is if i can save the data locally (to the file system as files) up to 5 GB with node.js. Is that possible? or will the files be deleted by the system?
There is a Repl size limit, I think it’s 500 MB for free plan and 1 GB for hacker plan.
If you want to store up to 2 GB, I would suggest, as @not-ethan said, using MongoDB. However, do you actually need up to 2 GB of storage?
The problem is, the database URLs change from time to time
Just for reference: I lost 4000 USD due to database usage today. @not-ethan that is not “very little money” =(.
I will write a separate topic about this but long story short: Databases can cost the shit out of you =/