Skip to content

Auto-failover in TypeORM #4262

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

Closed
yeung108 opened this issue Jun 10, 2019 · 1 comment
Closed

Auto-failover in TypeORM #4262

yeung108 opened this issue Jun 10, 2019 · 1 comment

Comments

@yeung108
Copy link

yeung108 commented Jun 10, 2019

Issue type:

[x] question
[ ] bug report
[ ] feature request
[ ] documentation issue

Database system/driver:

[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql / mariadb
[ ] oracle
[x] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo

TypeORM version:

[ ] latest
[x] @next
[ ] 0.x.x (or put your version here)

Steps to reproduce or a small repository showing the problem:

Does Replication in TypeORM support auto-failover, assuming that Postgres auto-failover has already setup? Like if the master connection failed, Postgres will automatically make secondary node as the primary node, but will TypeORM automatically make the one of the slave node as the master node?

{
  type: "postgres",
  logging: true,
  replication: {
    master: {
      host: "server1",
      port: 3306,
      username: "test",
      password: "test",
      database: "test"
    },
    slaves: [{
      host: "server2",
      port: 3306,
      username: "test",
      password: "test",
      database: "test"
    }, {
      host: "server3",
      port: 3306,
      username: "test",
      password: "test",
      database: "test"
    }]
  }
}

E.g. in above case, if server1 has some problem and Postgres service is unavailable, Postgres has automatically make server2 the primary node; but will TypeORM automatically change master to server2 so that read and write are supported in server2?

@vlapo
Copy link
Contributor

vlapo commented Jun 10, 2019

Hey thank for your question. Typeorm use node-postres Pool under the hood, so this kind of question is for them. Check for example this issue brianc/node-postgres#1075.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants