src/Connection/Aggregate/SentinelReplication.php
protected function querySentinelForSlaves(NodeConnectionInterface $sentinel, $service)
    {
        $slaves = array();

        $payload = $sentinel->executeCommand(
            RawCommand::create('SENTINEL', 'slaves', $service)
        );

        if ($payload instanceof ErrorResponseInterface) {
            $this->handleSentinelErrorResponse($sentinel, $payload);
        }

        foreach ($payload as $slave) {
            $flags = explode(',', $slave[9]);

            if (array_intersect($flags, array('s_down', 'o_down', 'disconnected'))) {
                continue;
            }

            $slaves[] = array(
                'host' => $slave[3],
                'port' => $slave[5],
                'alias' => "slave-$slave[1]",
            );
        }

        return $slaves;
    }
protected function querySentinelForSlaves(NodeConnectionInterface $sentinel, $service)
    {
        $slaves = array();

        $payload = $sentinel->executeCommand(
            RawCommand::create('SENTINEL', 'slaves', $service)
        );

        if ($payload instanceof ErrorResponseInterface) {
            $this->handleSentinelErrorResponse($sentinel, $payload);
        }

        foreach ($payload as $slave) {
            $flags = explode(',', $slave[9]);

            if (array_intersect($flags, array('s_down', 'o_down', 'disconnected'))) {
                continue;
            }

            $slaves[] = array(
                'host' => $slave[3],
                'port' => $slave[5],
                'alias' => "slave-$slave[1]",
            );
        }

        return $slaves;
    }
protected function querySentinelForSlaves ( NodeConnectionInterface $ sentinel , $ service ) { $ slaves = array ( ) ; $ payload = $ sentinel -> executeCommand ( RawCommand :: create ( 'SENTINEL' , 'slaves' , $ service ) ) ; if ( $ payload instanceof ErrorResponseInterface ) { $ this -> handleSentinelErrorResponse ( $ sentinel , $ payload ) ; } foreach ( $ payload as $ slave ) { $ flags = explode ( ',' , $ slave [ 9 ] ) ; if ( array_intersect ( $ flags , array ( 's_down' , 'o_down' , 'disconnected' ) ) ) { continue ; } $ slaves [ ] = array ( 'host' => $ slave [ 3 ] , 'port' => $ slave [ 5 ] , 'alias' => "slave-$slave[1]" , ) ; } return $ slaves ; }
Fetches the details for the slave servers from a sentinel.

@param NodeConnectionInterface $sentinel Connection to a sentinel server.
@param string                  $service  Name of the service.

@return array
Fetches the details for the slave servers from a sentinel .