Git Product home page Git Product logo

mysql-replication's Introduction

php-mysql-replication

参考python版本:https://github.com/noplay/python-mysql-replication

运行环境

目前只支持数据库utf8编码
php版本>=5.4
mysql版本>=5.1
需要安装php sockets扩展
运行用户需要有创建文件的权限

Config.php 配置文件

运行run.php 目前只支持row模式
项目中 可以用supervisor监控 run.php 进程
Connect::analysisBinLog bool true存储当前的file pos
本例中 通过读取binlog存储到kafka中 kafka版本 0.8.2.0
kafka-client 用到了github开源的一个项目 https://github.com/nmred/kafka-php
BinLogPack.php打印了事件类型

配置mysql,打开mysql的binlog,配置binlog格式为row

log-bin=mysql-bin
server-id=1
binlog_format=row

持久化

file-pos 保存了当前读取到binlog的filename和pos,保证程序异常退出后能继续读取binlog
新项目运行时 要删除file-pos,从当前show master status,读取到的filename pos开始读取
可以设置file-pos,程序则从当前设置的位置读取binlog

流程

image

联系我

任何问题可以mail
[email protected]
QQ:838⑤91688

mysql-replication's People

Contributors

fengxiangyun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mysql-replication's Issues

pack/RowEvent.php 第 534 出现严重拼写错误导致 update 事件不能获取 before

pack/RowEvent.php 第 534 行 $value['beform'] 拼写错误 应为 $value['before']

` private static function _getUpdateRows($result, $len) {
$rows = [];
while(!self::$PACK->isComplete(self::$PACK_SIZE)) {

        $value['beform'] = self::_read_column_data($result['bitmap1'], $len);
        $value['after'] = self::_read_column_data($result['bitmap2'], $len);
        $rows[] = $value['after'];
    }
    return $rows;
}`

导致 update 事件不能获取 before 数据

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.