Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The steps of compiling and installing MemcacheQ under Linux system

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "the compilation and installation steps of MemcacheQ under the Linux system". In the daily operation, I believe that many people have doubts about the compilation and installation steps of MemcacheQ under the Linux system. The editor consulted all kinds of materials and sorted out a simple and easy-to-use method of operation. I hope it will be helpful to answer the doubts of "the compilation and installation steps of MemcacheQ in the Linux system". Next, please follow the editor to study!

MemcacheQ as a simple distributed queue service, because of the lack of understanding of MemcacheQ, many people have encountered a lot of trouble in the installation of MemcacheQ. The editor will introduce the compilation and installation of MemcacheQ under the Linux system in detail, so that you can have a more detailed understanding.

Queue (Queue) is a commonly used data structure. In the data structure of queues, the first inserted element will be taken out first; otherwise, the last inserted element will be taken out last, so the queue is also called the linear table of "first in first out" (FIFO:First In First Out).

One end of the element is called the end of the line, and the end of the element taken out is called the head of the line. Message queuing can be used to asynchronously handle data transmission and storage, and message queuing can be used to handle these data writes asynchronously when data is frequently and intensively inserted into the back-end database.

MemcacheQ is an open source message queue service software based on Memcache protocol. Because it follows the Memcache protocol, the development cost is very low, and it can be easily mastered without additional knowledge.

MemcacheQ was also used in a recent project, and I'll share the compilation and installation of MemcacheQ in Linux.

First of all, MemcacheQ depends on BerkeleyDB and Libevent. If Memcached has ever been installed on the server, Libevent should already exist, otherwise you need to download and install Libevent first.

Download links are as follows:

Libevent: https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz

Berkeley DB: http://download.oracle.com/otn/berkeley-db/db-6.0.30.tar.gz

MemcacheQ: https://github.com/stvchu/memcacheq

Install Libevent

Tar zvxf libevent-2.0.21-stable.tar.gz

Cd libevent-2.0.21-stable

. / configure-- prefix=/usr/local/libevent

Make & & make install

Echo "/ usr/local/libevent/lib" / etc/ld.so.conf

Ldconfig

Install BerkeleyDB

Introduction to BerkeleyDB: BerkeleyDB is an open source file database, between the relational database and the in-memory database, similar to the in-memory database, it provides a series of functions that directly access the database, rather than requiring network communication, SQL parsing and other steps like the relational database.

MemcacheQ relies on BerkleyDB for persistent storage of queue data so that queue data is not lost in the event of an unexpected crash or interruption of MemcacheQ.

Tar zxvf db-6.0.30.tar.gz

Cd db-6.0.30/build_unix

. . / dist/configure-- prefix=/usr/local/berkeleydb

Make & & make install

Ln-s / usr/local/berkeleydb/lib/libdb-6.0.so / usr/lib/

Echo "/ usr/local/berkeleydb/lib/" / etc/ld.so.conf

Ldconfig

Install MemcacheQ

Tar zxvf memcacheq-0.2.0.tar.gz

Cd memcacheq-0.2.0

. / configure-prefix=/usr/local/memcacheq-with-bdb=/usr/local/berkeleydb-with-libevent=/usr/local/libevent-enable-threads

Make & & make install

Start MemcacheQ

Shell

/ usr/local/memcacheq/bin/memcacheq-d-uroot-r-l 127.0.0.1-p11210-H / usr/local/mcq-N-R-v-L 1024-B 1024 "/ usr/local/mcq/logs/mcq_error.log 2" & 1

Attached: MemcacheQ parameter

-p "num" TCP listening port (default: 22201)

-U "num" UDP listening port (default: 0, off)

-s "file" unix socket path (network is not supported)

-a "mask" unix socket access mask (default 0700)

-l "ip_addr" monitoring network card

-d daemon

-r maximize the core file limit

-u "username" runs as a user (only when run as root)

-c maximum number of "num" concurrent connections (default is 1024)

-v detailed output (print errors/warnings while in event loop)

-vv more detailed output (also print client commands/reponses)

-I print license information

-P "file" PID file

-t "num" threads (default 4)

Test it with PHP

PHP

"? Php

$mcq = new Memcache

$mcq- "connect ('127.0.0.1 connect, 11210) or die (' Connect errorations' )

For ($iTunes 1; $I "= 5; $iTunes +) {

Memcache_set ($mcq, 'Knights, $I, 0,0)

}

For ($iTunes 1; $I "= 6; $iTunes +) {

$queue = memcache_get ($mcq,'K')

If ($queue = false) {

Echo "null\ n"

} else {

Echo $queue. "\ n"

}

}

Memcache_close ($mcq)

? "

At this point, the study of "the compilation and installation steps of MemcacheQ under the Linux system" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report