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

MYSQL Error: 1026: Error writing file 'binlog' (errno: 2 - No such file or directory)

$
0
0

We are using MYSQL 8.0.20 Community Edition on Oracle Linux 7.8 (RHEL). On one server we are running master database and using row based replication to a slave on another server via bin-log. Replication is running OK (we use Percona toolkit to perform checksums). Had an issue suddenly when updating any records caused the following intermittent error:

1026: Error writing file 'binlog' (errno: 2 - No such file or directory)

This started very early in the morning one day and was intermittent throughout the day and suddenly the error stopped. No errors recorded in the MYSQL log files as far as I can see on either server (only in the log files from our application REST API that connects to the database to query and update records).

Also noticed the above error in MYSQL Workbench when trying to update records - again this was intermittent.

We don't have 'binlog' file per say..

-rw-r-----. 1 mysql mysql  392106655 Aug 24 11:17 binlog.000025
-rw-r-----. 1 mysql mysql 1073790505 Sep  1 09:02 binlog.000026
-rw-r-----. 1 mysql mysql  598606158 Sep 11 13:12 binlog.000027
-rw-r-----. 1 mysql mysql  290988040 Sep 17 17:30 binlog.000028

Not sure why 'binlog' was being updated to attempting to be updated - seems like it could not work out which binary log file to update. Show master status reveals:

    File            Position    Binlog_Do_DB    Binlog_Ignore_DB    Executed_Gtid_Set
    binlog.000028   291444378                                       8b2b0f26-0202-11ea-b1aa-00505687af0b:1-1858311

Bin log cache setup:

Bin log cache size: 32768   
Max bin log cache size: 18446744073709547520    
Binlog format: ROW

We do have tables where average row size is above bin log cache size (around 88K on average).

Not sure where to look, doesn't look like any memory or disk issues on the server. We have been running this setup for a while but with increased load of late.


MYSQL Error: 1026: Error writing file 'binlog' (errno: 2 - No such file or directory)

$
0
0

We are using MYSQL 8.0.20 Community Edition on Oracle Linux 7.8 (RHEL). On one server we are running master database and using row based replication to a slave on another server via bin-log. Replication is running OK (we use Percona toolkit to perform checksums). Had an issue suddenly when updating any records caused the following intermittent error:

1026: Error writing file 'binlog' (errno: 2 - No such file or directory)

This started very early in the morning one day and was intermittent throughout the day and suddenly the error stopped. No errors recorded in the MYSQL log files as far as I can see on either server (only in the log files from our application REST API that connects to the database to query and update records).

Also noticed the above error in MYSQL Workbench when trying to update records - again this was intermittent.

We don't have 'binlog' file per say..

-rw-r-----. 1 mysql mysql  392106655 Aug 24 11:17 binlog.000025
-rw-r-----. 1 mysql mysql 1073790505 Sep  1 09:02 binlog.000026
-rw-r-----. 1 mysql mysql  598606158 Sep 11 13:12 binlog.000027
-rw-r-----. 1 mysql mysql  290988040 Sep 17 17:30 binlog.000028

Not sure why 'binlog' was being updated to attempting to be updated - seems like it could not work out which binary log file to update. Show master status reveals:

    File            Position    Binlog_Do_DB    Binlog_Ignore_DB    Executed_Gtid_Set
    binlog.000028   291444378                                       8b2b0f26-0202-11ea-b1aa-00505687af0b:1-1858311

Bin log cache setup:

Bin log cache size: 32768   
Max bin log cache size: 18446744073709547520    
Binlog format: ROW

We do have tables where average row size is above bin log cache size (around 88K on average).

Not sure where to look, doesn't look like any memory or disk issues on the server. We have been running this setup for a while but with increased load of late.

How to run a cold backup with Linux/tar without shutting down MySQL slave?

$
0
0

I run the following before tar-ing up the data directory:

STOP SLAVE;
FLUSH TABLES WITH READ LOCK;
FLUSH LOGS; 

However, tar will sometimes complain that the ibdata* and ib_logfiles* files are updated during the process. What am I missing?

The slave machine is in a cold standby machine so there are no client processes running while tar is running.

CentOS release 5.6 64bits, MySQL 5.1.49-log source distribution.

llsyncd don't see if file is modified and sync it if it update

$
0
0

Here is my problem. I installed lsyncd on the servers 1 to synchronize it with the server 2. The 1 copies on the 2. So far everything is fine and the synchronization is working. But if i modify the content ex in: index.php on server 1. lsyncd will not see it and will not sync it again. This is the old version that will remain on server 2 .... however I put update = true, in server 1. Here is my configuration file (/etc/lsyncd.conf):

settings{
        logfile = "/var/log/lsyncd/lsyncd.log",
        statusFile = "/var/log/lsyncd/lsyncd.stat",
        statusInterval = 2,
}
-- MySQL
sync{
        default.rsync,
        source="/var/lib/mysql",
        target="1.3.3.7:/var/lib/mysql",
        delay = 1,
        rsync={
                compress = true,
                verbose = true,
                update = true,
                perms = true,
                owner = true,
                group = true,
                rsh ="/usr/bin/ssh -l root -i /root/.ssh/id_rsa",
        }
}

Thank you so much!

MongoDB - count current read/write operations

$
0
0

is it possible to count the current read or write operations on a mongodb replica set? (including all databases not just a single database)

Thank you!

Best regards

Binlog issue - Mysql Replication

$
0
0

I have a big issue with binlogs for the replication of a database.
My master and my slave are well configurated.

Matser 10.145.12.21 (windows server)

show master status

File : mysql-bin.000001
Position : 154
Binlog_do_db : my_database

Slave (windows server)

show slave status
Master_Host 10.145.12.21
Master_User myreplication
Master_Port 3306
Master_Log_File mysql-bin.000001
Read_Master_Log_Pos 154
Relay_Log_File mysql-relay-bin.000004
Relay_Log_Pos 150
Relay_Master_Log_File mysql-bin.000001
Slave_IO_Running No
Slave_SQL_Running Yes
Last_IO_Errno 1236
Last_IO_Error Got fatal error 1236 from master when reading data...

I tryed that (it was no effect) :
Slave: stop slave;
Master: flush logs
Master: show master status;
Slave: CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.00000X', MASTER_LOG_POS=154;
Slave: start slave;

This may be a privilege issue as the binlogs files are not copied to my slave server

mysql replication missed quite a lot SQL statement

$
0
0

I have set up a master/slave with mysql-5.1.73 The master's binlog format is "statement". The master and slave seemed running very well with slave status:

         Slave_IO_Running: Yes
        Slave_SQL_Running: Yes

And when I modified the content on the master manually, whether it was select or update or insert, or alter table, the modification will be synchronized to the slave instantly.

However, after running for several days, I found the slave missed a lot of insert statements, these insertion statements didn't violate any PRIMARY key rule. More ever, when I tried to redo the binlog on another slave with:

mysqlbinlog mysql-binlog.00000X | mysql

Those missed statement were missed again with no warning or error.

Have you ever met such a situation, what should I do to restore all the changes to the slave? (There are quite a lot of missed changes, so I could not restore them one by one).

I dug into this matter to find that, the relay log on the slave contains all the insertion statement, which means the binlog is transmitted to the slave correctly. However, the binlog on the slave missed some of the insertion statement, so this issue appeared to occurred during the redo process of the slave.

Any suggestions to diagnose into this issue or work around it?

MongoDB 3.6 create local Shard db without replica

$
0
0

This is what I want to do:

  1. Create a Config Server
  2. Create 2 Shard
  3. Create a Mongos Router

I don't want to replicate my data using replica set, I want to simulate that each shard has only a part of data like it says is shard theory.

I'm following this guide, but I understood that the guide create many replicas for config server and shared server and I don't want that. So this is what I do:

Config file of Config Server:

sharding:
  clusterRole: configsvr
replication:
  replSetName: localhost
net:
  bindIp: localhost
storage:
  dbPath: /home/christian/mongo/confsvr/metadata

Execute Config Server:

mongod --config /mongo/confsvr/mongod.conf --port 27019

Now doc uses rs.initiate() for adding a replica of config server (if I understood right), so I dropped this part.

After that, I created two config file for Shard Server.

sharding:
 clusterRole: shardsvr
replication:
  replSetName: localhost
net:
  bindIp: localhost
storage:
  dbPath: /home/christian/mongo/shard[1|2]

I started two shard:

mongod --config mongo/shard[1|2]/shard.conf  --port 2703[1|2]

Created conf file for Mongos Router:

sharding:
  configDB:localhost/localhost:27019
net:
  bindIp: localhost

So i tried to start mongos:

mongos --config /home/christian/mongo/router/mongos.conf

But terminal print in loop this:

Unable to reach primary for set localhost

Cannot Reach any nodes for set localhost

Last steps were connecting to mongos, and add the Shards to DB

How could I obtain what I want?


MySql replication Failure

$
0
0

I have a mysql (Ver 14.14 Distrib 5.7.29, for Linux (x86_64)) primary -> secondary replication setup. Initially the replication was working successfully until we had to restart the primary database. Since then replication is failing. We have tried to re-enable replication a few times but after a few minutes replication fails again.

my.cnf file -> primary

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
log-bin=mysql-bin
server-id=1
datadir=/mysqldb/datadir/mysql
socket=/mysqldb/datadir/mysql/mysql.sock
log-error=/var/log/mysql/mysql_error.log
log-syslog=ON
max_connections=1000

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[client]
port=3306
socket=/mysqldb/datadir/mysql/mysql.sock

my.cnf file -> secondary

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
server-id=2
datadir=/mysqldb/datadir/mysql
socket=/mysqldb/datadir/mysql/mysql.sock
log-error=/var/log/mysql/mysql_error.log
log-syslog=ON
max_connections=1000

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[client]
port=3306
socket=/mysqldb/datadir/mysql/mysql.sock

show status slave\G -> secondary

Slave_IO_State: Waiting for master to send event
                  Master_Host: <ip-address>
                  Master_User: <username>
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000003
          Read_Master_Log_Pos: 336473455
               Relay_Log_File: avt-mysql-sc-prod-2-relay-bin.000002
                Relay_Log_Pos: 187164
        Relay_Master_Log_File: mysql-bin.000003
             Slave_IO_Running: Yes
            Slave_SQL_Running: No
              Replicate_Do_DB:
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: 1032
                   Last_Error: Could not execute Delete_rows event on table store_metadata.access_token; Can't find record in 'access_token', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000003, end_log_pos 336136737
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 336136333
              Relay_Log_Space: 524507
              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: NULL
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 1032
               Last_SQL_Error: Could not execute Delete_rows event on table store_metadata.access_token; Can't find record in 'access_token', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000003, end_log_pos 336136737
  Replicate_Ignore_Server_Ids:
             Master_Server_Id: 1
                  Master_UUID: 7c367a1b-de48-11e9-a49d-42010a164351
             Master_Info_File: /mysqldb/datadir/mysql/master.info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State:
           Master_Retry_Count: 86400
                  Master_Bind:
      Last_IO_Error_Timestamp:
     Last_SQL_Error_Timestamp: 200122 17:37:02
               Master_SSL_Crl:
           Master_SSL_Crlpath:
           Retrieved_Gtid_Set:
            Executed_Gtid_Set:
                Auto_Position: 0
         Replicate_Rewrite_DB:
                 Channel_Name:
           Master_TLS_Version:
1 row in set (0.00 sec)

We then try to re-enable replication again by:

stop slave;

CHANGE MASTER TO
       MASTER_HOST='<ip-address>',
       MASTER_USER='<username>',
       MASTER_PASSWORD='<password>',
       MASTER_LOG_FILE='mysql-bin.000003',
       MASTER_LOG_POS=336562088;

start slave;

where

MASTER_LOG_POS=;

comes from

show master status\G
File: mysql-bin.000003
         Position: 336562088

after a few minutes replication fails error_log -> secondary

2020-01-22T17:32:45.562685Z 1524 [Note] Slave I/O thread for channel '': connected to master 'replica1@<ip-address>:3306',replication started in log 'mysql-bin.000003' at position 335949489
2020-01-22T17:37:02.294105Z 1525 [ERROR] Slave SQL for channel '': Could not execute Delete_rows event on table store_metadata.access_token; Can't find record in 'access_token', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000003, end_log_pos 336136737, Error_code: 1032
2020-01-22T17:37:02.294180Z 1525 [Warning] Slave: Can't find record in 'access_token' Error_code: 1032
2020-01-22T17:37:02.294193Z 1525 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'mysql-bin.000003' position 336136333.

I have also noticed the following connection error on the primary database. However, this one occurs once the replication fails. Or could it be that the connection terminates and therefore the replication fails.

mysqld.log -> primary

2020-01-22T21:10:13.065441Z 697 [Note] Start binlog_dump to master_thread_id(697) slave_server(2), pos(mysql-bin.000003, 347432570)
2020-01-22T21:53:31.113366Z 678 [Note] Aborted connection 678 to db: 'store_metadata' user: 'avtadmin' host: '<hostname>-f6297368e00118f33f8e74e464.interna' (Got an error reading communication packets)

Additional testing information

On Slave

stop slave;
drop database;
create database;

On Master

flush tables with read lock;
show master status\G
mysqldump -h <ip-address> --single-transaction --max_allowed_packet=1024m --databases store_metadata> /tmp/mysqlsnapshot-replication.sql
unlock tables;

On Slave

mysql -h<ip-address> -u <username> -p  store_metadata < "/tmp/mysqlsnapshot-replication.sql"
show databases;
use store_metadata;
show tables;

Enable Replication

CHANGE MASTER TO
       MASTER_HOST=‘<ip-address>’,
       MASTER_USER=‘<username>’,
       MASTER_PASSWORD=‘<password>’,
       MASTER_LOG_FILE='mysql-bin.000003',
       MASTER_LOG_POS=364656552;

start slave;
show slave status\G
tail -f /var/log/mysqld.log

On Master

show master status\G
tail -f /var/log/mysqld.log

Initially all was working fine. I then added a new database to master but the database never got replicated to the secondary DB. I then deleted the new database on master and that broke replication again with the error that new database didn’t exist on the secondary DB. Any thoughts on this? Should I restart the primary database so that a new binary log gets created?

Thank you.

MySql Galera Multi site high availability

$
0
0

We have a datacenter with 3 percona glera nodes

We have a store that wants to be in sync with our datacenter(multi master)

our store's internet connection is not reliable ( may be down for 30 min), it is adsl , then we decided to get two internet connections from two different ISPs with static ip addressgalera cluster with local store

Questions are:

  1. Is it possible for a single galera node to have multiple public ips?

2.When both internet connections go down. Local galera node will be unavailable too , How can we can configure it to avoid this?

3.Do you have any recommendation or better solution in this regard?

Write-lock a whole table during transaction

$
0
0

I need to perform a delicate operation to my table in which I will solely insert, delete and select upon all of my rows and no God may interfere with the table during this operation: the table will be in an inconsistent state and any concurrent MySQL session shall not be allowed to modify it until commit-ed.

The use of SELECT ... FOR UPDATE | LOCK IN SHARE MODE is not suitable because, while it may potentially be used to lock all the rows in the table, it won't prevent the insertion of further rows by a concurrent session. Basically, I need to LOCK TABLES my_table WRITE within the body of a transaction.

The table contains about 20,000 rows and a master-slave, mixed-format replication is in place over a slow connection so, for any workaround, I'd prefer to avoid using temporary tables which may faint the slave, and the amount of data dumped into the binlog should ideally be minimized.

The engine is InnoDB on MySQL 5.6, for both master and slave.

Mysql replication, error 13 (permission denied) with slave_load_tmpdir

$
0
0

I've setup a virtual machine on Azure with Ubuntu 16.10 and Mysql 5.7 for a database replication Master/Slave from another server.

I followed this article: https://www.opsdash.com/blog/mysql-replication-howto.html

All seems to works correctly, replication works but I've serious problems with the use of DATA LOAD INFILE. If I use this command, the replication doesn't works.

I tried with relative varible "slave_load_tmpdir", creating a new directory '/var/slavetmp' and updating my.cnf with these values, but this is the error in mysql with "SHOW SLAVE STATUS":

Unable to use slave's temporary directory /var/slavetmp - Can't read dir of '/var/slavetmp/' (Errcode: 13 - Permission denied)

Have any ideas?

Thanks in advance

which is more faster for reading data from a replication table Python or SQL?

$
0
0

We have a live sql server replication table using Golden Gate and users want almost real time data thru reports. When we're running sql queries on those replication tables the query is taking more time to get the results. Is there any alternate way for reading the data faster instead of SQL?

Scheduled snapshots of views (without using materialized views or Oracle Golden Gate)?

$
0
0

I have 40 views in an Oracle 18c GIS database that are used in a map in a workorder management system (WMS).

  • The views are served up to the WMS map via a web service.
  • There are an average of 10,000 rows per view.

The views have joins to dblink-tables in a separate Oracle database, and as a result, are not fast enough for use in the WMS map (3-second map refresh delay). Furthermore, it seems like a bad idea to compute the views each time a user refreshes the map--since the map does not need to be up-to-date in real-time.

As an alternative, I would like to take snapshots of the views on a weekly basis. The snapshots would be static tables that would perform well in the WMS map.

The Catch:

Unfortunately, due to office politics issues, using technology like materialized views or Oracle's Golden Gate to solve this problem is not an option.


What are my options for taking scheduled snapshots of Oracle views (without using materialized views or Golden Gate)?

For example, I could make an .SQL script that truncates static tables and inserts the rows from the views into the tables (although, as a novice, I don't know how efficient or risky that option would be, or if there are better alternatives).

MySQL replication setup for high load Master

$
0
0

We have simple replication set up with 1 master and 1 slave. However, setting this up (after restart for instance) is always a difficult task. The moment between taking my database dump, noting the position of the binlog on the master and starting the slave back up, it seems data has already moved on (new inserts, updates, ...) and my slave is not able to start up.

The database has a lot of constraints between tables and this often is the reason data is not able to sync: a log for a specific consumers doesn't get synced because the consumer doesn't exist on the slave.

I can, sometimes, work around this by executing:

STOP SLAVE;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
START SLAVE;
SELECT SLEEP(2);
SHOW SLAVE STATUS;

But it feels very hack-y and a more a game of luck than anything else.

How should I go about this? I'm not really willing to shut down the master database in this process. How can I copy the data and start the slave at the exact position as the copied data?


MySQL master master replication, safe to delete rows on both masters?

$
0
0

We have a MySQL (v5.1.61) cluster with two masters (and two slaves). We have a table logs with a primary key column logID. This log table grows rather huge, and we'd like to delete data from it. So I've written a script that does that. — Is it safe to run this script on both masters? It deletes data only. What I'm wondering is what will the MySQL replication module do, if the row it's about to delete has already been deleted? Will replication break, or is it safe to delete rows on both masters? Does it matter if we use row based or statement based replication?

Example: The log data deletion script deletes row 123 on Master A. At the same time, the script deletes that same row on Master B. Then master B reads its relay log, and sees: "I should delete row 123, because it was deleted on Master A and I'm its slave. Let's delete it... ... ...but it's already gone!"— now what will Master B do? Will it halt replication, as if there was a duplicate key error? Or will it think "Fine, I need do nothing", and everything is okay.

Bootstrap for Confidence Intervals

$
0
0

My problem is as follows: Firstly, I have to create 1000 bootstrap samples of size 100 of a "theta hat". I have a random variable X which follows a scaled t_5-distribution. The following code creates 1000 bootstrap samples of theta hat:

library("metRology", lib.loc="~/R/win-library/3.4")
 # Draw some data
data <- rt.scaled(100, df=5, mean=0, sd=2)

thetahatsq <- function(x){(3/500)*sum(x^2)}
sqrt(thetahatsq(data))

n <- 100

thetahat <- function(x){sqrt(thetahatsq(x))}
thetahat(data)

# Draw 1000 samples of size 100 from the fitted distribution, and compute the thetahat
tstar<-replicate(1000,thetahat(rt.scaled(n, df=5, mean=0, sd=thetahat(data)))) 
mean(tstar)

hist(tstar, breaks=20, col="lightgreen")

Now I want to compare the accuracy of coverage probabilities and the widths of 95% bootstrap confidence intervals constructed using the percentile method. I want to repeat the code above 1000 times, and in each case, check if the true value of the parameter belongs to the corresponding bootstrap confidence interval and calculate the length of each interval. Then average the resulting values.

MongoDB replica set no primary and nodes unreachable

$
0
0

I am trying to create a basic replica set in mongoDB with 3 nodes (Primary and 2 secondaries). It worked for me once but suddenly I see in the rs.status() that the primary node is now secondary and the other 2 are just unreachable. I tried to reconfig, initiate but nothing works. All i accomplished is to remove 2 nodes and stay with 1 primary but whenever I try to add 2 nodes it gives me an error that the node is being reconfigured.

rs1:SECONDARY> rs.status()
{"set" : "rs1","date" : ISODate("2020-09-22T07:11:47.370Z"),"myState" : 2,"term" : NumberLong(3),"syncSourceHost" : "","syncSourceId" : -1,"heartbeatIntervalMillis" : NumberLong(2000),"majorityVoteCount" : 2,"writeMajorityCount" : 2,"votingMembersCount" : 3,"writableVotingMembersCount" : 3,"optimes" : {"lastCommittedOpTime" : {"ts" : Timestamp(1600758614, 1),"t" : NumberLong(3)
                },"lastCommittedWallTime" : ISODate("2020-09-22T07:10:14.325Z"),"appliedOpTime" : {"ts" : Timestamp(1600758624, 1),"t" : NumberLong(3)
                },"durableOpTime" : {"ts" : Timestamp(1600758624, 1),"t" : NumberLong(3)
                },"lastAppliedWallTime" : ISODate("2020-09-22T07:10:24.326Z"),"lastDurableWallTime" : ISODate("2020-09-22T07:10:24.326Z")
        },"lastStableRecoveryTimestamp" : Timestamp(1600758614, 1),"members" : [
                {"_id" : 0,"name" : "127.0.0.1:27011","health" : 1,"state" : 2,"stateStr" : "SECONDARY","uptime" : 3007,"optime" : {"ts" : Timestamp(1600758624, 1),"t" : NumberLong(3)
                        },"optimeDate" : ISODate("2020-09-22T07:10:24Z"),"syncSourceHost" : "","syncSourceId" : -1,"infoMessage" : "","configVersion" : 382587,"configTerm" : -1,"self" : true,"lastHeartbeatMessage" : ""
                },
                {"_id" : 1,"name" : "127.0.0.1:27012","health" : 0,"state" : 8,"stateStr" : "(not reachable/healthy)","uptime" : 0,"optime" : {"ts" : Timestamp(0, 0),"t" : NumberLong(-1)
                        },"optimeDurable" : {"ts" : Timestamp(0, 0),"t" : NumberLong(-1)
                        },"optimeDate" : ISODate("1970-01-01T00:00:00Z"),"optimeDurableDate" : ISODate("1970-01-01T00:00:00Z"),"lastHeartbeat" : ISODate("2020-09-22T07:11:42.692Z"),"lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),"pingMs" : NumberLong(0),"lastHeartbeatMessage" : "Couldn't get a connection within the time limit of 500ms","syncSourceHost" : "","syncSourceId" : -1,"infoMessage" : "","configVersion" : -1,"configTerm" : -1
                },
                {"_id" : 2,"name" : "127.0.0.1:27013","health" : 0,"state" : 8,"stateStr" : "(not reachable/healthy)","uptime" : 0,"optime" : {"ts" : Timestamp(0, 0),"t" : NumberLong(-1)
                        },"optimeDurable" : {"ts" : Timestamp(0, 0),"t" : NumberLong(-1)
                        },"optimeDate" : ISODate("1970-01-01T00:00:00Z"),"optimeDurableDate" : ISODate("1970-01-01T00:00:00Z"),"lastHeartbeat" : ISODate("2020-09-22T07:11:42.692Z"),"lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),"pingMs" : NumberLong(0),"lastHeartbeatMessage" : "Couldn't get a connection within the time limit of 500ms","syncSourceHost" : "","syncSourceId" : -1,"infoMessage" : "","configVersion" : -1,"configTerm" : -1
                }
        ],"ok" : 1,"$clusterTime" : {"clusterTime" : Timestamp(1600758624, 1),"signature" : {"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),"keyId" : NumberLong(0)
                }
        },"operationTime" : Timestamp(1600758624, 1)
}

Also when I try to create config file with the 3 node memeber and then rs.initiate() i get error messsage "errmsg" : "already initialized".

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.

Oracle DB Replication/Data Transfer

$
0
0

enter image description here

I need to replicate an oracle database without updating each other just for backup purposes.

I have a Main DB(MDB) that have jobs to send to be processed data to interface DB(IDB). IDB will be updated by an external application. I want the backup of IDB without updating changes to replicated IDB. I can not control Main DB job to send IDB data for another IDB for back up so I need a software solution. I there any software solution that can do this scenario?

Viewing all 17268 articles
Browse latest View live


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