Laravel:cURL错误7:无法连接到localhost端口1080:连接被拒绝

时间:2017-09-15 15:20:01

标签: php laravel-5

我是elasticsearch的新手,也是laravel的某个地方..我正在尝试用laravel配置elasticsearch。 elasticsearch正在9200端口上运行。当执行下面的代码时,它会抛出cURL错误。我从未配置1080端口。不知道为什么它试图连接1080端口?如何更改此端口?

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Elasticsearch\ClientBuilder;
use Elastica\Client as ElasticaClient;

class clientController extends Controller
{
    protected $elasticsearch;
    protected $elastica;
    public function __construct()
    {


        $logger = ClientBuilder::defaultLogger('d:/your.log');


        $this->elasticsearch = ClientBuilder::create()       
            ->setLogger($logger)   
            ->setRetries(0)
            ->build();
        $elasticConfig=['host'=>"locahost",
            "port"=>9200,
            "index"=>'pets'];
        $this->elastica = new  ElasticaClient($elasticConfig);
    }
    public function elasticsearchTest(){       

        dump($this->elasticsearch);
       // echo "\n\n Retrive Doc";
        $param = [
            'index' => 'pets',
            'type' => 'dog',
            'id'=>'1'
        ];
        $res = $this->elasticsearch->get($param);
        dump($res); exit;

    }
}

0 个答案:

没有答案