How often the slave to pull data from master?
Hello: I haven't read the source code of mysql ,but as I know ,the slave get data from master server, rather than the master push data to slave. I think there is a timer to do this. Who can tell me the interval about the replicationhow often the slave to pull data from master? Thanks! Zhigang Zhang
how often the slave to pull data from master?
Hello: I haven't read the source code of mysql ,but as I know ,the slave get data from master server, rather than the master push data to slave. I think there is a timer to do this. Who can tell me the interval about the replicationhow often the slave to pull data from master? Thanks! Zhigang Zhang -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
Re: how often the slave to pull data from master?
Please can someone correct me if I am wrong. It doesn't work with timer. On your *master*, you need to activate the binaries log. Everytime and UPDATE/INSERT/DELETE is done on the master mysql server, the event is recorded within those binaries log. On your *slave* - if it is activated to act as a slave- you should have 2 Thread running all the time. One that reads the Master binaries log file, aka I/O Thread ( http://dev.mysql.com/doc/refman/5.0/en/slave-io-thread-states.html) . And one to apply those changes locally, aka SQL Thread ( http://dev.mysql.com/doc/refman/5.0/en/slave-sql-thread-states.html) So from my understanding it is not time driven, but event driven. On Thu, Jul 26, 2012 at 11:25 AM, Zhigang Zhang zzgang2...@gmail.comwrote: Hello: I haven't read the source code of mysql ,but as I know ,the slave get data from master server, rather than the master push data to slave. I think there is a timer to do this. Who can tell me the interval about the replicationhow often the slave to pull data from master? Thanks! Zhigang Zhang -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql -- *Yanis Guenane*
Re: How often the slave to pull data from master?
- Original Message - From: Zhigang Zhang zzgang2...@gmail.com I haven't read the source code of mysql ,but as I know ,the slave get I think there is a timer to do this. You have also not read the documentation, then. There is not. Replication is continuous: the slave opens a permanent connection to the master, and the master simply pushes every new binary log entry over that connection to the slave. -- Linux Bier Wanderung 2012, now also available in Belgium! August, 12 to 19, Diksmuide, Belgium - http://lbw2012.tuxera.be -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
Re: Exporting to CSV. Error Code: 2013. Lost connection to MySQL server during query
Thanks Dhaval. Putting the join condition before INTO outfile doesn't seem to work, either. When I try to use the same outfile name 'test123.csv' I get Error Code: 1086 File 'test123.csv' already exists. But then when I try to find the csv file on my computer, there is a folder with that name, but weird files in it, none of which are a csv-- and certainly not in the location that I thought it would be (the same directory that the .sql query is in). Additionally, when I try to identify a different path, such as 'C:\\' etc, I get an error. This error is: Error Code: 1. Can't create/write to file C:\test123.csv(Errocde: 2). I tried running the query outputting to a different named .csv file, but it is still just running... and seems like it was like yesterday where after 10 minutes I will get the Error that the MySQL connection was lost. Does anyone have an idea of what is going on? On Wed, Jul 25, 2012 at 9:22 PM, Dhaval Jaiswal dhaval.jais...@via.comwrote: SELECT * FROM test INTO OUTFILE '/home/test.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '' LINES TERMINATED BY '\n' as above give your join condition before INTO OUTFILE. On Thu, Jul 26, 2012 at 1:32 AM, Fred G bayespoker...@gmail.com wrote: Hi-- I'm trying to do the following: SELECT db.emp.emp_fname, db.emp.emp_fname, db.sale.sale_date, db.sale.sale_no, db.sale.sale_total_amt into outfile 'test123.csv' FIELDS terminated by ',' FROM db.emp LEFT OUTER JOIN db.sale ON db.sale.emp_id = db.emp.emp_id; The query without exporting the file works fine, in about 12 sec/77 sec. I read online how to export MySQL queries into csv's, and I'm not sure what I am doing wrong. I keep getting the error: Error Code: 2013. Lost connection to MySQL server during query, where the duration/fetch values are 600.547 sec (~10 minutes). I'm wondering: a) What is going on? b) How do I fix it? Thanks so much!! -- [image: Inline image 2] http://www.via.com/ *Dhaval* | Database System *E:* dhaval.jais...@via.com ra...@via.com| *T:* 080 4043 3000 | *M:* +91 - 8095 397 843 [image: all-icon.jpg] http://www.via.com/
Re: How often the slave to pull data from master?
Yes, the slave pulls from the master. The slave io thread reads the information effectively as soon as it is written to the master's binary log. Keith On Jul 26, 2012 4:17 AM, Zhigang Zhang zzgang2...@gmail.com wrote: Hello: I haven't read the source code of mysql ,but as I know ,the slave get data from master server, rather than the master push data to slave. I think there is a timer to do this. Who can tell me the interval about the replicationhow often the slave to pull data from master? Thanks! Zhigang Zhang
RE: How often the slave to pull data from master?
My understanding is... * There is a permanent connection (TCP/IP socket) between the Master and each Slave. This is opened by the Slave when the slave starts (or restarts or recovers from a network glitch). * Master writes to binlog _and_ to that connection whenever there is a 'write' operation. (I do not know whether the binlog is written/flushed before or after or simultaneous with writing to the Slave(s).) * If the connection is interrupted, the Slave will reconnect and ask the Master for old info. This comes from the binlog. Otherwise, the Master's binlog file is not part of the flow of data from Master to Slave. * Semi-sync (5.5) adds some chatter from Slave to Master so that the Master can wait for at least one Slave to have written to its relay log. * Percona Cluster, Galera, etc., add more complexity to the replication traffic. -Original Message- From: Keith Murphy [mailto:bmur...@paragon-cs.com] Sent: Thursday, July 26, 2012 9:45 AM To: Zhigang Zhang Cc: mysql@lists.mysql.com Subject: Re: How often the slave to pull data from master? Yes, the slave pulls from the master. The slave io thread reads the information effectively as soon as it is written to the master's binary log. Keith On Jul 26, 2012 4:17 AM, Zhigang Zhang zzgang2...@gmail.com wrote: Hello: I haven't read the source code of mysql ,but as I know ,the slave get data from master server, rather than the master push data to slave. I think there is a timer to do this. Who can tell me the interval about the replicationhow often the slave to pull data from master? Thanks! Zhigang Zhang -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
Re: Exporting to CSV. Error Code: 2013. Lost connection to MySQL server during query
2012/07/26 06:52 +0530, Dhaval Jaiswal SELECT * FROM test INTO OUTFILE '/home/test.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '' LINES TERMINATED BY '\n' as above give your join condition before INTO OUTFILE. Right: MySQL server writes into some directory where it is, not where MySQL client is. If less than a full path name is given, almost certainly the server will attempt to write into a directory to which it has no permission, and almost certainly also not into one that you want it to write into. If server and client run on separate machines with separate disks, there is no means through OUTFILE of there setting the output where the client is, only through client s standard output, where you get no choice of field separator, line separator, or field-quote character (there is none), although you can keep or skip the column names (-N for skipping them), and suppress the one-character escape character (-r), same as FIELDS ESCAPED BY ''. There is no means of skipping NULL or \N for nulls, which is not CSV format. And if your MySQL is under Windows, be sure to read all instructions about entering full pathnames. It is best to avoid the backslash (\), because that is a C-escape introduced (along with much other C-stuff) into SQL s original PL1. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
Re: How often the slave to pull data from master?
Hello Rick, You nearly got it all correct. On 7/26/2012 1:21 PM, Rick James wrote: My understanding is... * There is a permanent connection (TCP/IP socket) between the Master and each Slave. This is opened by the Slave when the slave starts (or restarts or recovers from a network glitch). * Master writes to binlog _and_ to that connection whenever there is a 'write' operation. (I do not know whether the binlog is written/flushed before or after or simultaneous with writing to the Slave(s).) The slave is sent a signal that more data is available. The slave then requests that data from the master's binary log at the 'next' position it expects it to be. If there are additional events beyond that, it retrieves those in sequence after it writes the current statement into the relay logs. * If the connection is interrupted, the Slave will reconnect and ask the Master for old info. This comes from the binlog. Otherwise, the Master's binlog file is not part of the flow of data from Master to Slave. Once the slave can reconnect, it asks for the 'next' statement in sequence (based on the end of the last statement it has received). Any statements beyond that already in the binary logs retrieved in sequence. If there is no 'next' statement, it waits for a signal that more data is available. If the binary log was shortened (which can occasionally happen during an InnoDB recovery processing) the slave throws an error and waits for the DBA to fix things. The removal of statements and the conditions necessary to remove some events from the end of the binary log is discussed here: http://dev.mysql.com/doc/refman/5.1/en/binary-log.html * Semi-sync (5.5) adds some chatter from Slave to Master so that the Master can wait for at least one Slave to have written to its relay log. * Percona Cluster, Galera, etc., add more complexity to the replication traffic. ... Yours, -- Shawn Green MySQL Principal Technical Support Engineer Oracle USA, Inc. - Hardware and Software, Engineered to Work Together. Office: Blountville, TN -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
Re: Exporting to CSV. Error Code: 2013. Lost connection to MySQL server during query
Thanks! On Thu, Jul 26, 2012 at 12:05 AM, h...@tbbs.net wrote: 2012/07/26 06:52 +0530, Dhaval Jaiswal SELECT * FROM test INTO OUTFILE '/home/test.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '' LINES TERMINATED BY '\n' as above give your join condition before INTO OUTFILE. Right: MySQL server writes into some directory where it is, not where MySQL client is. If less than a full path name is given, almost certainly the server will attempt to write into a directory to which it has no permission, and almost certainly also not into one that you want it to write into. If server and client run on separate machines with separate disks, there is no means through OUTFILE of there setting the output where the client is, only through client s standard output, where you get no choice of field separator, line separator, or field-quote character (there is none), although you can keep or skip the column names (-N for skipping them), and suppress the one-character escape character (-r), same as FIELDS ESCAPED BY ''. There is no means of skipping NULL or \N for nulls, which is not CSV format. And if your MySQL is under Windows, be sure to read all instructions about entering full pathnames. It is best to avoid the backslash (\), because that is a C-escape introduced (along with much other C-stuff) into SQL s original PL1. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
store transaction rollback information
I have a large series of mysql changes(inserts/deletes/updates) taking place in a transaction. After committing there may be some times where I need to roll those changes back later on. Is there an easy way of determining what was changed in a transaction in a way I can store it and rollback later? Thanks