Recently, I have been checking some technical points used in the project, and discovered gearman, so I started to work on the environment. , the following is the introduction about gearman from Baidu Encyclopedia:
Gearman is a machine used to delegate work to other machines, distributed calls are more suitable for doing a certain job, do a certain job concurrently to balance the load among multiple calls, or used to call other languages. system of functions. Can be used for SSO distribution connections, but the disadvantage is that it takes up more 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: could not find boost
sudo apt-get install libboost-dev
Then re-execute: ./configure
configure: error: Could not find a version of the library!
sudo apt-get install libboost-all-dev
Then re-execute: ./configure
configure: error: could not find gperf
sudo apt-get install gperf*
Then re-execute: ./configure
configure: error: Unable to find libevent
sudo apt-get install libevent-dev
Then re-execute: ./configure
configure: error: Unable to find libuuid
Installlibuuid
Cannot pass here sudo I tried apt-get install to install it, but it couldn’t be found. Install it through the following method
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 with the above installation
./configure
sudo make && make install
It will take a while here. .
According to the running results in the above picture, the installation is not successful, continue below
sudo make clean (Clear the object files (files with the suffix ".o" ) and executable files generated by the last make command. )
Reinstall
./configure
sudo make
sudo make install
There seems to be no error, continue
gearman
You will see the following prompt when you run it for the first time:
gearman: error while loading shared libraries: libgearman.so.8: cannot open shared object file: No such file or directory
(This means that the system does not know which directory libgearman.so.8 is placed in. To add /etc/ld.so.conf The directory where >libgearman.so.8 is located. After checking, the directory where the file is located is /usr. /local/lib. So the reason for this problem is libgearman.so.8 has just been generated and has not been added to ld.so.cache, so you need to re-run /sbin/ldconfig( The function of the ldconfig command): )
sudo /sbin/ldconfig
Execute again at this time gearman The installation has been successful!
Installation completedJob After Server, use gearmand –d command to start
gearmand -d
You will see the following prompt when running for the first time:
gearmand: Could 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 execute the above command again to start normally. Gotjob server.
sudo gearmand -d
This is completely ok
InstallPHP GearmanExtension
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 (You may be prompted that there is no such command, execute sudo apt-get install php5-dev install)
sudo ./configure
sudo make
sudo make install
sudo echo "extension=gearman.so" >> /etc/php5/apache2/php.ini (Note herephp.inilocation)
sudo /etc/init.d/apache2 restart
You should see it when you check php_info gearman expanded
Code completion:
https://gist.github.com/andreaspag/6242671/archive/a66d18d191b880c1f8210deb612eb51b185f0892.zip
After unzipping, copy the files inside to the corresponding directory. If I am developing with netbeans, I will put it in
/usr/local/netbeans-8.1/php/phpstubs/phpruntime in this directory;
The following are some screenshots of the installation of Job Server
PHP Gearman Extension