Primary Server and Hot Standby Server architecture - sql-server-2008

I am now starting to look into building the proper architecture for Intranet network with one Primary Server and a Secondary Server that I would like to operate as a hot standby.
My knowladge of this is quite minimal and I am looking for guidelines and articles that would get me started.
The Server that needs to be replicated will run the following:
- Windows Server 2008 R2 OS
- MS SQL 2008 R2 Std
- IIS 7.0 that will run a web application built in asp.net
- Several background services, some of them write data to the database. This are .net applications that were written in house but with no replication methodology.
My goal is to have the Primary Server data constantly replicated to the Secondary Server so that in case of failure the Seconday Server can start acting as Main Server ASAP.
My questions are:
1. What is the recommanded hardware topology in this case? Besides of the two server machines, do I need any extra hardware that will act as a DNS server to resolve rounting to the correct server?
If not, how can this be done with software?
2. Data base replication - I understand that I will need to use some sort of log shipping in order to syncronize between the databases. What are the limitations and guidelines? I need to know if there is a tradeoff for good performace vs. having an up-to-date replication of the database. A good article will be helpful.
3. Considering that rewriting the services application to support running in some sort of "passive" mode and transmitting state-data between the servers is probably not possible, what should be done with those services on the secondary machine?

I think you have the wrong approach to this, instead of using a hot standby you should use load balancing and clustering to provide availability.
My recommendation is to run the web application on both servers and use an IP Load Balancer to distribute requests between the two servers. If one of the servers becomes unavailable user requests will no longer be routed to that server and users will not really notice that a disruption has occurred. You should try to make use of an exising load balancer in your companies infrastructure.
If you have more than two servers available I would also recommend that you look at Windows Network Load Balancing (NLB) which a feature included in Windows Server, read more about NLB at http://technet.microsoft.com/en-us/library/cc725691.aspx. But as NLB and fail-over cluster is not supported on the same servers I cannot recommend that if you only have two servers.
For the database I would recommend that you use a 2-nodes active-passive database cluster, instead of deploying two separate SQL instances with replication between them. In a cluster configuration SQL Server runs on a single server but if that server has a problem SQL Server automatically switch over to the other server. Read more about SQL Server clustering at http://sql.starwindsoftware.com/sql-server-clustering-technology.
Implementing a clustering solution will require some sort of shared disk between the two server, because both servers can be active instances they have to be able to write to the same disks. If your organization has a SAN available then that is the preferred choice for the shared disk.
But now comes the problem with the background services. If they cannot be modified you just have to come up with some mechanism to move them if a server fails. If the servers are monitored you could have a technician initiate a script which starts the services on the other server. Manual operations are never reliable, but if you cannot rewrite them you don't have much choice.
If you have two server I recommend:
HW IP Load Balancer
|
-----------------------------
| |
SERVER A SERVER B
ASP.NET web app ASP.NET web app
SQL Server (active) SQL Server (passive)
Bg services (not running) Bg services (running)
I you have four servers I would recommend:
HW IP LB or Windows NLB
|
-----------------------------
| |
SERVER A SERVER B
ASP.NET web app ASP.NET web app
| |
-----------------------------
|
-----------------------------
| |
SERVER C SERVER D
SQL Server (active) SQL Server (passive)
Bg services (not running) Bg services (running)

Related

Redirect all the mysql requests to other DB server

I have a staging server on AWS where my web application is running.the application uses Dedicated Database server(mysql/linux) from other provider. i would like to spin a new server on a AWS that should act like a proxy server to connect with my Dedicated Database server.
please advise me how can i achieve.
You can proxy the traffic with HAproxy, you can have one DB in active mode and one in passive mode, when ready to cut over you take the active one offline and ha will start sending requests to the other DB server.
Additionally, HAproxy will allow you to send traffic to certain DB servers depending on a variety of criteria, like the source IP. So some web apps send to one DB and others send to another.
HA proxy is very lightweight, we use it and run hundreds of thousands of requests a day without any performance issues.
Take a look at MaxScale from MariaDB. it a DB proxy. the can do all this and more..
https://mariadb.com/products/mariadb-maxscale

Data transfer between local server and AWS server

We have an ASP.NET MVC 5 web application that reads data locally from within the same server. This server is in Europe. However when trying to read the same data from an AWS server based in Sidney the lag is many times greater. A ping from our local server to the AWS server in Australia takes 5 seconds. The data needs to be located in Australia because of data protection laws issued by the Australian Government. The database is MySQL. We have created a VPN between both servers and made no difference.
What are our options in order to improve the speed between these two servers?
If it is a web application serving content to users over internet you can use CloudFront distribution to reduce your latency issues.
https://aws.amazon.com/cloudfront/
If you are trying to connect your servers from your data center to AWS
Use AWS Direct Connect, this will provide a dedicated link between your on-premise datacenter and to the AWS Servers; Decreasing your latency by a lot.
https://aws.amazon.com/directconnect/
AWS runs your application regardless of which platform(ASP.NET, JAVA, C...) it is, AWS only provisions infrastructure. You don't need to worry about the platform on which your application is running and what database it connects to. You just need to ensure that all the network connections are properly open so that your servers can communicate with AWS servers.

Single Store CRM application to Multi Store CRM - Single Local database server to Multi Store Multi location

My company has Desktop application developed in vb.net using devexpress controls. Back End database is MySQL.
Company is in retailing and have 2 retail stores in in same city. Both stores always stay busy and customers are always in waiting at the counter. Basically, it is desktop based CRM application which has lot of modules inside it apart from invoice/Receipt module, it has other modules like Delivery module, installation module, Service/Repair module, Account Receivable module and many other modules used by various back office departments of the company. Other resources/hardware such as Barcode Printer, Receipt Printer, and Barcode scanner are connected to the CRM on Desktop PC.
Currently, there are around 55 clients always connected to server and using application.
Problem:
Till couple of weeks back, company had no issue using this desktop application and single MySQL server as all clients were connected via LAN or WLAN.
Now situation has changed, and new requirement has raised: Company has planned to open new stores at very far distance. Such stores cannot be connected to current central database via LAN or WLAN. Each new branch would have around 20-30 clients, say “Branch Clients”
Also, there would be field executive who will be working from their laptop. Say “Remote Clients”. They will just have 3G internet connection on their laptop.
Thought 1: Install desktop application at all branch PCs, and connect them to central MySQL database server over the internet.
Not possible: Connection over the internet would be very slow for fetching such huge data. Data is really huge For, e.g. if client opens “Customer Master”, then there would be more than 600,000 rows which takes lot of bandwidth and time to open over the internet. And there are many more such modules which loads lot of data.
Also, in case of losing internet connection, clients would not able to operate the application. Customer waiting in line to make receipt would go crazy if they have to wait for long.
Thought 2: Install new MySQL server at branch store, all the desktop PCs then would be connected to that local branch server. And then that local branch server would be connected to central server via MySQL replication option.
Not possible: Since MySQL replication has limitation of only one way replication, we cannot implement this structure. Application requires to move data from central server to branch server and from Branch to Central in real-time. Also, MySQL replication engineering has limitation to replicate only with one server only. In that case, we cannot replicate with multiple branch stores. There is an option of cluster server, but company cannot afford licensing cost.
Thought 3: Somebody suggested me that I should transfer entire desktop application into Web Application and get cloud server for database.
Not possible: I think looking at current requirement (fast access), environment (retail store-pos) and hardware (printers, scanners) connected to client - it is not advisable to have web application and cloud database server. Also in the event of no internet, entire store would go down.
Thought 4: Somebody suggested me that I should move from MySQL server to MSSQL and keep desktop application as it is. MSSQL has capability to sync with multiple servers in real-time over the internet. It has no limitation like MySQL’s one way replication and only one replication connection.
I guess, to make faster and constant database connection, installing local branch server is highly required. But I don’t know how those different branch servers could be connected to central server.
My Questions:
• What is the best way to resolve above issues in given condition and successfully fulfill the company’s requirement? Faster and constant connection to database server. And also real-time updates between all branches and central server. If internet connection is down, then delay in real-time update is acceptable but clients should not be affected from work.
• Would migration from MySQL to MSSQL resolve the issue? Because data migration is not issue as there are many tools available which converts the database from one platform to other. But issue is - application is very huge having hundreds of query written for MySQL. I guess I have to change those all queries also, because queries are not same for MySQL and MSSQL. Do I have to change all the queries or just the few percentage queries? Or if there is any tool available which convert queries from MySQL to MSSQL query.
• In general, how such small-medium retail store company have their infrastructure and application setup? Let me know some ideas.

Database synchronization?

I have a small problem, I am working on a project where I need to synchronize the databases to maintain the same data at diff locations, all have their own database the structure of all the database,tables,stored procedures,etc are the same. i.e. they are the copy of a single database but data is entered from different locations and I need to have data to be synchronized so that we can see the data from anywhere, will creating a windows service work?
C# code will be a nice help.
You can do this by two ways .....
1st way using combination of services
i) W CF Service with windows service Or Web service with Windows Service.
you will need a windows service which is installed on every client machince which will check the new data in local db and send that data to web or wcf service which will be installed on Server Machine for LAN.
but if client is on network then web service or w cf service should be on Static IP Address where Server Database is installed
and if client is offline in some case then u should use MSMQ or Rabbit MQ or any queuing mechanism for that ...to handle such case..
2nd way is using Replication in in sq l server 2008 go through this links:
http://www.codeproject.com/Articles/215093/Replication-in-MS-SQL-Server
http://www.informit.com/guides/content.aspx?g=sqlserver&seqNum=313) Database syncronization
Replication is what you need I guess, let SQL manage where you dont have write any code and is easy to configure.
have a look at http://www.codeproject.com/Articles/215093/Replication-in-MS-SQL-Server , or type SQL replication and there are loads of material available.

Two-way replication with MySQL to sync instances of a database app between multiple offline clients?

I am tasked with building an application whose database backend needs to be replicated in both directions over an unknown number of clients who are usually offline. Before I explain in detail, my question is whether MySQL replication is feasible for this project or if I should look into other technologies.
Here's the general use case:
User installs software on personal laptop.
User loads data from the master database server onto her laptop.
User disconnects from the network and proceeds to operate on this data remotely.
User remotely connects back to the master database server to commit her changes and retrieve any changes that have since been committed by other people (two-way synchronisation).
I have no experience with database replication of any kind, so this is quite an interesting challenge. Can MySQL replication accomplish what I'm looking for? Or, do you know of another technology that will accomplish this more effectively that MySQL? I've read through the docs ( http://dev.mysql.com/doc/refman/5.0/en/replication.html ) and it looks like it is more geared towards master/slave replication.
MySQL supports one-way replication only.
While this doesn't directly answer your question, MS SQL Server 2008 supports this scenario (merge replication) very well.
In fact, you can use the free MS SQL Server 2008 Express on clients, reducing the need to have multiple SQL Server licenses.
Also, take a look at the Microsoft Sync Framework.
SQL Express - Client Synchronization Sample on MSDN
Microsoft Sync Framework Support in Visual Studio 2008
There are also forums here: SyncFx - Microsoft Synchronization Services
The type of multi-master replication that you are describing is one of the primary use cases for CouchDB.
CouchDB Technical Overview