<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Coder Legion - Recent posts tagged hybrid-cloud</title>
<link>https://coderlegion.com/tag/hybrid-cloud</link>
<description>Powered by Question2Answer</description>
<item>
<title>MySQL HeatWave: Replicating to MySQL Server (Outbound Replication)</title>
<link>https://coderlegion.com/7712/mysql-heatwave-replicating-to-mysql-server-outbound-replication</link>
<description>&lt;p&gt;Outbound replication enables you to copy data from a MySQL HeatWave DB system to external MySQL instances, supporting data distribution, disaster recovery, and hybrid cloud architectures. Unlike inbound replication where HeatWave acts as the replica, outbound replication positions HeatWave as the source, allowing you to replicate data to on-premises servers, cloud compute instances, or other DB systems.&lt;/p&gt;
&lt;p&gt;This guide covers outbound replication scenarios, configuration, prerequisites, and best practices.&lt;/p&gt;
&lt;h3 id=&quot;what-is-outbound-replication-&quot;&gt;What is Outbound Replication?&lt;/h3&gt;
&lt;p&gt;Outbound replication uses a replication channel to copy transactions from a DB system to another location asynchronously. A channel connects the source DB system (HeatWave) to a replica database (external MySQL instance or another DB system), copying data changes from source to replica.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Key Characteristics&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Source&lt;/strong&gt;: MySQL HeatWave DB system&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Replica&lt;/strong&gt;: External MySQL instance or another DB system&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Asynchronous&lt;/strong&gt;: Replica doesn't need constant connection&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Channel Configuration&lt;/strong&gt;: Always configured on the replica&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Scale-Out&lt;/strong&gt;: Enables read scaling by distributing load&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Important&lt;/strong&gt;: You can configure only a DB system as the source; you cannot configure a read replica as the source.&lt;/p&gt;
&lt;h3 id=&quot;supported-outbound-replication-scenarios&quot;&gt;Supported Outbound Replication Scenarios&lt;/h3&gt;
&lt;p&gt;MySQL HeatWave supports three primary outbound replication scenarios. In all scenarios, the replica must be the same version as, or a higher version of MySQL than, the DB system source.&lt;/p&gt;
&lt;h4 id=&quot;1-db-system-to-on-premises-mysql-instance&quot;&gt;1. DB System to On-Premises MySQL Instance&lt;/h4&gt;
&lt;p&gt;Replicate from a DB system to an on-premises MySQL server.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Use Cases&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Data repatriation from cloud&lt;/li&gt;
&lt;li&gt;Hybrid cloud architectures&lt;/li&gt;
&lt;li&gt;Local reporting and analytics&lt;/li&gt;
&lt;li&gt;Disaster recovery to on-premises&lt;/li&gt;
&lt;li&gt;Compliance requirements for local data&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;2-db-system-to-mysql-on-cloud-compute&quot;&gt;2. DB System to MySQL on Cloud Compute&lt;/h4&gt;
&lt;p&gt;Replicate to a MySQL instance installed on OCI compute instance or other cloud providers (AWS, Azure, GCP).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Use Cases&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Custom MySQL configurations not available in managed service&lt;/li&gt;
&lt;li&gt;Testing new MySQL versions&lt;/li&gt;
&lt;li&gt;Migration staging environments&lt;/li&gt;
&lt;li&gt;Cross-cloud data distribution&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;3-db-system-to-db-system&quot;&gt;3. DB System to DB System&lt;/h4&gt;
&lt;p&gt;Replicate from one DB system to another DB system, both on OCI.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Use Cases&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Cross-region replication&lt;/li&gt;
&lt;li&gt;Data distribution across geographies&lt;/li&gt;
&lt;li&gt;Reporting replicas&lt;/li&gt;
&lt;li&gt;Development/test environment refresh&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Prior to MySQL 8.3.0-u2, you cannot perform outbound replication from a DB system with MySQL HeatWave Lakehouse enabled. As of MySQL 8.3.0-u2+, outbound replication is supported with Lakehouse, but Lakehouse tables can only replicate to replica DB systems, not external replicas.&lt;/p&gt;
&lt;h3 id=&quot;outbound-vs-inbound-replication&quot;&gt;Outbound vs. Inbound Replication&lt;/h3&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;Aspect &lt;/th&gt;&lt;th&gt;Outbound Replication &lt;/th&gt;&lt;th&gt;Inbound Replication&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Source&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;HeatWave DB System &lt;/td&gt;&lt;td&gt;External MySQL or DB System&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Replica&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;External MySQL or DB System &lt;/td&gt;&lt;td&gt;HeatWave DB System&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Channel Config&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;On replica &lt;/td&gt;&lt;td&gt;In HeatWave Service&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Use Case&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;Data out of cloud &lt;/td&gt;&lt;td&gt;Data into cloud&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Management&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;Manual on replica &lt;/td&gt;&lt;td&gt;Managed in OCI Console&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&quot;prerequisites-for-outbound-replication&quot;&gt;Prerequisites for Outbound Replication&lt;/h3&gt;
&lt;h4 id=&quot;source-db-system-requirements&quot;&gt;Source DB System Requirements&lt;/h4&gt;
&lt;h5 id=&quot;1-active-db-system&quot;&gt;1. Active DB System&lt;/h5&gt;
&lt;p&gt;An active MySQL HeatWave DB system must be available as the replication source.&lt;/p&gt;
&lt;h5 id=&quot;2-binary-logging-enabled&quot;&gt;2. Binary Logging Enabled&lt;/h5&gt;
&lt;p&gt;Binary logging is enabled by default on all DB systems. Verify:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;-- On source DB system
SHOW VARIABLES LIKE 'log_bin';
&lt;/code&gt;&lt;/pre&gt;
&lt;h5 id=&quot;3-row-based-replication&quot;&gt;3. Row-Based Replication&lt;/h5&gt;
&lt;p&gt;Row-based binary logging must be enabled (default):&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;SHOW VARIABLES LIKE 'binlog_format';
-- Should return: ROW
&lt;/code&gt;&lt;/pre&gt;
&lt;h5 id=&quot;4-gtid-mode-enabled-recommended-&quot;&gt;4. GTID Mode Enabled (Recommended)&lt;/h5&gt;
&lt;p&gt;GTID mode is disabled by default on DB systems but strongly recommended for outbound replication.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why GTID Matters&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Simplifies replication setup with auto-positioning&lt;/li&gt;
&lt;li&gt;Easier failover and recovery&lt;/li&gt;
&lt;li&gt;Better tracking of transactions&lt;/li&gt;
&lt;li&gt;Reduces configuration complexity&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: GTID mode is a compatibility option you must consider when creating your DB system.&lt;/p&gt;
&lt;h5 id=&quot;5-replication-user-account&quot;&gt;5. Replication User Account&lt;/h5&gt;
&lt;p&gt;Create a dedicated replication user on the source DB system with required privileges.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Create replication user&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;-- Connect to source DB system
CREATE USER 'repl_user'@'%' 
  IDENTIFIED BY 'SecurePassword123!' 
  REQUIRE SSL;

GRANT REPLICATION SLAVE ON *.* TO 'repl_user'@'%';
FLUSH PRIVILEGES;
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&quot;replica-mysql-server-requirements&quot;&gt;Replica MySQL Server Requirements&lt;/h4&gt;
&lt;h5 id=&quot;1-mysql-version-compatibility&quot;&gt;1. MySQL Version Compatibility&lt;/h5&gt;
&lt;p&gt;The replica must be the same version as, or a higher version than, the DB system source. For example, you can replicate from MySQL 8.0 to MySQL 8.4, but not from MySQL 8.4 to MySQL 8.0.&lt;/p&gt;
&lt;h5 id=&quot;2-compatible-configuration-options&quot;&gt;2. Compatible Configuration Options&lt;/h5&gt;
&lt;p&gt;The replica must have matching configuration for certain system variables:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;lowercase_table_names&lt;/strong&gt;: The source and replica must run with the same &lt;code&gt;lower_case_table_names&lt;/code&gt; system variable value (0, 1, or 2).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Enable Partial Revoke&lt;/strong&gt; (if used on source): If your source DB system uses partial revokes, the replica must also have this enabled:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;-- On replica
SET GLOBAL partial_revokes = ON;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;GTID Mode&lt;/strong&gt; (recommended): If source uses GTID, replica should have GTID enabled:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;-- On replica
SET GLOBAL enforce_gtid_consistency = ON;
SET GLOBAL gtid_mode = OFF_PERMISSIVE;
SET GLOBAL gtid_mode = ON_PERMISSIVE;
SET GLOBAL gtid_mode = ON;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Timezone Information Loaded&lt;/strong&gt;: If your source DB system uses named timezones, load timezone information on the replica:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;# On replica server
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
&lt;/code&gt;&lt;/pre&gt;
&lt;h5 id=&quot;3-bi-directional-communication-enabled&quot;&gt;3. Bi-Directional Communication Enabled&lt;/h5&gt;
&lt;p&gt;The replica must be able to connect to the source DB system:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Network path exists (VPN, FastConnect, direct connectivity)&lt;/li&gt;
&lt;li&gt;Firewall rules allow MySQL port (3306)&lt;/li&gt;
&lt;li&gt;Security lists/NSGs permit traffic&lt;/li&gt;
&lt;/ul&gt;
&lt;h5 id=&quot;4-row-based-binary-logging&quot;&gt;4. Row-Based Binary Logging&lt;/h5&gt;
&lt;p&gt;The replica should also use row-based replication:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;SET GLOBAL binlog_format = 'ROW';
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;network-connectivity-options&quot;&gt;Network Connectivity Options&lt;/h3&gt;
&lt;h4 id=&quot;connecting-external-mysql-to-heatwave-source&quot;&gt;Connecting External MySQL to HeatWave Source&lt;/h4&gt;
&lt;p&gt;For external MySQL servers replicating FROM HeatWave, establish connectivity:&lt;/p&gt;
&lt;h5 id=&quot;option-1-network-load-balancer&quot;&gt;Option 1: Network Load Balancer&lt;/h5&gt;
&lt;p&gt;Set up a Network Load Balancer to provide external access to the DB system:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Steps&lt;/strong&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create Network Security Group allowing access from replica IP&lt;/li&gt;
&lt;li&gt;Configure LB Listener (add NSG)&lt;/li&gt;
&lt;li&gt;Configure LB Backend&lt;/li&gt;
&lt;li&gt;Specify Health Check Policy&lt;/li&gt;
&lt;li&gt;Configure backend to access MySQL source&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Security&lt;/strong&gt;: Enforce SSL/TLS for all connections.&lt;/p&gt;
&lt;h5 id=&quot;option-2-site-to-site-vpn&quot;&gt;Option 2: Site-to-Site VPN&lt;/h5&gt;
&lt;p&gt;For on-premises replicas:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;IPSec VPN tunnel over internet&lt;/li&gt;
&lt;li&gt;Encrypted connectivity&lt;/li&gt;
&lt;li&gt;Up to 250 Mbps per tunnel&lt;/li&gt;
&lt;/ul&gt;
&lt;h5 id=&quot;option-3-fastconnect&quot;&gt;Option 3: FastConnect&lt;/h5&gt;
&lt;p&gt;For production on-premises replicas:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Dedicated private connection&lt;/li&gt;
&lt;li&gt;Up to 10 Gbps bandwidth&lt;/li&gt;
&lt;li&gt;Predictable performance&lt;/li&gt;
&lt;li&gt;Lower latency&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;loading-initial-data-from-db-system-to-mysql-server&quot;&gt;Loading Initial Data from DB System to MySQL Server&lt;/h3&gt;
&lt;p&gt;Before starting replication, export existing data from the source to the replica.&lt;/p&gt;
&lt;h4 id=&quot;step-1-export-data-from-source-db-system&quot;&gt;Step 1: Export Data from Source DB System&lt;/h4&gt;
&lt;p&gt;Use MySQL Shell Instance Dump utility to export data:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;mysqlsh admin@&amp;lt;DB_SYSTEM_IP&amp;gt;:3306 -- util dump-instance /path/to/dump \
  --excludeSchemas=mysql,sys,performance_schema,information_schema \
  --ocimds=true
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;What This Exports&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;All user schemas and data&lt;/li&gt;
&lt;li&gt;User accounts and privileges&lt;/li&gt;
&lt;li&gt;GTID executed position&lt;/li&gt;
&lt;li&gt;Excludes system schemas&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Why Exclude System Schemas&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;System schemas managed differently&lt;/li&gt;
&lt;li&gt;Prevents replication conflicts&lt;/li&gt;
&lt;li&gt;User accounts can be recreated separately&lt;/li&gt;
&lt;li&gt;Best practice for replication setup&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Important&lt;/strong&gt;: If using GTID-based replication, capture the value of the source server's system variable &lt;code&gt;gtid_executed&lt;/code&gt; from the dump metadata.&lt;/p&gt;
&lt;h4 id=&quot;step-2-import-data-into-replica-mysql-server&quot;&gt;Step 2: Import Data into Replica MySQL Server&lt;/h4&gt;
&lt;p&gt;Import the dump into your replica MySQL instance:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;mysqlsh admin@&amp;lt;REPLICA_IP&amp;gt;:3306 -- util load-dump /path/to/dump \
  --includeSchemas=&amp;lt;schema_list&amp;gt; \
  --progressFile=/path/to/progress.json
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Import User Accounts&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;mysqlsh admin@&amp;lt;REPLICA_IP&amp;gt;:3306 -- util load-dump /path/to/dump \
  --includeUsers=true \
  --excludeUsers=admin,root
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&quot;step-3-update-gtid-purged-settings&quot;&gt;Step 3: Update gtid_purged Settings&lt;/h4&gt;
&lt;p&gt;If using GTID-based replication, set gtid_purged on the replica:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;-- On replica
RESET MASTER;
SET GLOBAL gtid_purged='&amp;lt;gtid_executed_value&amp;gt;';
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;SET GLOBAL gtid_purged='3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5';
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;configuring-outbound-replication-channel&quot;&gt;Configuring Outbound Replication Channel&lt;/h3&gt;
&lt;p&gt;The replication channel is always configured on the replica (not in HeatWave Service for outbound replication).&lt;/p&gt;
&lt;h4 id=&quot;configuration-parameters&quot;&gt;Configuration Parameters&lt;/h4&gt;
&lt;h5 id=&quot;source-connection-settings&quot;&gt;Source Connection Settings&lt;/h5&gt;
&lt;p&gt;&lt;strong&gt;source_host&lt;/strong&gt;: IP address or hostname of the source DB system&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;SOURCE_HOST='10.0.1.100'
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;source_port&lt;/strong&gt;: MySQL port (default 3306)&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;SOURCE_PORT=3306
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;source_user&lt;/strong&gt;: Replication user account&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;SOURCE_USER='repl_user'
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;source_password&lt;/strong&gt;: Replication user password&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;SOURCE_PASSWORD='SecurePassword123!'
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;source_ssl&lt;/strong&gt;: Enable SSL/TLS (recommended)&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;SOURCE_SSL=1
&lt;/code&gt;&lt;/pre&gt;
&lt;h5 id=&quot;replication-positioning&quot;&gt;Replication Positioning&lt;/h5&gt;
&lt;p&gt;&lt;strong&gt;GTID Auto-Positioning&lt;/strong&gt; (recommended):&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;SOURCE_AUTO_POSITION=1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Manual Binary Log Positioning&lt;/strong&gt; (if GTID not used):&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;SOURCE_LOG_FILE='mysql-bin.000003'
SOURCE_LOG_POS=154
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&quot;setting-up-the-replication-channel&quot;&gt;Setting Up the Replication Channel&lt;/h4&gt;
&lt;p&gt;Connect to the replica MySQL server and run:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;-- Using GTID auto-positioning (recommended)
CHANGE REPLICATION SOURCE TO
  SOURCE_HOST='&amp;lt;DB_SYSTEM_IP&amp;gt;',
  SOURCE_PORT=3306,
  SOURCE_USER='repl_user',
  SOURCE_PASSWORD='SecurePassword123!',
  SOURCE_SSL=1,
  SOURCE_AUTO_POSITION=1;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Without GTID&lt;/strong&gt; (manual positioning):&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;CHANGE REPLICATION SOURCE TO
  SOURCE_HOST='&amp;lt;DB_SYSTEM_IP&amp;gt;',
  SOURCE_PORT=3306,
  SOURCE_USER='repl_user',
  SOURCE_PASSWORD='SecurePassword123!',
  SOURCE_SSL=1,
  SOURCE_LOG_FILE='mysql-bin.000003',
  SOURCE_LOG_POS=154;
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&quot;starting-replication&quot;&gt;Starting Replication&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;START REPLICA;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or for older MySQL versions:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;START SLAVE;
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;managing-replication&quot;&gt;Managing Replication&lt;/h3&gt;
&lt;h4 id=&quot;checking-replication-status&quot;&gt;Checking Replication Status&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;SHOW REPLICA STATUS\G
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Key Metrics&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Replica_IO_Running&lt;/code&gt;: Should be &quot;Yes&quot;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Replica_SQL_Running&lt;/code&gt;: Should be &quot;Yes&quot;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Seconds_Behind_Source&lt;/code&gt;: Replication lag&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Last_IO_Error&lt;/code&gt;: IO thread errors&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Last_SQL_Error&lt;/code&gt;: SQL thread errors&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;stopping-replication&quot;&gt;Stopping Replication&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;STOP REPLICA;
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&quot;resetting-replication&quot;&gt;Resetting Replication&lt;/h4&gt;
&lt;p&gt;&lt;strong&gt;Warning&lt;/strong&gt;: This clears all replication position data.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;STOP REPLICA;
RESET REPLICA ALL;
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&quot;reconfiguring-the-channel&quot;&gt;Reconfiguring the Channel&lt;/h4&gt;
&lt;p&gt;To change replication settings:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;STOP REPLICA;

CHANGE REPLICATION SOURCE TO
  SOURCE_HOST='&amp;lt;NEW_IP&amp;gt;',
  SOURCE_USER='&amp;lt;NEW_USER&amp;gt;',
  -- other parameters
  SOURCE_AUTO_POSITION=1;

START REPLICA;
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;monitoring-replication&quot;&gt;Monitoring Replication&lt;/h3&gt;
&lt;h4 id=&quot;using-performance-schema&quot;&gt;Using Performance Schema&lt;/h4&gt;
&lt;p&gt;Query replication metrics:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;-- Connection status
SELECT * FROM performance_schema.replication_connection_status\G

-- Applier status
SELECT * FROM performance_schema.replication_applier_status\G

-- Worker threads
SELECT * FROM performance_schema.replication_applier_status_by_worker\G
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&quot;setting-up-alerts&quot;&gt;Setting Up Alerts&lt;/h4&gt;
&lt;p&gt;Monitor these critical metrics:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Replication lag exceeding threshold (e.g., 60 seconds)&lt;/li&gt;
&lt;li&gt;IO or SQL thread stopped&lt;/li&gt;
&lt;li&gt;Replication errors&lt;/li&gt;
&lt;li&gt;Connection failures&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;using-database-management&quot;&gt;Using Database Management&lt;/h4&gt;
&lt;p&gt;If your replica is also a DB system on OCI, use Database Management to monitor:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Active connections&lt;/li&gt;
&lt;li&gt;Statement count&lt;/li&gt;
&lt;li&gt;Fetch state&lt;/li&gt;
&lt;li&gt;Apply state&lt;/li&gt;
&lt;li&gt;Time behind source&lt;/li&gt;
&lt;li&gt;GTID executed&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;common-outbound-replication-issues&quot;&gt;Common Outbound Replication Issues&lt;/h3&gt;
&lt;h4 id=&quot;issue-1-replica-cannot-connect-to-source&quot;&gt;Issue 1: Replica Cannot Connect to Source&lt;/h4&gt;
&lt;p&gt;&lt;strong&gt;Error&lt;/strong&gt;: &quot;Can't connect to MySQL server on ''&quot;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Causes&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Network Load Balancer not configured&lt;/li&gt;
&lt;li&gt;Security lists blocking traffic&lt;/li&gt;
&lt;li&gt;VPN/FastConnect not established&lt;/li&gt;
&lt;li&gt;Wrong IP or hostname&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Solutions&lt;/strong&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify Network Load Balancer configuration&lt;/li&gt;
&lt;li&gt;Check security lists allow port 3306&lt;/li&gt;
&lt;li&gt;Test connectivity: &lt;code&gt;telnet &amp;lt;DB_SYSTEM_IP&amp;gt; 3306&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Verify VPN/FastConnect is active&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id=&quot;issue-2-authentication-failures&quot;&gt;Issue 2: Authentication Failures&lt;/h4&gt;
&lt;p&gt;&lt;strong&gt;Error&lt;/strong&gt;: &quot;Access denied for user 'repl_user'@''&quot;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Causes&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Replication user not created on source&lt;/li&gt;
&lt;li&gt;Wrong credentials&lt;/li&gt;
&lt;li&gt;User not allowed from replica IP&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Solutions&lt;/strong&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify user exists on source: &lt;code&gt;SELECT User, Host FROM mysql.user WHERE User = 'repl_user';&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Check credentials are correct&lt;/li&gt;
&lt;li&gt;Verify user grants: &lt;code&gt;SHOW GRANTS FOR 'repl_user'@'%';&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id=&quot;issue-3-replication-lag-increasing&quot;&gt;Issue 3: Replication Lag Increasing&lt;/h4&gt;
&lt;p&gt;&lt;strong&gt;Symptoms&lt;/strong&gt;: &lt;code&gt;Seconds_Behind_Source&lt;/code&gt; growing&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Causes&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;High transaction volume on source&lt;/li&gt;
&lt;li&gt;Replica underpowered&lt;/li&gt;
&lt;li&gt;Network bandwidth limitations&lt;/li&gt;
&lt;li&gt;Large transactions&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Solutions&lt;/strong&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Increase replica resources&lt;/li&gt;
&lt;li&gt;Optimize slow queries&lt;/li&gt;
&lt;li&gt;Check network bandwidth&lt;/li&gt;
&lt;li&gt;Break large transactions into batches&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id=&quot;issue-4-ssl-connection-failures&quot;&gt;Issue 4: SSL Connection Failures&lt;/h4&gt;
&lt;p&gt;&lt;strong&gt;Error&lt;/strong&gt;: SSL-related errors in replication status&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Causes&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;SSL not configured on source&lt;/li&gt;
&lt;li&gt;Certificate issues&lt;/li&gt;
&lt;li&gt;Wrong SSL mode&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Solutions&lt;/strong&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify source supports SSL&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;SOURCE_SSL=1&lt;/code&gt; for encrypted connection&lt;/li&gt;
&lt;li&gt;Check certificate validity if using certificate verification&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;best-practices&quot;&gt;Best Practices&lt;/h3&gt;
&lt;h4 id=&quot;1-always-use-gtid-mode&quot;&gt;1. Always Use GTID Mode&lt;/h4&gt;
&lt;p&gt;Enable GTID on both source and replica for simplified management:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Easier failover&lt;/li&gt;
&lt;li&gt;Automatic position tracking&lt;/li&gt;
&lt;li&gt;Simplified reconfiguration&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;2-enforce-ssl-tls-encryption&quot;&gt;2. Enforce SSL/TLS Encryption&lt;/h4&gt;
&lt;p&gt;Always encrypt replication traffic:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;CREATE USER 'repl_user'@'%' 
  IDENTIFIED BY 'SecurePassword!' 
  REQUIRE SSL;
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&quot;3-monitor-replication-lag&quot;&gt;3. Monitor Replication Lag&lt;/h4&gt;
&lt;p&gt;Set up alerts for:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Lag &amp;gt; 60 seconds&lt;/li&gt;
&lt;li&gt;IO or SQL thread stopped&lt;/li&gt;
&lt;li&gt;Replication errors&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;4-use-network-load-balancer&quot;&gt;4. Use Network Load Balancer&lt;/h4&gt;
&lt;p&gt;For production external replicas:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Provides stable endpoint&lt;/li&gt;
&lt;li&gt;Enables health checks&lt;/li&gt;
&lt;li&gt;Supports SSL termination&lt;/li&gt;
&lt;li&gt;Better security controls&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;5-plan-for-network-interruptions&quot;&gt;5. Plan for Network Interruptions&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Use appropriate binary log retention on source&lt;/li&gt;
&lt;li&gt;Monitor relay log space on replica&lt;/li&gt;
&lt;li&gt;Test reconnection scenarios&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;6-regular-health-checks&quot;&gt;6. Regular Health Checks&lt;/h4&gt;
&lt;p&gt;Implement automated checks:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;#!/bin/bash
# Check replication health
REPLICA_STATUS=$(mysql -e &quot;SHOW REPLICA STATUS\G&quot; | grep &quot;Replica_.*_Running:&quot; | awk '{print $2}')
if [[ &quot;$REPLICA_STATUS&quot; != &quot;Yes&quot; ]]; then
  echo &quot;Replication issue detected&quot;
  # Send alert
fi
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&quot;7-test-failover-procedures&quot;&gt;7. Test Failover Procedures&lt;/h4&gt;
&lt;p&gt;Regularly test:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Stopping and starting replication&lt;/li&gt;
&lt;li&gt;Switching to different source&lt;/li&gt;
&lt;li&gt;Replica promotion scenarios&lt;/li&gt;
&lt;li&gt;Application behavior during failures&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;8-document-configuration&quot;&gt;8. Document Configuration&lt;/h4&gt;
&lt;p&gt;Maintain documentation of:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Source and replica connection details&lt;/li&gt;
&lt;li&gt;Replication user credentials&lt;/li&gt;
&lt;li&gt;Network paths used&lt;/li&gt;
&lt;li&gt;Failover procedures&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;limitations-for-outbound-replication&quot;&gt;Limitations for Outbound Replication&lt;/h3&gt;
&lt;h4 id=&quot;lakehouse-table-restrictions&quot;&gt;Lakehouse Table Restrictions&lt;/h4&gt;
&lt;p&gt;Lakehouse tables can only replicate to replica DB systems. Replicating Lakehouse tables to external replicas (on-premises MySQL) causes replication to break with errors.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Workaround&lt;/strong&gt;: Exclude Lakehouse tables from replication or only replicate to DB system replicas.&lt;/p&gt;
&lt;h4 id=&quot;prior-to-mysql-8-3-0-u2&quot;&gt;Prior to MySQL 8.3.0-u2&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Cannot perform outbound replication from a DB system with HeatWave Lakehouse enabled&lt;/li&gt;
&lt;li&gt;Cannot enable Lakehouse on HA DB system with HeatWave cluster&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;read-replicas-as-source&quot;&gt;Read Replicas as Source&lt;/h4&gt;
&lt;p&gt;You cannot configure a read replica as the source for outbound replication. Only the primary DB system can serve as the replication source.&lt;/p&gt;
&lt;p&gt;Outbound replication from MySQL HeatWave enables flexible data distribution strategies, supporting hybrid cloud architectures, disaster recovery, and read scaling scenarios. By understanding configuration requirements, network connectivity options, and best practices, you can implement reliable outbound replication for your specific needs.&lt;/p&gt;
&lt;p&gt;Key takeaways:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Source is HeatWave&lt;/strong&gt;: DB system acts as replication source&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Channel on replica&lt;/strong&gt;: Always configure replication on the replica side&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Use GTID&lt;/strong&gt;: Simplifies setup and management&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Encrypt traffic&lt;/strong&gt;: Always use SSL/TLS&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Network connectivity&lt;/strong&gt;: Use NLB, VPN, or FastConnect for external replicas&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Monitor continuously&lt;/strong&gt;: Track lag, errors, and thread status&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Version compatibility&lt;/strong&gt;: Replica must be same or higher MySQL version&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Whether replicating to on-premises servers, cloud compute instances, or other DB systems, MySQL HeatWave outbound replication provides the flexibility needed for modern distributed architectures.&lt;/p&gt;
</description>
<category>mysql</category>
<guid isPermaLink="true">https://coderlegion.com/7712/mysql-heatwave-replicating-to-mysql-server-outbound-replication</guid>
<pubDate>Mon, 24 Nov 2025 09:16:13 +0000</pubDate>
</item>
</channel>
</rss>