Data missing: MonogoDB
adarshmishra07
HOBBYOP

a year ago

Hey i had a mongodb replica set - the payment for my account failed for some reason and the applications stopped - when i made the payment all my data is missing need help.

Solved

47 Replies

adarshmishra07
HOBBYOP

a year ago

6a1c0558-f3b6-48a5-8e82-0385da7fbc2b


dev
MODERATOR

a year ago

did you start the mongodb services back up again?


dev
MODERATOR

a year ago

mind sending a screenshot of them?


adarshmishra07
HOBBYOP

a year ago

yes i did a rollback on each of them


adarshmishra07
HOBBYOP

a year ago

1331925853033992200


adarshmishra07
HOBBYOP

a year ago

Mongo1 had all the data which is reset now it seems


dev
MODERATOR

a year ago

interesting, did you deploy Railway's official MongoDB replica set?


adarshmishra07
HOBBYOP

a year ago

i used a template from mongodb yes


adarshmishra07
HOBBYOP

a year ago

i mean Railway templates


adarshmishra07
HOBBYOP

a year ago

1331926207746412500


dev
MODERATOR

a year ago

alright, thank you


dev
MODERATOR

a year ago

and how long was the period between you missing payment and then paying?


adarshmishra07
HOBBYOP

a year ago

I am not 100% sure - as this account is linked to the clients email - the services were down i realised it yesterday and when they made the payment today there's no data


adarshmishra07
HOBBYOP

a year ago

the bill seems to. be generated on 18th


adarshmishra07
HOBBYOP

a year ago

Hey let mek now if you find something please - i also need your help with some cost optimisation on this


dev
MODERATOR

a year ago

yea sorry for the delay I was getting some food, I'll ask a team member about this when he wakes up


dev
MODERATOR

a year ago

which plan are you on btw?


adarshmishra07
HOBBYOP

a year ago

For this client it's on Hobby currently as we are not yet ready to launch and being beta tested


adarshmishra07
HOBBYOP

a year ago

Would you be able to help me with the cost optimistation part ?
Basically i am using prisma transactions which requires the database to have replicas - but seems like having 3 mongodb instances is costing us too much like no usage and we're already at ~3$ so can we delete on replica will that help - or do you think this cost is not because of the mongodb but something else?


dev
MODERATOR

a year ago

It's definitely MongoDB, MongoDB (and MySQL) are expensive databases to run, from my experience a single idle MongoDB service costs 3 usd a month

You can theoretically have a single-node replica-set though if you must have transactions, or just don't use transactions in the first place
of course this does damage redundancy and storage security but if cost is a big issue and you can't afford to host 3 mongo nodes then i don't really see another way to go about it


dev
MODERATOR

a year ago

(sorry for taking so long to respond, I'm sick so I was taking a nap)


dev
MODERATOR

a year ago

Btw, I did some thinking and I have a theory, I'm going to test it tomorrow (it's 9pm for me)


adarshmishra07
HOBBYOP

a year ago

Hey thanks a ton, really appreciate you helping out even when you're not doing well.

Yes i think i will have to take an alternative route for the replicas this might not be sustainable given small scale of the project.

Sure please try it out and make any changed would be great if i can have my data back and a way to not lose it again incase of the serverices stopping.

Thanks Again!


brody
EMPLOYEE

a year ago

just gonna pop in here to say that if you don't have a backup, that data would be gone


brody
EMPLOYEE

a year ago

but i'll let fragly continue the investigation from here when hes better


adarshmishra07
HOBBYOP

a year ago

Oh no!
But like the data getting deleted didn't expect that, i hope whatever Fragly tries works 🙂


adarshmishra07
HOBBYOP

a year ago

Hey team, any luck with the data ?


adarshmishra07
HOBBYOP

a year ago

I have used the backup i had from earlier for now to get things running - is there a way/template to migrate mongoDB data to postgres?
Maybe that would be a way to avoid using replicas and not have unncesarry costs


dev
MODERATOR

a year ago

hey sorry I'm still testing, I'll give you a rundown of what my testing reveals when I've confirmed everything


dev
MODERATOR

a year ago

I'm not sure to be honest, I'm doubtful because MongoDB and Postgres are very different, literally apples and pears (NoSQL and SQL)
it'd be hard automatically transferring bjson-like data over to SQL-like data cause the structure of the bjson data can vary a lot naturally

I think easiest solution would be just writing a quick script to migrate the data over, can't be too hard


dev
MODERATOR

a year ago

@Darth Vader I did a lot of testing, and I found that I could replicate the data-loss, it seems that the MongoDB replica-set template didn't mount the volumes on the correct location causing no data to be saved in the first place, I've notified Railway about this mistake and the template has been updated with a fix

Unfortunately the data was never saved in the volume and so recovery would be impossible 😔


adarshmishra07
HOBBYOP

a year ago

Thanks a ton - Fragly i really really appreciate you deeply looking into it - i have manually added all the data from an old backup i hope it doesn;t happen again.

And thanks for your insights on the migration as well.

Thanks sir :))


brody
EMPLOYEE

a year ago

have you updated the volume mounts?


adarshmishra07
HOBBYOP

10 months ago

Hey sorry missed the message - when i restored my data i deleted one of the relpica.
Thats is all i did


brody
EMPLOYEE

10 months ago

right but you havent updated the mount path, you will lose data on the next redeploy


adarshmishra07
HOBBYOP

10 months ago

How am i supposed to do that - can u please guide me

1334190652660912000


brody
EMPLOYEE

10 months ago

the correct mount path is /data/db


adarshmishra07
HOBBYOP

10 months ago

so for both i just need to add /db right ?


brody
EMPLOYEE

10 months ago

yes update both


adarshmishra07
HOBBYOP

10 months ago

i won't lose the data now right ?


brody
EMPLOYEE

10 months ago

yes you will


adarshmishra07
HOBBYOP

10 months ago

oh no!


adarshmishra07
HOBBYOP

10 months ago

is there a way to do it wilout losing ?


brody
EMPLOYEE

10 months ago

nope


brody
EMPLOYEE

10 months ago

take a backup


adarshmishra07
HOBBYOP

10 months ago

got it thanks for letting me know


brody
EMPLOYEE

10 months ago

!s


Status changed to Solved brody 11 months ago


Loading...