少年阿賓

          那些青春的歲月

            BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
            500 Posts :: 0 Stories :: 135 Comments :: 0 Trackbacks
          我這里使用的是Centos6.4的環境下面測試的:
          ulimit -SHn 65535
          安裝:libevent-2.0.12-stable.tar.gz

          wget http://httpsqs.googlecode.com/files/libevent-2.0.12-stable.tar.gz
          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.gz
          wget http://httpsqs.googlecode.com/files/tokyocabinet-1.4.47.tar.gz
          tar zxvf tokyocabinet-1.4.47.tar.gz
          cd tokyocabinet-1.4.47/
          ./configure --prefix=/usr/local/tokyocabinet-1.4.47/
          #Note: In the 32-bit Linux operating system, compiler Tokyo cabinet, please use the ./configure --enable-off64 instead of ./configure to breakthrough the filesize limit of 2GB.
          #./configure --enable-off64 --prefix=/usr/local/tokyocabinet-1.4.47/
          make
          make install
          cd ../

          ##執行上面這個tokyocabinet-1.4.47.tar.gz軟件包安裝的時候,對于32bit的機器,需要使用
          #./configure --enable-off64 --prefix=/usr/local/tokyocabinet-1.4.47/
          這個命令,此外我安裝的過程中,出現了這個錯誤提示,提示tokyocabinet-1.4.47.tar.gz安裝不成功,解決辦法是,安裝需要的軟件包就可以了.

          錯誤提示一:
          configure: error: zlib.h is required
          解決方法是:  # yum install zlib-devel
          錯誤提示二:
          configure: error: bzlib.h is required
          解決方法是:  # yum install bzip2-devel

          下面進入到了正式環節,上面裝的兩個都是為了httpsqs的安裝做的前提準備:
          安裝:httpsqs-1.7.tar.gz
          wget http://httpsqs.googlecode.com/files/httpsqs-1.7.tar.gz
          tar zxvf httpsqs-1.7.tar.gz
          cd httpsqs-1.7/
          make
          make install
          cd ../

          至此安裝已經結束:

          [root@xoyo ~]# httpsqs -h
          -l <ip_addr> 監聽的IP地址,默認值為 0.0.0.0 
          -p <num> 監聽的TCP端口(默認值:1218)
          -x <path> 數據庫目錄,目錄不存在會自動創建(例如:/opt/httpsqs/data)
          -t <second> HTTP請求的超時時間(默認值:3)
          -s <second> 同步內存緩沖區內容到磁盤的間隔秒數(默認值:5)
          -c <num> 內存中緩存的最大非葉子節點數(默認值:1024)
          -m <size> 數據庫內存緩存大小,單位:MB(默認值:100)
          -i <file> 保存進程PID到文件中(默認值:/tmp/httpsqs.pid)
          -a <auth> 訪問HTTPSQS的驗證密碼(例如:mypass123)
          -d 以守護進程運行
          -h 顯示這個幫助


          [root@localhost ~]# ulimit -SHn 65535
          [root@localhost ~]# httpsqs -d -p 1218 -x /data0/queue -a mypass123
          [root@localhost ~]# ps -aux | grep httpsqs
          Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
          root 14378 0.0 0.0 396420 500 pts/0 S 10:44 0:00 [httpsqs: master process] /usr/bin/httpsqs -d -p 1218 -x /data0/queue -a mypass123
          root 14379 0.0 0.0 406664 716 pts/0 Sl 10:44 0:00 [httpsqs: worker process] /usr/bin/httpsqs -d -p 1218 -x /data0/queue -a mypass123
          root 14382 0.0 0.0 4356 756 pts/0 S+ 10:44 0:00 grep httpsqs
          1、put a queue
          [root@localhost ~]# curl "http://192.168.59.129:1218/?name=your_queue_name&opt=put&data=url_encoded_text_message&auth=mypass123"
          HTTPSQS_PUT_OK

          [root@localhost ~]#
          如果入隊列成功,返回:
          HTTPSQS_PUT_OK

            如果入隊列失敗,返回:
          HTTPSQS_PUT_ERROR

            如果隊列已滿,返回:
          HTTPSQS_PUT_END
          2、get a queue
          http://192.168.59.129:1218/?name=your_queue_name&opt=get&auth=mypass123
          url_encoded_text_message
          3、查看隊列狀態:
          http://192.168.59.129:1218/?name=your_queue_name&opt=status&auth=mypass123
          HTTP Simple Queue Service v1.7
          ------------------------------
          Queue Name: your_queue_name
          Maximum number of queues: 1000000
          Put position of queue (1st lap): 5
          Get position of queue (1st lap): 0
          Number of unread queue: 5
          4、使用json格式查看隊列內容

          http://192.168.59.129:1218/?name=your_queue_name&opt=status_json&auth=mypass123
          {"name":"your_queue_name","maxqueue":1000000,"putpos":5,"putlap":1,"getpos":1,"getlap":1,"unread":4}


          參考文檔:http://blog.s135.com/httpsqs/7/1/
          http://code.google.com/p/httpsqs/

          posted on 2014-03-01 15:26 abin 閱讀(1126) 評論(0)  編輯  收藏 所屬分類: httpsqs

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 新河县| 抚顺县| 迭部县| 河源市| 新乡县| 无锡市| 徐闻县| 晋州市| 鄱阳县| 乌什县| 连云港市| 同仁县| 丰台区| 综艺| 奈曼旗| 滦平县| 连南| 勐海县| 名山县| 商城县| 分宜县| 商都县| 通渭县| 卫辉市| 耿马| 海晏县| 闸北区| 昆明市| 会昌县| 陕西省| 平顶山市| 循化| 尼勒克县| 伊宁市| 景德镇市| 叙永县| 观塘区| 宁夏| 宜川县| 高邑县| 乌拉特后旗|