How to sync multiple MongoDB instances? - database

I have a service on a remote server (server1) that uses a MongoDB database. Now i want to copy that service and the database to a second server (server2) to have a failsafe in case server1 has any problems.
How would i go about synchronizing the database so it's always the same on both servers and so that when server1 goes up after a problem it migrates any changes made to server2's database to it's own?

You can create a replica set of your Server 1. MongoDB provides this feature.
There is an extensive explanation on MongoDB Replication in Mongo's Official Documentation.

Related

Migration using AWS-DMS from standalone SQL server to AWS Redshift?

I have a SQL Server 2012 hosted on a standalone machine. I want to migrate it to my AWS Redshift (already existing data warehouse).
My question is wether it is possible via AWS Data migration service ?
I am also open to other efficient methods for migration. Currently I am doing the following steps
taking a backup of the SQL server DB in the standalone server.
uploading it to AWS-S3.
Droping and restoring the Db from S3 in AWS-RDS (Sql-server)
I would like this data to be present in my data warehouse i.e AWS-Redshift
Thanks for the help in advance !
There are 2 types of migration within DMS
"one off" data migration, where the data is copied using sql
statements
"continuous replication", where the "change dta capture" system on
the source is used to capture and process just the updates.
SQL server can be used as a source for both of these types however there are caveats and limitations that should be read and understood thoroughly.
https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.SQLServer.html
So long as you follow the instructions and meet the limitiations that are documented then it will work great.

Is it posible to use SQL Server Session Context with Azure elastic queries

I want to know if it's posible to share SQL Server SESSION CONTEXT variables between different Azure Sql databases using Elastic Queries.
I searched in official documentation but i can't found any information about this feature is available or not.
SESSION CONTEXT exists locally to a single server instance in SQL Server. (It's tied to a session). SQL Azure is built using SQL Server but there are some parts of the mapping that are opaque to customers (they can change based on circumstances such as what Edition you use or what version of the internal software we are using to deliver the service).
Elastic Queries is a feature to let you query from one database (source) to one or more other databases (target(s)). In such a model, you have a SQL Server session to the source database, and the elastic query has a separate connection/session to each other database being touched.
I think the question you are asking is "can I set the session context on the source connection/session and have it flow through to all the target connections when running queries there?" (That's my best guess - let me know if it is different). The answer today is "no" - the session variables do not flow from source to target as part of the elastic query. Also, since today elastic query is read-only, you can't use elastic query to set the session context individually on each target database connection/session as part of the operation.
In the future, we'll consider whether there is something like this we can do, but right now we don't have a committed timeline for something like this.
I hope this explains how things work a bit under the convers.
Sincerely,
Conor Cunningham
Architect, SQL

Database mirroring

I'm designing a CRM for a company with 3 branches. the connection between these 3 branches is not reliable (with a vpn over internet). so we decided to setup a local server with SqlServer Database in each one and configure these DBs in the way that whenever a client inserted data into any of these DBs it automatically insert it into other ones. How could I do this?
and my programming language is C# if it would help!
You could use SQL Server replication, more specifically Merge Replication
See http://technet.microsoft.com/en-us/library/ms152746.aspx

Synchronizing the databases

I am developing an web application in which i need to maintain the website in the local servers itself with the database in the computer itself , the local database will change periodically.There is a central database through which i have to access all the data in all the remaining DB's .
The problem is that even when internet connection is disabled, the local server will update the local database but when when it regains the internet connection it has to update the central database with the local modified data.
The tables( i mean the database schema, table names, attributes all) in all the DB's is same.The data should be appended if added any new ,should be deleted if any deleted and should be modified if any.
I am using MySQL server as DB, Apache Tomcat as server and using JSP, Servlets for business logic.
Please visit http://dev.mysql.com/doc/refman/5.1/en/replication-howto.html
Mysql replication might do the job but there are a few things that you have to consider, like:
the amount of data that has to be synchronized
the OS used on master and slave servers
because of the internet connection issue - why you disable internet connection? one option might be a scheduled job (crontab)

Is replication the best method for my scenario?

I have a WinForms business application that connects to a SQL Server on a server within the business network. Recently we have added an ASP.NET web site so some of the information within the system can be accessed from the Internet. This is hosted on the same server as the SQL Server.
Due to the bandwidth available to the business network from the Internet we want to host the web site with a provider but it needs access to the SQL Server database.
95% of data changes are made by the business using the WinForms application. The web site is essentially a read only view of the data but it is possible to add some data to the system which accounts for the other 5%.
Is replication the best way to achieve the desired result e.g. SQL Server within the business network remains the master database as most changes are made to this and then replicate this to the off site server? If so which type of replication would be the most suitable and would this support replicating the little data entered from the ASP.NET web site back to the main server?
The SQL Server is currently 2005 but can be upgraded as required for any replication requirements.
Are there other solutions to this problem?
Yes, since the web application is causing 5% (max) transaction; you can separate it.
I mean, you can have a different DB which is a carbon copy of the master one and have web application point to this DB.
You can setup a bi-directional transaction replication. So that, transaction made to the master DB will get replicated as well as transaction made to the secondary DB will be replicated as well.
No need of upgrading; as SQL Server 2005 supports replication.
For further information check MSDN on replication here: Bidirectional Transactional Replication
In a Nutshell, here are the steps you would do:
Take a full backup pf the master DB
Restore the DB to newly created DB server
Configure trans replication between them.
For better performance, you can also have the primary DB mirrored onto someother DB server.

Resources