-1

I need two instances of Wildfly running on two different machines using the same database. How do I implement such an use case? So far I see two options:

  1. mysql databases on both machines (mirroring each other)
  2. external mysql database and both instances connecting to that remote db

What is Best Practice and what do I have to consider? I can not find any information on how to add a remote database as datasource to wildfly, is this bad practice?

Update: Assuming I have chosen the second approach, how to add a remote database as datasource to wildfly?

yN.
  • 1,847
  • 5
  • 30
  • 47
  • Explain the need for 2 machines. (There are multiple solutions; we should home in on the one that fits your needs.) – Rick James Dec 12 '16 at 23:48
  • I need 2 machines to prevent the system from downtime in case of hardware failure. I thought about placing them in different data centers but I have read [this article](https://www.elastic.co/blog/clustering_across_multiple_data_centers) about it and canceled the idea. – yN. Dec 13 '16 at 16:14
  • If you have them in the same DC, then a single tornado, earthquake, etc, can wipe them both out. I've seen a smoking UPS and a heat wave take out datacenters. – Rick James Dec 13 '16 at 19:12
  • Will both machines be receiving writes? (I hope not.) Or will one be a hot standby? – Rick James Dec 13 '16 at 19:14
  • Ok maybe my question is misleading. I'm not a db expert and I won't set up the dbs... I just want to know how I'm able to connect 2 wildfly instances to the same remote mysql db. – yN. Dec 13 '16 at 19:25

1 Answers1

1

When you have multiple clients, it is usually best to have all of them talk to a single MySQL instance.

Single MySQL instance: Simpler maintenance, simpler topology, etc.

Multiple MySQL instances: Must decide on which flavor of replication, configure it, administrate it, etc. The benefit is some additional level of redundancy ("High Availability").

In any topology, you need to consider the multiple clients touching the same data at the 'same' time. This is usually handleable via InnoDB's transactions.

Rick James
  • 135,179
  • 13
  • 127
  • 222