This post is also available in: English

Data replication đã chuyển từ “có thì tốt” trở thành “xu thế chủ đạo” cho các trường hợp sử dụng như Tính khả dụng cao (High Availability) và khả năng phục hồi (Disaster Recovery). Đồng thời, các công ty nhận thấy nhu cầu sao chép hoặc di chuyển dữ liệu vì nhiểu lý do khác, bao gồm hiệu suất và chuyển đổi các transactional data thành các event .

Data replication là gì?

Data replication là quá trình cập nhật các bản sao dữ liệu tại nhiều địa điểm khác nhau. Mục tiêu của việc này là giữ cho dữ liệu của bạn luôn sẵn sàng khi có người cần sử dụng dữ liệu để đưa ra quyết định và cả những khách hàng đang cần để thực hiện giao dịch.

Data replication hoạt động như thế nào?

Data  hoạt động bằng cách duy trì sự đồng bộ giữa dữ liệu nguồn (source data) và dữ liệu đích (target data). Điều này có nghĩa là bất kỳ thay đổi nào vào dữ liệu nguồn đều được phản ánh trong dữ liệu đích.

Tùy thuộc vào từng chiến lược data replication cụ thể, cơ sở dữ liệu đích của bạn có thể giống với nguồn (sao chép toàn bộ cơ sở dữ liệu – full-database replication) có thể là một phâng của nguồn (partial replication). Nếu mục tiêu của bạn là tính khả dụng cao (high availability) hoặc khả năng phục hồi (disaster recovery) thì việc duy trì các bản sao đầy đủ là điều hợp lý. Để phân tích, báo cáo hoặc theo dõi, bạn có thể giảm khối lượng công việc trên cơ sở dữ liệu nguồn bằng cách sao chép các tập hợp con, theo khu vực, chức năng kinh doanh hoặc event, của dữ liệu từ nguồn đến nhiều đích khác nhau.

Các bản sao dữ liệu cần thiết cho việc sao chép có thể được thực hiện theo nhiều cách khác nhau.

Đơn giản nhất trong số này là ảnh chụp hoặc bản sao dữ liệu được lấy tại một thời điểm nào đó. Kiểu sao chép này thường được sử dụng để sao lưu hoặc trong trường hợp dữ liệu tại đích có thể cũ hơn dữ liệu tại nguồn. Nhược điểm của snapshot là chúng chỉ là ảnh chụp nhanh hoặc hình ảnh dữ liệu của bạn tại một thời điểm cụ thể. Nếu dữ liệu nguồn thay đổi, những thay đổi đó sẽ không được phản ánh tại đích (target) cho đến khi có bản snapshot tiếp theo. Ngoài ra, snapshot thường được chụp trên toàn bộ cơ sở dữ liệu, việc này có thể tốn thời gian.

Một kỹ thuật khác đôi khi được sử dụng cho việc sao chép là sao chép hợp nhất (merge replication). Merge replication liên quan đến việc ghi lại các thay đổi được thực hiện tại nguồn và sau đó áp dụng những thay đổi đó dưới dạng một lô (batch) vào đích. Vì dữ liệu phải được xử lý nhiều lần, nên có thể xảy ra các vấn đề  hiệu suất với merge replication.

Hình thức sao chép phổ biến nhất được sử dụng hiện nay là sao chép giao dịch (transactional replication). Trong hình thức sao chép này, các thay đổi hoặc giao dịch được áp dụng vào nguồn được ghi lại và sau đó được áp dụng vào đích. Transactional replication có thể áp dụng các thay đổi từ nguồn đến đích gần như trong thời gian thực, hầu hết thời gian chờ đợi là thời gian dữ liệu di chuyển từ nguồn đến đích. Điều này giải quyết các thách thức về độ trễ so với cách thức snapshot hoặc merge replication.

Lợi ích của data replication là gì? 

Bạn sẽ phải ngạc nhiên về lợi ích của việc lưu trữ dữ liệu ở nhiều nơi cùng một lúc.

Đây là một lợi ích khác: dành cho các dự án tích hợp dữ liệu. Khi bạn tập hợp một lượng lớn dữ liệu từ nhiều nguồn, việc gửi dữ liệu từ tất cả các nguồn đó đến đích sao chép (replication target) sẽ giúp dữ liệu sản xuất (production data) luôn sẵn có. Trong khi đó, các công cụ tích hợp tổng hợp dữ liệu từ các kho lưu trữ khác nhau và cung cấp dữ liệu đó cho các hoạt động và việc phân tích.

“Being data-driven” có nghĩa là loại bỏ càng nhiều rào cản giữa người dùng và cơ sở dữ liệu càng tốt. Data replication là một bước tiến lớn hướng tới việc đưa dữ liệu của bạn đến nhiều nơi mà người dùng cần.

Ví dụ về data replication

The more your business relies on data, the more important it is to make sure there is no single point of failure. When you replicate your data to targets in other cities or time zones, you help ensure that users and customers can always access it.

  • IT administrators often turn to data replication for disaster recovery. With their data safely maintained at two or three different sites, they are less vulnerable to business interruption in case of a system breach or disaster at any single site. And, because the replica is always up to date, business continuity is just a matter of redirecting traffic away from the disabled source to the target site.
  • In an era when customer bases and development teams follow the sun, geo-diverse database replicas keep data close to the people who need it. Data replication is a useful strategy for overcoming network latency and improving performance for local access.
  • Real-time analytics are integral to competitive advantage, so line-of-business managers want to run queries and base their decisions on current transactions. To keep those queries from burdening the source, administrators create and maintain replicas for use by analysts and offload that work from the production database.

The image below depicts a log-based replication architecture, with data flowing from source to target and cloud.

Data replication — log-based replication architecture

 

Synchronous vs. asynchronous replication

Data replication can be synchronous, where data from multiple locations is kept synchronized at all times and a change is not considered complete until it is completed on both source and target; or asynchronous, where changes to the source and target are independent and changes to the target may be delayed.

Typically, synchronous replication takes more resources and can result in performance bottlenecks. Synchronous replication sets up a “two-phase commit” situation, where until the data is available in all locations, it’s not available at all. This can cause performance issues with online transaction processing or other time-sensitive systems. It can also be an issue with systems located far from each other, since data can’t yet move faster than the speed of light.

Synchronous replication is normally used only when the consequences of unsynchronized or lost data are higher than the associated costs. Normally, once data is written once, it’s considered secure, and a short lag between the source and target is acceptable. With today’s optimized software and hardware, the asynchronous replication is generally tolerable.

 

Why is data replication important?

Data replication technology lets your organization use your databases in two, five or a dozen places at the same time.

So, why is replication so important? I’ll explain how you can replicate data to your advantage in three important areas:

  • Analysis and reporting
  • Upgrades and migrations
  • High availability and disaster recovery
  • Translate transactions into events

Analysis and reporting

“Replication isn’t such a big deal,” you say. “I can email a data file to 20 people. Then I’d have my data in 20 places at the same time.”

That’s true. But what if it was ever-changing sales data from your e-commerce site, or real-time data based on your company’s social media? By the time recipients had opened your data file and started analysis, they would be studying old news. It would be like reading a printed newspaper: The longer they studied the data in the file, the less current its story would be. You’d have to send out an updated file every time there was a new or changed transaction.

Besides, sending a data file doesn’t scale up very well. It may work for a 100KB or 700KB spreadsheet full of data, but what about a 500GB database? You couldn’t send that out every hour.

“In that case,” you say, “I’d let everybody log onto and query the production database. Then, we would all query and analyze exactly the same data at the same time.”

Yes, that way nobody would be studying old news.

But then you’d have a congestion problem in your database. The reports you ran would compete for memory and CPU cycles against the reports that all the other analysts were running. And all those reports would compete against the transactions of customers who pay your salary and keep the lights on.

Data replication is a more efficient, more elegant solution for putting nearly real-time data in front of the analysts who can take action on it.

Upgrades and migrations

The argument for replication is different in the data center, where IT administrators are trying to perform a migration or an upgrade. There, the pressure comes not from the need to run reports but from the need for business continuity. Customers and users don’t care that there’s a migration or upgrade going on; they want full access to the data without interruption.

“No problem,” you say. “When we migrate/upgrade, we can back up our databases and restore them to the target. Once we have all our data in two places, we’ll start the migration/upgrade. Then, as soon as it’s finished, we’ll point all our users to the new environment.”

But what about all the transactions that have been changed and added in the meantime? It will take you a while to bring the new environment into sync with the old one. And what will you do if there are problems in the new environment? You’ll have to roll things back to where they were before, then try again. That’s not business continuity — that’s business on-again-off-again.

Data replication lets you maintain an accurate, real-time copy of production data to upgrade and migrate databases without risk. It keeps source and target in sync until testing is complete when you can confidently switch users over to the new, upgraded environment.

High availability and disaster recovery

Database administrators are responsible for ensuring databases run smoothly while keeping an eye on high availability, disaster recovery and the five nines of uptime. Unscheduled downtime results in the loss of service, data, money and customers, so the job is all about keeping multiple databases and platforms running efficiently. High availability ensures the data is always there for users, and disaster recovery is the big backstop in case the data suddenly isn’t there.

“Our database includes native tools for high availability,” you say, “And we use another tool to keep remote copies running for disaster recovery. That’s how we have our data in more than one place.”

Native tools are often expensive for the limited functionality they provide and some still have a single point of failure—a shared database. If something happens to that database, your systems will be down while you recover. Besides, a copy is not a replica. A copy is a snapshot, and a snapshot of a database is obsolete as soon as a new transaction hits.

A replica, on the other hand, gives you true high availability. Replication means you have databases that can immediately take over for one other in case of failure.

With data replication, you achieve high availability and strengthen disaster recovery. Replication lets you switch users to a secondary system during maintenance or downtime to keep your production data available. Your applications don’t have to wait for you to spin up a copy of an entire disaster recovery database, which means that you won’t lose transactions. Plus, the right high availability product lets you use the same target database for disaster recovery.

Translate transactions into events

In today’s fast-moving business environment, more companies are turning to streaming services, such as Kafka or Azure Event Hub, to track events that are happening in real-time, on either the shop floor or the sales floor. Replication can turn the sales or machine record inserted into your database into an event that can be acted on in real-time, to allow the customer to add a tip or a machine to be serviced.

 

Source: https://blog.quest.com/data-replication-what-is-it-and-what-are-the-advantages-of-using-it/

 

About DT Asia

DT Asia began in 2007 with a clear mission to build the market entry for various pioneering IT security solutions from the US, Europe and Israel.

Today, DT Asia is a regional, value-added distributor of cybersecurity solutions providing cutting-edge technologies to key government organisations and top private sector clients including global banks and Fortune 500 companies. We have offices and partners around the Asia Pacific to better understand the markets and deliver localised solutions.