Install and build Gearman in Ubuntu

Source: Internet
Author: User

Install and build Gearman in Ubuntu

In the recent stage, I have been viewing some of the technical points used in the project and found gearman. So I started the environment. The following is an introduction to gearman from Baidu Encyclopedia:

Gearman is a machine used to delegate work to other machines and distributed calls. It is more suitable for machines that do a job, concurrent jobs, load balancing among multiple calls, or in the system that calls functions in other languages. It can be used for sso distribution connections, but its disadvantage is that it occupies a large amount of system resources, such as CPU and memory.

1. Update

Sudo apt-get update

Wget https://launchpad.net/gearmand/1.2/1.1.12/+download/gearmand-1.1.12.tar.gz

Tar zxvf gearmand-1.1.12.tar.gz

Cd gearmand-1.1.12/

./Configure

Configure: error: cocould not find boost

Sudo apt-get install libboost-dev

Then execute again:./configure

Configure: error: cocould not find a version of the library!

Sudo apt-get install libboost-all-dev

Then execute again:./configure

Configure: error: cocould not find gperf

Sudo apt-get install gperf *

Then execute again:./configure

Configure: error: Unable to find libevent

Sudo apt-get install libevent-dev

Then execute again:./configure

Configure: error: Unable to find libuuid

Install libuuid

You cannot use sudo apt-get install to install sudo. You cannot find it. Use the following method to install sudo apt-get install:

Wget http://nchc.dl.sourceforge.net/project/libuuid/libuuid-1.0.3.tar.gz

Sudo tar zxvf libuuid-1.0.3.tar.gz

Cd libuuid-1.0.3/

./Configure

Continue without errors

Sudo make

Sudo make install

Next, continue the installation.

./Configure

Sudo make & make install

It will take some time ..

According to the running result, the installation is not successful. Continue.

Sudo make clean (clear the object files generated by the last make command (Files suffixed with ". o") and executable files .)

Reinstall

./Configure

Sudo make

Sudo make install

It seems that there are no errors. Continue

Gearman

The following prompt is displayed during the first running:

Gearman: error while loading shared libraries: libgearman. so.8: cannot open shared object file: No such file or directory

(This indicates that the system does not know which directory libgearman. so.8 is stored. Add libgearman. so.8 to the directory of/etc/ld. so. conf. Check that the directory of the file is/usr/local/lib. The reason for this problem is that libgearman. so.8 was just generated and not added to ld. so. cache. Therefore, you need to re-run/sbin/ldconfig (The role of the ldconfig command ):)

Sudo/sbin/ldconfig

Then run gearman. The installation is successful!

After the Job Server is installed, run the gearmand-d command to start

Gearmand-d

The following prompt is displayed during the first running:

Gearmand: cocould not open log file "/usr/local/var/log/gearmand. log ", from"/home/wangyulu/download/gearmand-1.1.12 ", switching to stderr. (No such file or directory)

Create the/log/gearmand. log file in the prompted directory and run the preceding command again to start the job server.

Sudo gearmand-d

Now it's completely OK.

Install PHP Gearman Extension

Wget http://pecl.php.net/get/gearman-1.1.2.tgz

Sudo tar zxvf gearman-1.1.2.tgz

Cd gearman-1.1.2/

Sudo phpize (Here you may be prompted not to have this command, execute sudo apt-get install php5-dev installation)

Sudo./configure

Sudo make

Sudo make install

Sudo echo "extension = gearman. so">/etc/php5/apache2/php. ini (note the location of php. ini here)

Sudo/etc/init. d/apache2 restart

When you view php_info, you should see the gearman extension.

Code completed:

Https://gist.github.com/andreaspag/6242671/archive/a66d18d191b880c1f8210deb612eb51b185f0892.zip

Decompress the package and copy the file to the corresponding directory. If I am using netbeans, I will put it in

/Usr/local/netbeans-8.1/php/phpstubs/phpruntime in this directory;

The following section describes how to install the Job Server.

PHP Gearman Extension

Calabash + Gearman implement multi-cell phone synchronization test mechanism

Distributed Task Distribution framework-Gearman

For examples of using supervisor to monitor Gearman tasks, see:

Use Gearman to synchronize data from MySQL to Redis (asynchronous replication)

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.