Quantcast
Channel: StackExchange Replication Questions
Viewing all 17268 articles
Browse latest View live

MySQL Replication - 1 Master - 2 Slaves. Inserting works for One, not the other

$
0
0

I am a Python developer, working with 3 databases, configured in Master -> slave,slave style.

Each slave has their own application associated with it.

I am not too familiar with database administration as it relates to replication, but I do have a working scenario between the Master, and one of the slaves

The first slave stays in synch at all times properly at this time.

The second slave however, fails on the first insert

Table creation queries, user creaiton all replicates fine, but when I input any values, the first slave gets the record, while the second slave does not.

I tried importing the master DB to the second slave, updates to records will replicate, but new records will not.

My research leads me to believe this is an issue with autoincrement but I have not been able to use this to fix the issue. As opposed to a hack and slash method which is not working I figured id ask here.

If there is any more info I can provide, please let me know.

I am on Windows. Using WAMP Server 2.5 (MySQL 5.6.17)

Thanks for reading

EDIT: I am using binlog_format=mixed


SQL Server 2014 Transactional Replication Partition Switching

$
0
0

I am working with SQL Server 2014 Transactional Replication with tables that have partitions. The source tables are partition switched when they are loaded and so far I have been able to replicate this successfully.

The replication source I am working with performs some dynamic partition management by creating partitions on the Partition Function/Partition Scheme during the load into the table. This is not natively supported by Transactional Replication per the documentation found here:

After the Subscriber is initialized, data changes are propagated to the Subscriber and applied to the appropriate partitions. However, changes to the partition scheme are not supported. Transactional and merge replication do not support replicating the following commands: ALTER PARTITION FUNCTION, ALTER PARTITION SCHEME, or the REBUILD WITH PARTITION statement of ALTER INDEX. The changes associated with them will not be automatically replicated to the Subscriber. It is the responsibility of the user to make similar changes manually at the Subscriber.

This is where I am getting hung up. We've worked through most of the problems with the loading and switching of partitions and we are now dynamically creating the new partitions, as they come in, on both the replication source (publisher) and replication target (subscriber) through the use of a stored procedure as part of the load to the publisher. The stored procedure exists on both the publisher and subscriber (manually put there).

When running a test last night, we saw that partitions were dynamically created on the publisher and subscriber, but there was a new error on the Log Reader Agent. At this point, I don't even know where to begin to start tracking this down.

Error messages: The process could not execute 'sp_replcmds' on 'RNCAZFAST2'. (Source: MSSQL_REPL, Error number: MSSQL_REPL20011) Get help: http://help/MSSQL_REPL20011

No catalog entry found for partition ID 72057598976393216 in database 27. The metadata is inconsistent. Run DBCC CHECKDB to check for a metadata corruption. (Source: MSSQLServer, Error number: 608)

I started looking up the error and it looked like it was a bug back in 2005, but we are on SQL Server 2014 Enterprise on an Azure VM. Any help is greatly appreciated!

Syncing data from primary member to secondary after election

$
0
0

Maybe this is kind a stupid question but, I'm novice in configuring replication and I need to clear something before makeing anything else. Moment ago I configured replica set with 3 members in it. It's all working well but I think I don't understand the part about copying data from primary to secondary member of replica set after new election.

Let's say I made one collection in my primary member, after that kill instance of primary member, election has been made and now I have new instance as primary member on example --port 27018. What happend with all data on first instance which I killed? Do I need to make mongodump? Do I need to use some sync method for instant syncing or read the oplog and how to do that? Beacause, I tought that if I made an replSet, and turn on all three instances which are connected, all of them will listening the same oplog and after election update the database, or I'm completly wrong about that and I'm clearly missing some things?

Thank you!

MySQL Semi-synchronous replication with Multi-Master

$
0
0

Is it possible to use semi-synchronous replication with a Multi-Master setup?

I've tried to follow this guide to setup a semi-synchronous replication for a master-slave setup: https://avdeo.com/2015/02/02/semi-synchronous-replication-in-mysql/

But I'm not sure how to implement this on a Multi-Master setup.

There are two plugins: one for the master and one for the slave. Since a Multi-Master act as a Master and Slave, does that mean I have to install both plugins on all servers?

I'm using MySQL 5.7

Changing the Owner of Replication Jobs

$
0
0

Just wondering if there is any gotchas with changing the owner of a sql server replication job. The job owner is currently a domain account, but that person is leaving the company, so the account is soon to be disabled. I am planning on setting the owner to SA, but wanted to check about the replication jobs first.

Very slow merge replication synchronization

$
0
0

I had an unforeseen issue with a sub going down (generic error, was probably a connection issue) and now that I've reconnected the sub it is insanely slow re-syncing. It seems to download about 1000 changes then sit there for about an hour before adding another 1000.

sub snapshot

Any ideas why this is going so slowly? This is just one table of dozens and I feel like this won't catch up before Monday (when I have users meant to be coming online).

Any help is appreciated! Thanks!

UPDATE

It's been running for over 24 hours now and is slowly chewing through the records but at a still very slow pace. It now toggles between the shot above and 'Enumerating changes in filtered articles using Subscriber's assigned partition ID'. Yes, there is a filter in place but it's been there since I first set up replication and has never caused an issue before.

SECOND UPDATE

When I go into Replication Monitor there is an error:

The replication agent has not logged a progress message in 10 minutes. This might indicate an unresponsive agent or high system activity. Verify that records are being replicated to the destination and that connections to the Subscriber, Publisher, and Distributor are still active.

But what is strange is that there is zero system activity and I have another subscriber on this publication working as well a secondary replication from the same publisher to the same subscriber that is working perfectly. I've tried stopping and restarting, taking and applying a fresh snapshot but nothing seems to work. There are no blocked processes, no active queries that are deadlocking or anything else I can think to check.

To be clear:

  • Publication A => Sub 1: WORKING
  • Publication A => Sub 2: NOT WORKING
  • Publication B => Sub 1: WORKING
  • Publication B => Sub 2: WORKING

If anyone has any help, I'd much appreciate it.

MySQL replication on slave server Broken/Stopped without error

$
0
0

(Hi; sorry for my English) My question is: how can I restart MySQL replication on a slave server. At first sight everything seems to be normal but when I check with

SHOW SLAVE STATUS\G

besides Relay_Log_Space, Read_Master_Log_Pos and Seconds_Behind_Master which continue to increase. Other data remain fixed for several days. I tried STOP/START SLAVE; but nothing has changed.

root@localhost [mysql]> SHOW SLAVE STATUS\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: x.x.x.x
                  Master_User: slave_replicator
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000103
          Read_Master_Log_Pos: 197827259
               Relay_Log_File: mysql-relay-bin.000002
                Relay_Log_Pos: 149672940
        Relay_Master_Log_File: mysql-bin.000029
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB:
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: 0
                   Last_Error:
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 305160334
              Relay_Log_Space: 65277287216
              Until_Condition: None
               Until_Log_File:
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File:
           Master_SSL_CA_Path:
              Master_SSL_Cert:
            Master_SSL_Cipher:
               Master_SSL_Key:
        Seconds_Behind_Master: 1724670
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 0
               Last_SQL_Error:
  Replicate_Ignore_Server_Ids:
             Master_Server_Id: 3464562
                  Master_UUID: 727b7e74-325f-11e6-9b54-faa1cd739fa9
             Master_Info_File: /var/lib/mysql/master.info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: Reading event from the relay log
           Master_Retry_Count: 86400
                  Master_Bind:
      Last_IO_Error_Timestamp:
     Last_SQL_Error_Timestamp:
               Master_SSL_Crl:
           Master_SSL_Crlpath:
           Retrieved_Gtid_Set:
            Executed_Gtid_Set:
                Auto_Position: 0

SQL Server Replication Local Subscription Properties returns "Cannot apply value ‘null’ to property ServerInstance: Value cannot be null."

$
0
0

I am replicating a SQL 2008 R2 database to a SQL 2016 database.

When I connect to the SQL 2016 database using SSMS, and in Object Explorer select Replication->Local Subscription->MySubscription then right click and select Properties I get the error "Cannot apply value ‘null’ to property ServerInstance: Value cannot be null.".

What does it mean and how can I fix it? I am logged in using my Windows domain user which is a sysadmin on both systems.


How to know if MySQL replication is working?

$
0
0

I am replicating from a MySQL v 5.5.50 master, to a MySQL v 5.5.46 slave hosted in RDS. I've followed the AWS documentation on how to do this to the letter, got the dump file imported into the slave server and ran the CALL mysql.rds_set_external_master... command to begin things a few days ago.

My SHOW MASTER STATUS; result is:

+---------------------+----------+--------------+------------------+
| File                | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+---------------------+----------+--------------+------------------+
| mysql-binlog.000023 | 48684053 |              |                  |
+---------------------+----------+--------------+------------------+
1 row in set (0.00 sec)

And my SHOW SLAVE STATUS \G; result is:

*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: [master host IP here]
                  Master_User: [local replication user here]
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-binlog.000023
          Read_Master_Log_Pos: 53052514
               Relay_Log_File: relaylog.000007
                Relay_Log_Pos: 81145300
        Relay_Master_Log_File: mysql-binlog.000017
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB:
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table: mysql.rds_sysinfo,mysql.rds_history,mysql.rds_replication_status
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: 0
                   Last_Error:
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 1016905328
              Relay_Log_Space: 5695987840
              Until_Condition: None
               Until_Log_File:
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File:
           Master_SSL_CA_Path:
              Master_SSL_Cert:
            Master_SSL_Cipher:
               Master_SSL_Key:
        Seconds_Behind_Master: 394467
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 0
               Last_SQL_Error:
  Replicate_Ignore_Server_Ids:
             Master_Server_Id: 21033229
1 row in set (0.12 sec)

And finally, the only two relevant lines (that aren't SLEEP from my client) visible in SHOW FULL PROCESSLIST; are:

*************************** 2. row ***************************
     Id: 207
   User: system user
   Host:
     db: NULL
Command: Connect
   Time: 361292
  State: Waiting for master to send event
   Info: NULL
*************************** 3. row ***************************
     Id: 208
   User: system user
   Host:
     db: NULL
Command: Connect
   Time: 394904
  State: Reading event from the relay log
   Info: NULL

I'm trying to confirm whether or not things are actually replicating, because the Seconds_Behind_Master value is getting bigger and bigger. However, the Master_Log_File value has gone up to match that of the master.

Exec_Master_Log_Pos and Relay_Log_Pos haven't changed in a long* time. However, Read_Master_Log_Pos is growing all the time.

I find no errors in the log files that RDS provides to me, no warnings or errors when the process started.

Is there a way I can tell if there has been some kind of error, and how can I look to recover from it?

(* Not 100% sure on how long that is, but measured in hours, not seconds)

UPDATE

I ran a slave stop and then slave start command, and in the log, I got the following:

160817 10:39:04 [Note] Slave SQL thread exiting, replication stopped in log 'mysql-binlog.000018' at position 72335184
160817 10:39:04 [ERROR] Error reading packet from server: Lost connection to MySQL server during query ( server_errno=2013)
160817 10:39:04 [Note] Slave I/O thread killed while reading event
160817 10:39:04 [Note] Slave I/O thread exiting, read up to log 'mysql-binlog.000025', position 74416238
160817 10:39:22 [Note] Slave SQL thread initialized, starting replication in log 'mysql-binlog.000018' at position 72335184, relay log '/rdsdbdata/log/relaylog/relaylog.000010' position: 72335333
160817 10:39:22 [Note] Slave I/O thread: connected to master '[replication user]@[server ip]:3306',replication started in log 'mysql-binlog.000025' at position 74416238

So nothing untoward there that I can see. The Seconds_Behind_Master is still going up and still no individual commands are displaying in my process list etc.

Attunity high latency and SQL Server blocking query [on hold]

$
0
0

We have recently implemented an Attunity replication between 2 servers (From Oracle -> to MSSQL).

Sometimes, we are facing high latency / incoming changes between the 2 servers.

enter image description here

and most of the time we can observe (on SQL Server) a query from attunity program, on a specific table, blocking users queries :

enter image description hereenter image description here

When the query complete, there is no more latency between servers.

According to sp_woisactive, the query is in RUNNABLE state. Trying to start a select on the lock table, my query is blocked, waiting for the attunity query to end.

If we stop attunity replication, the query end and all other transactions runs fines.

Have you Any ideas why this query is taking so much time ? How can I diagnostic this ? it's just a delete on a specific id. Moreover, Indexes are all up to date and there is no fragmentation.

Backing up Master-Master replicated MySQL databases

$
0
0

I have two MySQL 5.5 databases which replicate each other. What's the best way to back these machines up? I would like to prioritise speed/ease of restoration. Should I add extra slaves to both machines and also replicate there, and then periodically stop those slaves and copy the data somehow? Is a mysqldump enough, or should I be copying the whole data directory somehow?

Large MYSQL DB on single file

$
0
0

I have a large MYSQL innodb database (115GB) running on single file mode in MySQL server.

I NEED to move this to file per table mode to allow me to optimize and reduce the overall DB size.

Im looking at various options to do this, but my problem falls in there only being a small window of downtime (roughly 5 hours).

  1. Setup a clone of the server as a slave. Set the slave up with file_per_table, take a mysqldump from the main DB, run in the slave and have this replicating.

I will then look to fail over to the slave.

  1. The other option is the usual mysqldump, drop DB and then import.

My concern is around the time to take the mysqldump and the quality of the dump being such a large size. I have BLOB data in the DB also.

Can anyone offer advise on a good approach?

Thanks

Create User, Tablespace Replication in Oracle GoldenGate

$
0
0

How to replicate - Create User, Procedure and Tablespace using Oracle GoldenGate.

I am able to replicate DDL under schema, however above is not getting replicated i.e. when I create an user, procedure or tablespace.

GoldenGate Version - 12.2.0.1 Database Version - 11.2.0.4

Extract Conf:

GGSCI (sourceGG) 36> view params ext4

extract ext4
userid ogguser, password ogguser
exttrail /u01/app/oracle/product/11.2.0.4/oggsrc/dirdat/mt
DDL INCLUDE ALL
table ogguser.*;

GGSCI (sourceGG) 37>

Dump Conf:

GGSCI (sourceGG) 37> view params dpump2

extract dpump2
userid ogguser, password ogguser
rmthost targetGG, mgrport 7809
rmttrail /u01/app/oracle/product/11.2.0.4/oggtrg/dirdat/pt
passthru
DDL INCLUDE ALL
table ogguser.*;

GGSCI (sourceGG) 38> 

Replicat Conf:

GGSCI (targetGG) 37> view params rep4
replicat rep4
assumetargetdefs
handlecollisions
userid ogguser, password ogguser
DDL INCLUDE ALL
DDLERROR DEFAULT IGNORE RETRYOP
map ogguser.*, target ogguser.*;

GGSCI (targetGG) 38> 

Thanks!

Rows deleted in the subscriber - what to do? - SQL Server Transactional Replication

$
0
0

Someone has delete by mistake a row of a table in the subscribed server/database.

I am getting the following error message:

The row was not found at the Subscriber when applying the replicated (null) command for Table '(null)' with Primary Key(s): (null) (Source: MSSQLServer, Error number: 20598)

Now I have restored the deleted row in the replicated server, but the distributor to the subscriber agent is taking so long to apply the changes (currently nearly 1.5 hours).

How can I make it do this update immediately?

enter image description here

Unable to shrink log file due to transactional replication

$
0
0

I have a transactional replication configured as per below:

ServerA.DBA (pub) --> ServerB.DBB (Sub) 
ServerB.DBB (pub1) --> ServerC.DBC (Sub)  
ServerB.DBB (pub2) --> ServerD.DBD (Sub)
ServerB.DBB (pub3) --> ServerE.DBE (Sub)  
ServerB.DBB (pub4) --> ServerF.DBF (Sub) 
ServerB.DBB (pub5) --> ServerG.DBG (Sub)

Today, I got an alert saying that my replication ServerA.DBA (pub) --> ServerB.DBB (Sub) is failing with below error:

Replication-Replication Distribution Subsystem: agent failed. The transaction log for database is full due to 'REPLICATION'.

Upon investigation, I found that my log file was capped at 100GB on ServerB.DBB which was causing the issue. To fix this, I added a new log file as I was unable to extend the existing log file due to same error. This fixed my issue and replication caught up in some time. However, now I am unable to shrink the log file and it always shows my log file utilization as 99% and increasing. This raised some doubts in my mind whether my replication from Server B to C,D,E,F and G is actually running or not and why I am unable to shrink the log file.

Log_reuse_wait_desc on my ServerB.DBB always shows 'REPLICATION'. I ran DBCC OPENTRAN on my ServerB.DBB and it shows below:

Replicated Transaction Information:
Oldest distributed LSN     : (0:0:0)
Oldest non-distributed LSN : (10417370:9406:1)

This value is not changing since many hours now. Does it mean my replication from Server B to C,D,E,F and G is not working? However when I see in replication monitor it shows everything as fine. i.e. logreader, all distributor agents are running and moving transactions for all publications. Why I am unable to shrink the log file and what should I do to shrink the log file?

Also, want to add that CDC is not enabled on any of my DBs involved in replication. DBCC LOGINFO shows all my VLFs in use.


Add article to transaction replication without generating a snapshot at all

$
0
0

I have a transaction replication and the subscription was synced from snapshot years ago. Now I have a new table that needs to be added to the replication. Problem is the table is close to a TB and I do not want to generate a snapshot for that table instead just want the new data to be synced, kinda like when you sync from backup. Its inserts only to the table and I can sync the old data manually later.

How do I make replication to start transferring the data without generating the snapshot.

How can I remove a channel from replication slave?

$
0
0

Today my question is about MySQL replication cleanup.

I used mysqldump with the --master-info --all-databases tag and restored it to a new host to be used as a replication slave.

After restore, I see some artifacts of slave information from the master. This is the third host in a replication chain.

I issued reset slave for channel 'xxxxx'; which returned Query OK, 0 rows affected (0.00 sec). When I later query using show slave status for channel 'xxxxx';, I still see information for this replication channel appearing.

How can I cleanup this replication channel such that it never accidentally starts, as well as cleanup the output of show slave status \G to only show the intended replication channel?

SQL Server 2016 very slow snapshot generation

$
0
0

We've faced such a problem after migrating from SQL Server 2008 to SQL Server 2016: there's a merge replication implemented and it takes up to 2 hours (!) to generate a snapshot, instead of 5 minutes like it was before the upgrade.

We've tried to increase MaxBcpThreads, have changed the agents' parameters- but nothing from that seems to help. Would be glad to hear any kinds of solutions.

Synchronizing missing data on publisher and subscriber database tables (insert and update only missing data on destination) in sql server

$
0
0

In my case, we have some extra data rows in few tables on subscriber database, which I need to retain.

I tried tablediff.exe utility which is traversing all the tables and creating Insert, update and delete queries in single SQL script, but I just need to insert/update and not delete.

I don't want to manually delete 'delete' statements from tablediff.exe generated scripts. I am looking for an option which does not look for data rows to be deleted and concentrate on insert and update rows.

If it is not going to work I have to look for the dynamic query using 'except'.

Some records are reverted back to old value in SQL Server 2016 Bidirectional Replication

$
0
0

I have successfully setup bidirectional replication for 4 servers, says A, B, C, and D with the following configuration: 1. Server A acts as Distributor, Publisher for B, C, and D, also as a Subscriber for B, C, and D. 2. Server B, C and D acts as Publisher and Subscriber for server A. 3. they all are connected to a 1-2MB VPN. and they are all works well until this week I found a weird behavior in two servers. Some of the records are reverted back to old value after couple seconds. I have checked the data was replicated, and then reverted back randomly. I have no idea what caused the problem, I have set @loopback_detection to true during the creation of all subscribers. Does anyone experienced the same or know how to solve it? Thank you.

Achmad Mulyadi

Viewing all 17268 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>