CentOS6.6安装mysql2redis
时间:2014-11-10 23:47 来源:linux.it.net.cn 作者:IT
1、安装apr
下载:http://apache.dataguru.cn//apr/apr-1.5.1.tar.gz
tar zxvf apr-1.5.1.tar.gz
cd apr-1.5.1
vi configure 找到$RM “$cfgfile”这行删掉
./configure --prefix=/usr/local/apr
make
make install
2、安装apr-util
下载:http://mirror.bit.edu.cn/apache//apr/apr-util-1.5.4.tar.gz
tar zxvf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4./configure --with-apr=/usr/local/apr
make
make install
3、安装hiredis
下载:https://github.com/redis/hiredis/archive/master.zip
解压后上传到服务器
cd hiredis-master
make
mkdir /usr/lib/hiredis
cp libhiredis.so /usr/lib/hiredis
cp libhiredis.so /usr/lib/
cp libhiredis.so /usr/lib64/
mkdir /usr/include/hiredis
cp hiredis.h /usr/include/hiredis
4、安装lib_mysqludf_json
下载:https://github.com/mysqludf/lib_mysqludf_json/archive/master.zip
压后上传到服务器
cd lib_mysqludf_json-master
rm lib_mysqludf_json.so
gcc $(mysql_config --cflags) -shared -fPIC -o lib_mysqludf_json.so lib_mysqludf_json.c
cp lib_mysqludf_json.so /usr/local/mysql/lib/plugin/
5、安装mysql2redis
下载:https://github.com/dawnbreaks/mysql2redis/archive/master.zip
压后上传到服务器
cd mysql2redis-master
vi Makefile (替换如下代码)
PLUGINDIR = "/usr/local/mysql/lib/plugin"
INCLUDE=`/usr/local/mysql/bin/mysql_config --include` -I/usr/local/include -I/usr/local/apr/include -I./
LIBS=-lhiredis -L$(PLUGINDIR) -L/usr/local/apr/lib -lapr-1 -laprutil-1
compile:
gcc -Werror -O2 -g $(INCLUDE) -I. -fPIC -shared -rdynamic lib_mysqludf_redis.c $(LIBS) -o lib_mysqludf_redis_v2.so
install:
gcc -Werror -O2 -g $(INCLUDE) -I. -fPIC -shared -rdynamic lib_mysqludf_redis.c \
$(LIBS) -o ${PLUGINDIR}/lib_mysqludf_redis_v2.so
uninstall:
rm -f $(PLUGINDIR)/lib_mysqludf_redis_v2.so
clean:
rm -f *~
rm -f *.so
rm -f *.out
退出保存
make
cp lib_mysqludf_redis_v2.so /usr/local/mysql/lib/plugin/
(责任编辑:IT)
1、安装apr 下载:http://apache.dataguru.cn//apr/apr-1.5.1.tar.gz tar zxvf apr-1.5.1.tar.gz cd apr-1.5.1 vi configure 找到$RM “$cfgfile”这行删掉 ./configure --prefix=/usr/local/apr make make install 2、安装apr-util 下载:http://mirror.bit.edu.cn/apache//apr/apr-util-1.5.4.tar.gz tar zxvf apr-util-1.5.4.tar.gz cd apr-util-1.5.4./configure --with-apr=/usr/local/apr make make install 3、安装hiredis 下载:https://github.com/redis/hiredis/archive/master.zip 解压后上传到服务器 cd hiredis-master make mkdir /usr/lib/hiredis cp libhiredis.so /usr/lib/hiredis cp libhiredis.so /usr/lib/ cp libhiredis.so /usr/lib64/ mkdir /usr/include/hiredis cp hiredis.h /usr/include/hiredis 4、安装lib_mysqludf_json 下载:https://github.com/mysqludf/lib_mysqludf_json/archive/master.zip 压后上传到服务器 cd lib_mysqludf_json-master rm lib_mysqludf_json.so gcc $(mysql_config --cflags) -shared -fPIC -o lib_mysqludf_json.so lib_mysqludf_json.c cp lib_mysqludf_json.so /usr/local/mysql/lib/plugin/ 5、安装mysql2redis 下载:https://github.com/dawnbreaks/mysql2redis/archive/master.zip 压后上传到服务器 cd mysql2redis-master vi Makefile (替换如下代码) PLUGINDIR = "/usr/local/mysql/lib/plugin" INCLUDE=`/usr/local/mysql/bin/mysql_config --include` -I/usr/local/include -I/usr/local/apr/include -I./ LIBS=-lhiredis -L$(PLUGINDIR) -L/usr/local/apr/lib -lapr-1 -laprutil-1 compile: gcc -Werror -O2 -g $(INCLUDE) -I. -fPIC -shared -rdynamic lib_mysqludf_redis.c $(LIBS) -o lib_mysqludf_redis_v2.so install: gcc -Werror -O2 -g $(INCLUDE) -I. -fPIC -shared -rdynamic lib_mysqludf_redis.c \ $(LIBS) -o ${PLUGINDIR}/lib_mysqludf_redis_v2.so uninstall: rm -f $(PLUGINDIR)/lib_mysqludf_redis_v2.so clean: rm -f *~ rm -f *.so rm -f *.out 退出保存 make cp lib_mysqludf_redis_v2.so /usr/local/mysql/lib/plugin/
|