gearman php mysql_利用gearman同步mysql数据到redis

本文介绍了如何利用Gearman框架将MySQL数据同步到Redis。首先讲解了Gearman的体系结构,接着详细阐述了安装Gearmand服务的过程,包括升级boost库、解决编译错误等。然后介绍了安装php-gearman、lib_mysqludf_json和gearman-mysql-udf的步骤,创建Gearman function,并在MySQL中设置触发器以在数据更新时同步到Redis。最后提供了worker脚本gearman_worker.php用于处理同步任务。
摘要由CSDN通过智能技术生成

一.Gearman

1.Gearman是一个分发任务的程序框架.

2.体系:

a.client:发送一个job

b.server:找到合适的worker,把job交给该worker

c.worker:处理job

二.安装Gearmand服务

1.Gearman

a.官网

http://gearman.org/

b.官网下载:

https://launchpad.net/gearmand

2.安装依赖库

# yum install -y boost boost-devel gperf libevent-devel libuuid-devel

ps:要求boost版本至少大于1.39,系统之前安装的是1.3;所以需要升级

3.升级boost到1.55.0

a.下载boost_1_55_0.tar.bz2

http://downloads.sourceforge.net/project/boost/boost/1.55.0/boost_1_55_0.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fboost%2Ffiles%2Fboost%2F1.55.0%2F&ts=1385953406&use_mirror=softlayer-ams

b.解压

c. 安装

./bootstrap.sh

./b2

./b2 install

4.安装Gearman

a.解压

b.编译

./configure --prefix=/usr/local/gearmand --with-boost=/usr/local/boost/ --with-boost-libdir=/usr/local/boost/lib

c.make

出现错误:error: cinttypes: No such file or directory

安装:gcc44等

yum install gcc44 gcc44-c++ libstdc++44-devel -y

在/etc/profile中加入

export CC=/usr/bin/gcc44 or export CC=/usr/bin/gcc

export CXX=/u

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值