A
A
Andrey Rakovskiy2018-02-22 18:09:11
linux
Andrey Rakovskiy, 2018-02-22 18:09:11

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));

Receiving a job on a slave works as follows
$worker = new GearmanWorker();
$worker->addServers('192.168.0.1:4730');
$worker->addFunction('run', function (){
    echo "ok\n";
});
$worker->work();

When I run the task sending script on the master, I get the following error: GearmanClient::doBackground(): send_packet (GEARMAN_COULD_NOT_CONNECT) Failed to send server-options packet -> libgearman/connection.cc:433 it is not visible through telnet.
How does the interaction with servers generally take place and how can I be allowed to connect to another server?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2018-02-22
@dimonchik2013

it was watched

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question