CentOS Gearman installation and use error-free version

  
 

Generally, integration between multi-language and multi-systems is a big problem. In general, people will mostly use WebService to handle such integration problems, but no matter what style of WebService, such as RPC style, or REST. Style has its own complexity. In contrast, Gearman can achieve a similar effect, and is easier to use. The processing of a Gearman request involves three roles: Client -> Job -> Worker. Client: The originator of the request, which can be C, PHP
, Perl, MySQL UDF, etc. Job: The dispatcher of the request, responsible for coordinating the forwarding of requests from the client to the appropriate Work. Worker: The handler of the request, which can be C, PHP, Perl, etc. Because Client, Worker does not restrict the use of the same language, it is conducive to the integration between multi-language and multi-system. Even by adding more workers, we can easily implement a distributed load balancing architecture for the application. Let's take a look at how to install and run an example. Under the limited conditions, we run the three roles Client, Job, and Worker on a server: install libevent:

wget http://www.monkey.org/~provos/libevent-1.4.12-stable.tar.gztar zxvf libevent-1.4.12-stable.tar.gzcd libevent-1.4.12-stable/./configure --prefix=/usrmake && make install/Sbin/ldconfigcd ../


Install Gearman server and library:

wget http://launchpad.net/gearmand/trunk/0.9/+download/gearmand- 0.9.tar.gztar zxvf gearmand-0.9.tar.gzcd gearmand-0.9./configuremakemake install/sbin/ldconfigcd ../

Install Gearman PHP extension:wget http://pecl.php.net/get /gearman-0.5.0.tgztar zxvf gearman-0.5.0.tgzcd gearman-0.5.0/usr/local/webserver/php/bin/phpize./configure --with-php-config=/usr/local/webserver /php/bin/php-config --with-gearmanmakemake installcd ../Edit the php.ini configuration file to load the appropriate module and make it effective: extension = "gearman.so"Start Job:gearmand -d if the current user is root Then Need to do this: gearmand -d -u root will use port 4730 by default, which will be used below. Note: If you can't find the path to the gearand command, don't forget to confirm with whereis gearmand.


We can use the ps command to see if the startup is successful:
ps aux

Copyright © Windows knowledge All Rights Reserved