需求 :进行商品搜索的时候,要从索引中进行搜索,由于后台要更新商品和插入商品,当时考虑到了怎么来插入新的索引和更新索引的问题,通过讨论,大家决定用Httpsqs这个消息中间来通知插入新索引和删除索引最后合并索引,来做到商品信息的实时更新。
下面我来讲一下Httpsqs的安装过程 ,以及在安装过程遇到的问题。
准备工作:
你需要准备一个虚拟机这里我们采用VMware7.1,
Linux采用CentOS5.4 可以到这个网址进行下载。
安装 httpsqs
在安装httpsqs之前要安装
libevent-2.0.12-stable.tar.gz和okyocabinet-1.4.47.tar.gz
ulimit -SHn 65535
1、安装libevent-2.0.12-stable.tar.gzwget ##下载 tar zxvf libevent-2.0.12-stable.tar.gz##解压 cd libevent-2.0.12-stable/ ./configure --prefix=/usr/local/libevent-2.0.12-stable/ make make install cd ../
安装tokyocabinet-1.4.47.tar.gzwget tar zxvf tokyocabinet-1.4.47.tar.gz cd tokyocabinet-1.4.47/ ./configure --prefix=/usr/local/tokyocabinet-1.4.47/ #注:在32位Linux操作系统上编译Tokyo cabinet,请使用./configure --enable-off64代替./configure,可以使数据库文件突破2GB的限制。 #./configure --enable-off64 --prefix=/usr/local/tokyocabinet-1.4.47/ make make install cd ../
当执行第二步骤的会出错,是由于缺少bzip2-1.0.6.tar.gz下面进行安装
安装开始; wget tar -xvzf bzip2-1.0.6.tar.gz cd bzip2-1.0.6. make make install
在重复安装tokyocabinet-1.4.47.tar.gz还是失败,由于缺少zlib-1.2.5.tar.gz下面进行安装
安装开始; wget tar -xvzf zlib-1.2.5.tar.gz cd zlib-1.2.5. ./configure make sudo make instal
继续第2步骤 OK3、安装httpsqs-1.7.tar.gz
wget tar zxvf httpsqs-1.7.tar.gz cd httpsqs-1.7/ make make install cd ../
如果安装成功 执行httpsqs –h 会出现-------------------------------------------------------------------------------------------------- HTTP Simple Queue Service - httpsqs v1.7 (April 14, 2011) Author: Zhang Yan (), E-mail: net@s135.com This is free software, and you are welcome to modify and redistribute it under the New BSD License -l <ip_addr> interface to listen on, default is 0.0.0.0 -p <num> TCP port number to listen on (default: 1218) -x <path> database directory (example: /opt/httpsqs/data) -t <second> keep-alive timeout for an http request (default: 60) -s <second> the interval to sync updated contents to the disk (default: 5) -c <num> the maximum number of non-leaf nodes to be cached (default: 1024) -m <size> database memory cache size in MB (default: 100) -i <file> save PID in <file> (default: /tmp/httpsqs.pid) -a <auth> the auth password to access httpsqs (example: mypass123) -d run as a daemon -h print this help and exit Use command "killall httpsqs", "pkill httpsqs" and "kill `cat /tmp/httpsqs.pid`" to stop httpsqs. Please note that don't use the command "pkill -9 httpsqs" and "kill -9 PID of httpsqs"! Please visit "http://code.google.com/p/httpsqs" for more help information.
但是没有 出现的是: