Can memcacheq be installed and used in the window environment? I was just getting started with memcacheq. Is there any help from my predecessors. Can this be installed in windows. And the method used in this section. The younger brother is grateful. ------ Solution ------------------ memcacheQ is a pure distributed message queue service. Its installation depends on BerkeleyDB and libevent. Therefore, you must first install and use memcacheq in the window environment.
I was just getting started with memcacheq. could you help me introduce it. Can this be installed in windows. And the method used in this section. The younger brother is grateful.
------ Solution --------------------
MemcacheQ is a pure distributed message queue service. Its installation depends on BerkeleyDB and libevent. Therefore, you must first install the BerkeleyDB and libevent:
1. BerkeleyDB
Download Package, http://download.oracle.com/berkeley-db/db-5.0.21.tar.gz
After decompression, cd build_unix
/Dist/configure
Make
Sudo make install
2. libevent (1.4.x or higher is required)
Download Package: http://monkey.org /~ Provos/libevent/
After decompression, configure & make install
III. memcacheQ
Download Software: http://code.google.com/p/memcacheq/downloads/list
Decompress and cd to the Directory
./Configure -- with-bdb =/usr/local/BerkeleyDB.5.0 -- with-libevent =/usr/local/lib -- enable-threads
Make
Sudo make install
Add the bdb database to the shared library path
Cd/etc/ld. so. conf. d
Touch bdb. conf
Vim bdb. conf
Added:
/Usr/local/lib
/Usr/local/BerkeleyDB.5.0/lib
Cd/etc/profile. d
Touch bdb. sh
Vim bdb. sh
Add
Export LD_LIBRARY_PATH = $ LD_LIBRARY_PATH:/usr/local/lib:/usr/local/BerkeleyDB.5.0/lib
4. start memcacheQ
Run the memcacheq-h command to view the command line options.
Start memcacheq: memcacheq-d-r-H/data1/memcacheq-N-R-v-L 1024-B 1024>/data1/mq_error.log 2> & 1
5. use
After using the preceding command to start mq, (note that the length of the body of messag cannot exceed 1024 bytes). when using mq, you only need to use two commands: set and get:
Set 0
STOREDget
VALUE
As you can see from the END, the memcache protocol is basically the same, but the key name is changed to the queue name, and the expire_time parameter is ignored in the set command. After all, mq data storage is stored in the berkeleyDB and is stored persistently without memory expiration time.
When the set command is used, a new message is written to the specified message queue, that is, a new data is inserted into the BerkeleyDB. when the get command is used, A new message is taken from the specified queue, that is, a data record is deleted from the BerkeleyDB. When you use stats to view a specified queue, you can see how many and how many messages are received in the queue.
Example:
Fengbo @ onlinegame-10-121 :~ $ Telnet 127.0.0.1 22202
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Set q4 0 0 5
Hello
STORED
Set q4 0 0 5
World
STORED
Stats queue
STAT q4 2/0
END
Get q4
VALUE q4 0 5
Hello
END
Stats queue
STAT q4 2/1
END
The set command is executed twice. when you use stats queue to view messages, you can see that there are two messages in the q4 queue and 0 messages have been taken out. when you use get to retrieve the first message, use stats queue to view the message. There are two messages in q4, of which one has been taken out.