0

I have a website that is deployed on an environment as follows:

  • a load balance.
  • two web server.
  • two database servers.

both of the two database server have the same structure and queries. I found out that each one of them is storing different data than the other one and not connected.

i do not know much about this. i just need that any update that occurs on any servers be reflected in the other server.

EDIT: I stopped one of the servers and work on only one of them until we try the replication as it seems to be a wrong configuration.

6
  • You're going to have to provide a lot more detail; setup, error messages, etc. Have you asked the person who set this up? – Daniel Hutmacher Jan 24 '16 at 15:03
  • 1
    there is no error message. it is just each time a request is sent to the database it is sent randomly to one of the servers which is crazy. – Abd-elhameed Quraim Jan 24 '16 at 15:07
  • So, who set up the database servers? Did you consult these people? "It doesn't work" gives us absolutely nothing to go on. There's no way we can help you without more information. – Daniel Hutmacher Jan 24 '16 at 15:08
  • the developers team agreed to stop one server and work on the other one. i guess this is the only solution for now, isn't it? – Abd-elhameed Quraim Jan 24 '16 at 15:24
  • So you lose half of the data? – Tom V Jan 24 '16 at 15:29
4

Load balancing writes in SQL Server is hard. Are you sure this is actually a requirement? If not, and the servers just ended up this way because the implementers didn't understand the requirement, I would start with a single copy of the database that both web applications use, instead of trying to give each database an independent copy.

If it really is the requirement, then you could look into Distributed Partitioned Views, Peer-to-Peer Replication, Bidirectional Replication, or Merge Replication, all of which allow you to combine writes or otherwise share data from multiple instances. My guess, though, is that these solutions are overkill for your actual business requirements.

1
  • i started by stopping one of the servers and work on only one server and we will try the replication solution in order to work things out – Abd-elhameed Quraim Jan 25 '16 at 14:20
2

i just need that any update that occurs on any servers be reflected in the other server.

This question is completely predicated on the assumption that you're wanting to run an environment where Server A matches Server B and that the application can connect to either at any given moment and that what happens in one should also then be sent or updated in the other. I based this on the above quote in your question (the comments might indicate some other goal).

Depending on the version (2005, 2008, 2008R2, 2012, 2014, 2016), you can look at merge replication as a possible solution here. Provided that the database structure is identical (lots of assumptions), if the application connects to Server A, then the data added, updated, or deleted will be sent Server B, if Server B is online to receive. Vice versa is true.

Not the answer you're looking for? Browse other questions tagged or ask your own question.