MongoDB replicaset can't connect

yatochka-dev
HOBBY

7 months ago

Im using prisma and since to use prisma you need mongodb replicaset - Im using this template:
https://github.com/railwayapp-templates/mongo-replica-set

But I can't figure out how to connect it to my project

0 Replies

yatochka-dev
HOBBY

7 months ago

9c4d59cd-5d98-4da0-a889-cb965fef1df4


7 months ago

connect to Mongo1's url


yatochka-dev
HOBBY

7 months ago

This? (MONGO_URL)

1334538626574450700


yatochka-dev
HOBBY

7 months ago

I get this error

1334552420986126600


yatochka-dev
HOBBY

7 months ago

What is the database name?


yatochka-dev
HOBBY

7 months ago

Ok I found that


yatochka-dev
HOBBY

7 months ago

But it still doesn't work


yatochka-dev
HOBBY

7 months ago

Error: MongoDB error
Kind: Server selection timeout: No available servers. Topology: { Type: ReplicaSetNoPrimary, Set Name: rs0, Max Set Version: 1, Max Election ID: 7fffffff0000000000000001, Servers: [ { Address: mongo2.railway.internal:27017, Type: Unknown, Error: Kind: I/O error:
 No such host is known. (os error 11001), labels: {} }, { Address: mongo3.railway.internal:27017, Type: Unknown, Error: Kind: I/O error: No such host is known. (os error 11001), labels: {} }, { Address: mongo1.railway.internal:27017, Type: Unknown, Error: Kind: I/O error: No such host is known. (os error 11001), labels: {} } ] }, labels: {}
   0: schema_core::commands::schema_push::Calculate `from`
             at schema-engine\core\src\commands\schema_push.rs:27
   1: schema_core::state::SchemaPush
             at schema-engine\core\src\state.rs:504

yatochka-dev
HOBBY

7 months ago

@monorail.proxy.rlwy.net:__MY_PORT/railway?retryWrites=true&w=majority&authSource=admin&replicaSet=rs0


yatochka-dev
HOBBY

7 months ago

This is the part after credentials


yatochka-dev
HOBBY

7 months ago

And I replaced my port


7 months ago

when developing locally you would want to use the public url with direct connect enabled


yatochka-dev
HOBBY

7 months ago

Which one of these is public?

1334589553834594300


7 months ago

the one with the yellow icon


yatochka-dev
HOBBY

7 months ago

I did this, with the same url as before (as I have already been using the public one)

1334589912774873000


yatochka-dev
HOBBY

7 months ago

Error: MongoDB error
Kind: Server selection timeout: No available servers. Topology: { Type: ReplicaSetNoPrimary, Set Name: rs0, Max Set Version: 1, Max Election ID: 7fffffff0000000000000001, Servers: [ { Address: mongo2.railway.internal:27017, Type: Unknown, Error: Kind: I/O error:
 No such host is known. (os error 11001), labels: {} }, { Address: mongo3.railway.internal:27017, Type: Unknown, Error: Kind: I/O error: No such host is known. (os error 11001), labels: {} }, { Address: mongo1.railway.internal:27017, Type: Unknown, Error: Kind: I/O error: No such host is known. (os error 11001), labels: {} } ] }, labels: {}
   0: schema_core::commands::schema_push::Calculate `from`
             at schema-engine\core\src\commands\schema_push.rs:27
   1: schema_core::state::SchemaPush
             at schema-engine\core\src\state.rs:504

yatochka-dev
HOBBY

7 months ago

Is there anything I'm doing wrong?


7 months ago

you need to use direct connect mode


yatochka-dev
HOBBY

7 months ago

Where exactly do I turn that on?


7 months ago

that would be a client setting


yatochka-dev
HOBBY

7 months ago

1334590347094921200


yatochka-dev
HOBBY

7 months ago

@Brody, so where the setting is?


7 months ago

please reference the clients documentation, we are not able to provide coding support here


yatochka-dev
HOBBY

7 months ago

What client?


yatochka-dev
HOBBY

7 months ago

You mean prisma?


MongoDB replicaset can't connect - Railway Help Station