Answer the question
In order to leave comments, you need to log in
How to link servers to Gearman?
There is a master server and two slave servers.
192.168.0.1 - master
192.168.0.2 - slave
192.168.0.3 - slave
You need to configure Gearman so that it sends tasks from the master to the slave.
Sending a task from the master is as follows.
$client = new GearmanClient();
$client->addServers('192.168.0.2:4730, 192.168.0.3:4730');
$client->doBackground('run', json_encode($data));
$worker = new GearmanWorker();
$worker->addServers('192.168.0.1:4730');
$worker->addFunction('run', function (){
echo "ok\n";
});
$worker->work();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question