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

MySQL replication error 1452

$
0
0

Hi Can you someone help to finger out the solution in MySQL replication error?

•   mysql replication error: (Last_Errno: 1452) 

Last_SQL_Error: Error
'Cannot add or update a child row: a foreign key constraint fails


Replication stops with GTID_NEXT error after creation/drop of memory table in mysql5.6

$
0
0

We have recently upgraded to mysql5.6.25 from mysql5.5.x/mysql5.1.x on our mysql-cluster. Below is a brief snapshot of our architecture.enter image description here

Since we have upgraded and enabled gtid-mode we have been intermittently getting slave errors similar to :

Last_SQL_Error: Error 'When @@SESSION.GTID_NEXT is set to a GTID, you must explicitly set it to a different value after a COMMIT or ROLLBACK. Please check GTID_NEXT variable manual page for detailed explanation. Current @@SESSION.GTID_NEXT is 'd7e8990d-3a9e-11e5-8bc7-22000aa63d47:1466'.' on query. Default database: 'adplatform'. Query: 'create table X_new like X'

Our observations are as below..

  • These slave errors are resolved simply by restarting the slave.
  • Such errors are always with Create/Drop of tables which have Memory Storage Engine.
  • Errors on Complete-Slave(B) show up continuously at a fixed minute (39th) of the hour and have been repeating since we have upgraded, almost a week.
  • Errors on Complete-Slave as well as Partial slave are observed whenever its master is restarted.
  • Cluster-1 and Cluster-2 have centos machines and Cluster-3 have ubuntu-machines. Slaves on centos machines also fail with the same error whenever its master(C/D) is restarted, but slave on ubuntu machines do not fail!!.

We have temporarily been able to live with this issue by setting up an action-script on our monitoring system which fires on slave error alert on any machine.

A look into gtid_next section in replication-options doc of mysql tells following

Prior to MySQL 5.6.20, when GTIDs were enabled but gtid_next was not AUTOMATIC, DROP TABLE did not work correctly when used on a combination of nontemporary tables with temporary tables, or of temporary tables using transactional storage engines with temporary tables using nontransactional storage engines. In MySQL 5.6.20 and later, DROP TABLE or DROP TEMPORARY TABLE fails with an explicit error when used with either of these combinations of tables. (Bug #17620053)

This seems related to my issue but still doesn't not explain my scenario. Any hints/direction to solve the issue would be greatly appreciated...

EDIT : I managed to find a similar recently reported bug in mysql(#77729), description of which is as follows :

https://bugs.mysql.com/bug.php?id=77729

When you have table with Engine MEMORY working on replication master, mysqld injects "DELETE" statement in binary logs on first access query to this table. This insures consistency of data on replicating slaves.

If replication is GTID ROW based, this inserted "DELETE" breaks replication. Logged event is in STATEMENT format and do not generate correct SET GTID_NEXT statements in binary log.

Unfortunately, the status of this bug is marked as Can't Repeat...

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

how to publish user defined table type as an article in Transactional replication

$
0
0

I am new to replication and trying to use transactional replication. I am trying to publish all data and schema. My stored procedure takes user defined table type as input.

CREATE type TableBParam as table
(
    Id Bigint,
    TableAId Bigint not null,
    FieldB1 nvarchar(50)
)

--Deadlock was observed on the save query
go
CREATE PROC SaveTableB
(  
 @val [dbo].[TableBParam] READONLY  
)  
AS 
BEGIN 
SET NOCOUNT ON;  

MERGE [dbo].[TableB] AS T  
USING (SELECT * FROM @val) AS S  
  ON ( T.Id = S.Id)  
WHEN MATCHED THEN  
    update set FieldB1 = S.FieldB1
WHEN NOT MATCHED THEN 
    insert(TableAId, FieldB1) Values(S.TableAId, S.FieldB1);

END
go

when the snapshot agent runs it gives me an error "Script failed for user defined table type TableBParam"

I couldn't find an option to specify user defined table types in the article dialog when we setup Local publish. I have also explore the article properties to which didn't help me.

enter image description here

Appreciate your suggestions.

How to replicate particular table in MySQL master-slave configuration?

$
0
0

How do I replicate a particular table in a MySQL master-slave configuration? I have tried replicate-do-table and replicate-wild-do-table. I tried in my.ini file; is there any alternative to replicate without using replicate-do-table and replicate-wild-do-table? I need a binary log statement to replicate a single table.

Azure SQL Managed Instance replication

$
0
0

I'm working on legacy application migration to the cloud, currently on planning and estimation stage, the question I wasn't able to google is:

Can a Subscriber database be in the same Azure SQL Managed Instance as Publisher/Distributor database?

I will have an Azure SQL Managed Instance with a Database1 in it, and want to have Database2 in the same Azure SQL MI as a Subscriber of Database1 transactional replications. The Database2 will be used as a read-only source for reports generation.

MariaDB/MySQL SSL Replication Failure

$
0
0

After searching for a solution for the last 6 hours, I have come up dry in my attempt to add SSL to the replication. I managed to get it to connect with SSL via the mysql command line tool without issues, however I cannot seem to solve this replication issue. Based on the research I did find, this is an extremely generic catch-all SSL error.

System 1:

OS:             Fedora 30 Modular
Kernel:         5.0.16-300
Arch:           x86_64
MariaDB Server: 10.3.16
OpenSSL:        1.1.1c FIPS
MariaDB [(none)]> STATUS;
--------------
mysql  Ver 15.1 Distrib 10.3.16-MariaDB, for Linux (x86_64) using readline 5.1

Connection id:      42
Current database:   
Current user:       root@localhost
SSL:            Cipher in use is TLS_AES_256_GCM_SHA384
Current pager:      stdout
Using outfile:      ''
Using delimiter:    ;
Server:         MariaDB
Server version:     10.3.16-MariaDB-log MariaDB Server
Protocol version:   10
Connection:     Localhost via UNIX socket
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:        /var/lib/mysql/mysql.sock
Uptime:         18 min 0 sec

Threads: 11  Questions: 32  Slow queries: 0  Opens: 17  Flush tables: 1  Open tables: 11  Queries per second avg: 0.029
--------------
MariaDB [(none)]> SHOW SLAVE STATUS \G;
*************************** 1. row ***************************
                Slave_IO_State: Connecting to master
                   Master_Host: REDACTED
                   Master_User: REDACTED
                   Master_Port: REDACTED
                 Connect_Retry: 60
               Master_Log_File: master1-bin.000012
           Read_Master_Log_Pos: 364174
                Relay_Log_File: master1-relay-bin.000001
                 Relay_Log_Pos: 4
         Relay_Master_Log_File: master1-bin.000012
              Slave_IO_Running: Connecting
             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: 364174
               Relay_Log_Space: 256
               Until_Condition: None
                Until_Log_File: 
                 Until_Log_Pos: 0
            Master_SSL_Allowed: Yes
            Master_SSL_CA_File: /etc/pki/tls/certs/mariadb-chain.pem
            Master_SSL_CA_Path: /etc/pki/tls/certs/
               Master_SSL_Cert: /etc/pki/tls/certs/mariadb.pem
             Master_SSL_Cipher: TLS_AES_256_GCM_SHA384
                Master_SSL_Key: /etc/pki/tls/private/mariadb.pem
         Seconds_Behind_Master: NULL
 Master_SSL_Verify_Server_Cert: Yes
                 Last_IO_Errno: 2026
                 Last_IO_Error: error connecting to master 'REDACTED@REDACTED:REDACTED' - retry-time: 60  maximum-retries: 86400  message: SSL connection error: error:00000000:lib(0):func(0):reason(0)
                Last_SQL_Errno: 0
                Last_SQL_Error: 
   Replicate_Ignore_Server_Ids: 
              Master_Server_Id: 0
                Master_SSL_Crl: /etc/pki/tls/certs/mariadb-chain.pem
            Master_SSL_Crlpath: /etc/pki/tls/certs/
                    Using_Gtid: No
                   Gtid_IO_Pos: 
       Replicate_Do_Domain_Ids: 
   Replicate_Ignore_Domain_Ids: 
                 Parallel_Mode: conservative
                     SQL_Delay: 0
           SQL_Remaining_Delay: NULL
       Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
              Slave_DDL_Groups: 0
Slave_Non_Transactional_Groups: 0
    Slave_Transactional_Groups: 0
1 row in set (0.000 sec)

ERROR: No query specified

MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE '%ssl%';
+---------------------+-------------------------------------------+
| Variable_name       | Value                                     |
+---------------------+-------------------------------------------+
| have_openssl        | YES                                       |
| have_ssl            | YES                                       |
| ssl_ca              | /etc/pki/tls/certs/mariadb-chain-x509.pem |
| ssl_capath          |                                           |
| ssl_cert            | /etc/pki/tls/certs/mariadb-x509.pem       |
| ssl_cipher          | TLS_AES_256_GCM_SHA384                    |
| ssl_crl             |                                           |
| ssl_crlpath         |                                           |
| ssl_key             | /etc/pki/tls/private/mariadb.pem          |
| version_ssl_library | OpenSSL 1.1.1c FIPS  28 May 2019          |
+---------------------+-------------------------------------------+
10 rows in set (0.002 sec)

System 2:

OS:             Fedora 30 Modular
Kernel:         5.0.16-300
Arch:           x86_64
MariaDB Server: 10.3.16
OpenSSL:        1.1.1c FIPS
MariaDB [(none)]> STATUS;
--------------
mysql  Ver 15.1 Distrib 10.3.16-MariaDB, for Linux (x86_64) using readline 5.1

Connection id:      60
Current database:   
Current user:       root@localhost
SSL:            Cipher in use is TLS_AES_256_GCM_SHA384
Current pager:      stdout
Using outfile:      ''
Using delimiter:    ;
Server:         MariaDB
Server version:     10.3.16-MariaDB-log MariaDB Server
Protocol version:   10
Connection:     Localhost via UNIX socket
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:        /var/lib/mysql/mysql.sock
Uptime:         40 min 44 sec

Threads: 12  Questions: 623  Slow queries: 0  Opens: 48  Flush tables: 1  Open tables: 42  Queries per second avg: 0.254
--------------

MariaDB [(none)]> SHOW SLAVE STATUS \G;
*************************** 1. row ***************************
                Slave_IO_State: Connecting to master
                   Master_Host: REDACTED
                   Master_User: REDACTED
                   Master_Port: REDACTED
                 Connect_Retry: 60
               Master_Log_File: master1-bin.000007
           Read_Master_Log_Pos: 344
                Relay_Log_File: master1-relay-bin.000006
                 Relay_Log_Pos: 4
         Relay_Master_Log_File: master1-bin.000007
              Slave_IO_Running: Connecting
             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: 344
               Relay_Log_Space: 256
               Until_Condition: None
                Until_Log_File: 
                 Until_Log_Pos: 0
            Master_SSL_Allowed: Yes
            Master_SSL_CA_File: /etc/pki/tls/certs/mariadb-chain.pem
            Master_SSL_CA_Path: 
               Master_SSL_Cert: /etc/pki/tls/certs/mariadb.pem
             Master_SSL_Cipher: 
                Master_SSL_Key: /etc/pki/tls/private/mariadb.pem
         Seconds_Behind_Master: NULL
 Master_SSL_Verify_Server_Cert: Yes
                 Last_IO_Errno: 2026
                 Last_IO_Error: error connecting to master 'REDACTED@REDACTED:REDACTED' - retry-time: 60  maximum-retries: 86400  message: SSL connection error: error:00000000:lib(0):func(0):reason(0)
                Last_SQL_Errno: 0
                Last_SQL_Error: 
   Replicate_Ignore_Server_Ids: 
              Master_Server_Id: 0
                Master_SSL_Crl: /etc/pki/tls/certs/mariadb-chain.pem
            Master_SSL_Crlpath: 
                    Using_Gtid: No
                   Gtid_IO_Pos: 
       Replicate_Do_Domain_Ids: 
   Replicate_Ignore_Domain_Ids: 
                 Parallel_Mode: conservative
                     SQL_Delay: 0
           SQL_Remaining_Delay: NULL
       Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
              Slave_DDL_Groups: 0
Slave_Non_Transactional_Groups: 0
    Slave_Transactional_Groups: 0
1 row in set (0.000 sec)

ERROR: No query specified

MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE '%ssl%';
+---------------------+--------------------------------------+
| Variable_name       | Value                                |
+---------------------+--------------------------------------+
| have_openssl        | YES                                  |
| have_ssl            | YES                                  |
| ssl_ca              | /etc/pki/tls/certs/mariadb-chain.pem |
| ssl_capath          |                                      |
| ssl_cert            | /etc/pki/tls/certs/mariadb.pem       |
| ssl_cipher          |                                      |
| ssl_crl             |                                      |
| ssl_crlpath         |                                      |
| ssl_key             | /etc/pki/tls/private/mariadb.pem     |
| version_ssl_library | OpenSSL 1.1.1c FIPS  28 May 2019     |
+---------------------+--------------------------------------+
10 rows in set (0.005 sec)

I'm trying to setup both servers as master and slave for full replication. It was working until I went to implement the SSL. I'm trying to use Let's Encrypt certificates. I have already converted the private key to RSA and made a full copy of the certificate and chain, so it's not just a symlink. Both servers are running on the same port (non-standard) and have the same users and passwords. I have completely disabled SELinux, to no avail.

the permissions should be fine...

ls -l /etc/pki/tls/*/mariadb*.pem
-rw-r--r--+ 1 mysql mysql 3566 Aug 11 02:17 /etc/pki/tls/certs/mariadb-chain.pem
-rw-r--r--+ 1 mysql mysql 1919 Aug 11 02:17 /etc/pki/tls/certs/mariadb.pem
-rw-r--r--+ 1 mysql mysql 1679 Aug 11 02:17 /etc/pki/tls/private/mariadb.pem

Thanks for your time.

UPDATE: I tried changing the permissions on the PEM files to 600, but it did not fix it. I managed to get it logging at maximum verbosity and this is the section pertinent to the error:

2019-08-14 16:42:53 10 [ERROR] Slave I/O: error connecting to master 'REDACTED@REDACTED:REDACTED' - retry-time: 60  maximum-retries: 86400  message: SSL connection error: error:00000000:lib(0):func(0):reason(0), Internal MariaDB error code: 2026
2019-08-14 16:43:54 12 [Warning] IP address 'REDACTED' could not be resolved: Name or service not known
2019-08-14 16:43:54 12 [Warning] Aborted connection 12 to db: 'unconnected' user: 'unauthenticated' host: 'REDACTED' (CLOSE_CONNECTION)

I also removed the ssl_cipher option from the server I forgot to remove it from, so the cipher configs match.

Repository has not been enabled to accept revision propchanges; ask the administrator to create a pre-revprop-change hook

$
0
0

HI I am trying to mirroring my repository with another server/machine repository

I have two different machine(window) at two different server.at one machine I have already a SVN repository(source repository) and I want to mirror this repository with another repository(destination repository) at another machine.So I have created one empty repository(destination repository) at another machine.But when I want to initialize destination repository with source repository.I am getting mentino error. NOTE: I have already created pre-revprop-change.bat file in hook folder. pre-revprop-change.bat file has only one line of code that is exit 0


Is it possible to enable two keyspace in Cassandra to be replicated?

$
0
0

I have two networks where each network is controlled using a separate SDNcontroller. Each network stores its data in its own store. I want to enable these two controllers to communicate with each other to exchange data between them. I will build these data stores using Cassandra, but my question in this case: Do I need to build each store in a separate keyspace or I can create both stores in a single keyspace?

in case of two keysapces, Is it possible to enable replication( consistancy) between them in cassandra?

MariaDB slaves spontaneously reset

$
0
0

I recently had a very weird catastrophe, that I have zero idea how happened, so I apologise for any missing context/logs. I'm completely blank on this one.

I have a MariaDB replication cluster, with 1 master and 2 slaves.

It's been running with no problems for months, but suddenly, out of the blue, in the middle of the night, BOTH slaves (but not the master) "rolled back" to when they were first set up. That is - months of new data and updates disappeared, as if it never existed in the first place.

Furthermore, both slaves insisted they were in sync with master - at least gtid matched and 'seconds_behind_master' was zero. New changes were written to the slaves - except when hitting constraints. This in turn led to a shedload of bad data being written to the master (since reads had returned wrong data, which was worked on before being written back), so it took me a lot of time to comb through everything and bring stuff back to a somewhat consistent state.

The slaves were set up using mariabackup, and all servers are the same version. I made a new backup and put it on the slaves, and everything seems to be running as expected once again.

How can this happen? I don't even know how to start debugging this.

MS SQL replication table change causes failed drop/create due to constraints

$
0
0

I have a simple SQL server 2016 merge replication with one publisher and one subscriber. I changed a replicated table and followed the custom instruction of removing the table from the replication, editing the table, re-adding the table to the replication and creating a new snapshot. To my surprise the replication was not able to properly handle the change. When I looked at the schema script that was built to update the subscriber database I saw that the replication tried to drop and re-create the whole table which cannot work because of foreign key restraints. With ALTER commands this should have been possible. Is there a way to handle such table changes without completely deleting the subscriber database and re-creating the subscription (which would be my brutal but working solution for now)?

SQL Server 2016 -number of SQL agent replication jobs(transaction log repl)

$
0
0

So I have a SQL server 2016 on a Windows Server 2012 instance. We have 140 databases(small to med). So the SQL instance was setup for self replication and in the process we have 140 SQL agent replication jobs. When the server reboots it can handle ~120 replication jobs, then when one is stopped it can not be re-started - it fails - but with no message at all - then says "between retries". In replication monitor - the agent has the red x and or is showing not running. In the event viewer I see logread.exe application crash. I was trying to research to see if there is a cap on the number of agent jobs running. Our memory is good, the disks and CPU usage is low. I have not been part of something of this size before and I am currently out of ideas. My current work around is to have a PowerShell script read the current failures and manually kick off the -Publisher [xxx] -PublisherDB [DbName] -Distributor [xxx] -DistributorSecurityMode 1 -Continuous . That is what makes me think there is a cap on the number of agents because I can run it with out the SQL-Agent. I was thinking maybe I need to change that to more of a scheduler but we have reports run that need timely info. What am I missing? Or am I right in looking to breaking up the job runs?

Database disstribution in alwayson

$
0
0

Good morning all , I have an on always on sql server configuration where transactional replication is configured if I open SSMS I find that the disstribution database is set to alwayson on then I cannot find the synchrinized wordenter image description here thanks

RDS Replication Error (Apply Error 1406 / Truncation)

$
0
0

I have a MySQL RDS instance as a master, created a Read Replica from it, and ran some schema change operations on it. To be specific, I changed the charset and collation of all the tables and columns from utf8 to utf8mb4. Things were replicating fine, but an error just occurred.

Apply Error 1406: Error; Data too long for column... etc

This is due to lowering the varchar length on some columns from 255 to 191.

I read that you can run some commands to skip replication errors, as described here: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/mysql_rds_skip_repl_error.html

However, would this "skip" the insert, or, just truncate the data and proceed with the insert?

I'd like the data to be truncated and still added to the table rather than aborting the entire operation, but I'm not sure if that is going to happen or not. Any suggestions would be welcome!

PostgreSQL stop streamig replication

$
0
0

I've setup streaming replication between a master and a backup server. Now I want to stop the replication but I've noticed that every time I stop postgres in the backup server some old WALs files stay in the master server.

My question, is there a safe way to stop replication and avoid master accumulating WALs file in the master ?


mysql replication status using a select query

$
0
0

Is it possible to get replication status from any system database table. using which i can identify whether the replication is up or down.

I need to to know whether the SLAVE_IO_RUNNING and SLAVE_SQL_RUNNING = YES from a system table?

Manasi

Replication Issue - Changing the replication-do-db filter

$
0
0

I have a server that someone has setup which are acting as a master on both database. Since they have been configured as both master on the same database, changes one on end has caused all sorts of issues on the other.

On one of the master is displaying two databases in the replication-do-db when I do show master status which is rather odd.

Here's the entry in my system that's of concern:

Replicate_Do_DB: db1,db2,d1,db2

MySQL Version is 5.1, I'm looking for a way to change the replication filter. CHANGE REPLICATION FILTER seems to only apply to version 5.5.

An you explain to me what I need to do to recover from this scenario? Thank you.

Sync of Master Master replication when Primary node comes up MySQL 5.7 Enterprise

$
0
0

I have a Master (say Node A) - Master (Say Node B) asynchronous replication setup with ROW based logging method.

Node A has been setup as Write/Read node and Node B has been setup as Read Node Only.

From JBOSS , i am doing switch over that , when A node goes down , all the Write operation will get forward to B node and whenever Node A comes up , JBOSS will forward all the Writes to A node.

Now suppose Node A remains down for long time , then all the Writes will go to B node . When A node comes up , it will remain un-sync for a while till it get complete sync with B . While it is getting sync , write operation is also happening on Node A which might result in locking issues as well.

So my question is :

Is there any method in MySQL that when Node A comes up , it will not be accessible by outer application ( like JBOSS , i have mentioned) till it gets complete sync with Node B . Can we control it via MySQL_Safe mode so that other application can perceive Node A as still down or is there any other method

Automatically purging binlogs after successful replication

$
0
0

I have a dedicated server hosting a MySQL database, and want to use replication to have an always up-to-date backup somewhere.

I chose to use Amazon RDS as my replica, and I'm following this guide:

Replication with a MySQL Instance Running External to Amazon RDS

What I fail to understand however, is who/what is supposed to take care of purging binary logs. The only configuration I found is expire_logs_days, which the documentation describes as:

You can also set the expire_logs_days system variable to expire binary log files automatically after a given number of days (...). If you are using replication, you should set the variable no lower than the maximum number of days your slaves might lag behind the master.

Is this the standard procedure DBAs use?

Isn't it possible to have RDS, which is the only replica, purge the logs on the master as soon as it's processed them?

MYSQL Server shows it is master server in replication. How to turn off this?

$
0
0

I'm using Ubuntu 20.04 version. I have installed MySQL server using apt-get install mysql-server and used mysql_secure_installation for security. Then I have installed phpMyAdmin using apt-get install phpmyadmin.

Opening phpMyAdmin's status tab shows This MySQL server works as master in replication process

Screenshot of Status tab in phpMyAdmin

Can anyone help me to stop this replication process? I found nothing about this replication in my.cnf configuration file.

Viewing all 17268 articles
Browse latest View live


Latest Images

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