Gearman drives me crazy. I know all the tutorials all the presentations all the How tos but i'm not getting the Information i need.
My plan
I have one client who sends the jobs to the one job-server which is on the localhost. On this Server ( Home-Server ) runs the Website and the DB. Now i have two ( later more Worker-Server ) which we will call W1 and W2. At these Servers the hard work should be done and they should get the Jobs from the Home-Server where Gearman-Job-Server is installed. The Jobs are synchroun, which means that the client waits until the Tasks gets finished.
But I dont know how to do this. Every tutorial i find only told me how to set up Gearman when Clients and Workers are running on the same Machine. On the Home-Server i installed gearman-job-server and the PHP gearman API with PECL. At my clients which i handle with supervisord i call:
$gmc = new GearmanClient();
$gmc->addServer();
Which should send the Tasks to the localhost Job-Server which should get than to one of the two free Worker-Server. Right?
At the worker.php on thw Worker-Server W1 and W2 - which get also handled with supervisord - the following is written
$gmworker= new GearmanWorker();
$gmworker->addServer('Home-Server-IP', 4730);
Now the Worker-Server should get the Tasks from the Home-Server? Do I have to install gearman-job-server at W1 and W2 or is the PECL PHP Gearman API everything i need? And do i have to configure the Worker-Server?
I really hope you can explain these questions to me, that i can understand Gearman.
Some more Information: When I tipe at Home-Server
gearmand -vvv -u root --listen=127.0.0.1
Output is just:
- INFO Starting up
- INFO Listening on 127.0.0.1:4730 (6)
- INFO Creating wakeup pipe
- INFO Creating IO thread wakeup pipe
- INFO Adding event for listening socket (6)
- INFO Adding event for wakeup pipe
- INFO Entering main event loop
After the last line the shell isnt doing anything more. I even cant tipe a new command.
Even more Infos.
I checked that Gearmand is running at the Home-Server.
ps -e|grep gearman
Output:
- 1460 ? 00:00:00 gearmand
When i now give the command on the Worker-Server
/usr/sbin/gearmand -u root -vvv --listen=Home-Server-IP
I got following Error.
- INFO Starting up
- FATAL _listen_init:bind:99
- INFO Shutdown complete
I really did nott get whats going wrong with my application.