Will the new BinLogStreamReader kill the old one?

236 views
Skip to first unread message

Jack Wang

unread,
Jan 10, 2016, 10:33:14 PM1/10/16
to Python MySQL replication
When I kicked off my second BinlogStreamReader, the first one(the running one) was suddenly stopped. Was the new BinlogStreamReader killed the current running one? The two StreamReader were reading the same bin-log file from the same mysql server.
My code as following:
self.stream = BinLogStreamReader(connection_settings = mysql_settings,only_events = [DeleteRowsEvent, WriteRowsEvent, UpdateRowsEvent], blocking = True, resume_stream =True, server_id=2, log_file=bin-log.1098, log_pos=88569)


Thanks in advance!

Julien Duponchelle

unread,
Jan 11, 2016, 2:21:57 AM1/11/16
to Jack Wang, Python MySQL replication
If you use the same server id, MySQL will kill the first connection

--
You received this message because you are subscribed to the Google Groups "Python MySQL replication" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-mysql-repli...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jack Wang

unread,
Jan 11, 2016, 11:45:40 AM1/11/16
to Python MySQL replication, wangji...@gmail.com
Thanks a lot! how should I do please, to let mysql support multiple ServerId.

To unsubscribe from this group and stop receiving emails from it, send an email to python-mysql-replication+unsub...@googlegroups.com.

Julien Duponchelle

unread,
Jan 11, 2016, 11:56:17 AM1/11/16
to Jack Wang, Python MySQL replication
self.stream = BinLogStreamReader(connection_settings = mysql_settings,only_events =[DeleteRowsEvent, WriteRowsEvent, UpdateRowsEvent], blocking = True, resume_stream=True, server_id=2, log_file=bin-log.1098, log_pos=88569)

Change server_id to  a unique value ;

To unsubscribe from this group and stop receiving emails from it, send an email to python-mysql-repli...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Python MySQL replication" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-mysql-repli...@googlegroups.com.

Jack Wang

unread,
Jan 11, 2016, 12:44:35 PM1/11/16
to Python MySQL replication, wangji...@gmail.com
Thanks a lot Julien, what do you mean change server_id to a unique value, it's using unique value now server_id=2. The following is my config of my.cfg:
log-bin = /database/mysqllogs/bin-log
server-id= 2
relay-log= /database/mysqllogs/relay-log
relay-log-index= /database/mysql/mysql-relay-bin.index
Could you please give me more detailed solution :-)
Thanks in advance!

Jack

On Monday, January 11, 2016 at 8:56:17 AM UTC-8, Julien Duponchelle wrote:
self.stream = BinLogStreamReader(connection_settings = mysql_settings,only_events =[DeleteRowsEvent, WriteRowsEvent, UpdateRowsEvent], blocking = True, resume_stream=True, server_id=2, log_file=bin-log.1098, log_pos=88569)

Change server_id to  a unique value ;

Le lun. 11 janv. 2016 à 17:45, Jack Wang <wangji...@gmail.com> a écrit :
Thanks a lot! how should I do please, to let mysql support multiple ServerId.


On Sunday, January 10, 2016 at 11:21:57 PM UTC-8, Julien Duponchelle wrote:
If you use the same server id, MySQL will kill the first connection

Le lun. 11 janv. 2016 à 04:33, Jack Wang <wangji...@gmail.com> a écrit :
When I kicked off my second BinlogStreamReader, the first one(the running one) was suddenly stopped. Was the new BinlogStreamReader killed the current running one? The two StreamReader were reading the same bin-log file from the same mysql server.
My code as following:
self.stream = BinLogStreamReader(connection_settings = mysql_settings,only_events = [DeleteRowsEvent, WriteRowsEvent, UpdateRowsEvent], blocking = True, resume_stream =True, server_id=2, log_file=bin-log.1098, log_pos=88569)


Thanks in advance!

--
You received this message because you are subscribed to the Google Groups "Python MySQL replication" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-mysql-replication+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Python MySQL replication" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-mysql-replication+unsub...@googlegroups.com.

Julien Duponchelle

unread,
Jan 11, 2016, 3:07:33 PM1/11/16
to Jack Wang, Python MySQL replication
server_id could be anything you need to have an unique id by client of the replication stream.

For example:
your master server will use server_id=1
one mysql server slave  will have 2
one your script using python mysql replication will use 3
another script using python mysql replication will use 4

You just need to change the value in the call:
self.stream = BinLogStreamReader(connection_settings = mysql_settings,only_events =[DeleteRowsEvent, WriteRowsEvent, UpdateRowsEvent], blocking = True, resume_stream =True,server_id=2, log_file=bin-log.1098, log_pos=88569)

Le lun. 11 janv. 2016 à 18:44, Jack Wang <wangji...@gmail.com> a écrit :
Thanks a lot Julien, what do you mean change server_id to a unique value, it's using unique value now server_id=2. The following is my config of my.cfg:
log-bin = /database/mysqllogs/bin-log
server-id= 2
relay-log= /database/mysqllogs/relay-log
relay-log-index= /database/mysql/mysql-relay-bin.index
Could you please give me more detailed solution :-)
Thanks in advance!

Jack

On Monday, January 11, 2016 at 8:56:17 AM UTC-8, Julien Duponchelle wrote:
self.stream = BinLogStreamReader(connection_settings = mysql_settings,only_events =[DeleteRowsEvent, WriteRowsEvent, UpdateRowsEvent], blocking = True, resume_stream=True, server_id=2, log_file=bin-log.1098, log_pos=88569)

Change server_id to  a unique value ;

Le lun. 11 janv. 2016 à 17:45, Jack Wang <wangji...@gmail.com> a écrit :
Thanks a lot! how should I do please, to let mysql support multiple ServerId.


On Sunday, January 10, 2016 at 11:21:57 PM UTC-8, Julien Duponchelle wrote:
If you use the same server id, MySQL will kill the first connection

Le lun. 11 janv. 2016 à 04:33, Jack Wang <wangji...@gmail.com> a écrit :
When I kicked off my second BinlogStreamReader, the first one(the running one) was suddenly stopped. Was the new BinlogStreamReader killed the current running one? The two StreamReader were reading the same bin-log file from the same mysql server.
My code as following:
self.stream = BinLogStreamReader(connection_settings = mysql_settings,only_events = [DeleteRowsEvent, WriteRowsEvent, UpdateRowsEvent], blocking = True, resume_stream =True, server_id=2, log_file=bin-log.1098, log_pos=88569)


Thanks in advance!

--
You received this message because you are subscribed to the Google Groups "Python MySQL replication" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-mysql-repli...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Python MySQL replication" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-mysql-repli...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Python MySQL replication" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-mysql-repli...@googlegroups.com.

Jack Wang

unread,
Jan 12, 2016, 12:02:34 AM1/12/16
to Python MySQL replication, wangji...@gmail.com
That's great! A very big thanks for you! It does help me a lot!

Best Regards,
Jack
To unsubscribe from this group and stop receiving emails from it, send an email to python-mysql-replication+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Python MySQL replication" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-mysql-replication+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Python MySQL replication" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-mysql-replication+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages