No connection could be made because the target machine actively refused it. [tcp://127.0.0.1:6379] on localhost using laravel 5.2
<p>I am using Laravel 5.2 and developing an admin panel and trying to integrate Redis 1.0 in Laravel.</p>

<p>When I am trying to set the variable name along with value it prompting an error:</p>

<blockquote>
  <p>No connection could be made because the target machine actively refused it. [tcp://127.0.0.1:6379]</p>
</blockquote>

<p>The configurational changes i made it is given below:  </p>

<ul>
<li>In config/session.php file i replaced file with redis</li>
<li>('driver' => env('SESSION_DRIVER', 'redis'))</li>
<li>Under <code>aliases</code> array in <code>config/app.php</code> file the Redis facade is already included <code>'Redis' =&gt; Illuminate\Support\Facades\Redis::class</code></li>
<li>In <code>.env</code> file I replaced <code>file</code> with <code>redis</code> in <code>SESSION_DRIVER</code> variable</li>
<li>In <code>database.php</code> file the config for redis server is given below:</li>
</ul>

<pre class="lang-php prettyprint-override"><code>'redis' =&gt; [
    'cluster' =&gt; true,
    'default' =&gt; [
        'host' =&gt; env('REDIS_HOST', 'localhost'),
        'password' =&gt; env('REDIS_PASSWORD', null),
        'port' =&gt; env('REDIS_PORT', 6379),
        'database' =&gt; 0,
    ],
]
</code></pre>

<p>Below is my Controller code:</p>

<pre class="lang-php prettyprint-override"><code>&lt;?php

namespace App\Http\Controllers\Administrator;

use Redis;
use App\Http\Requests;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class MyController extends Controller
{
    public function __construct() {}

    public function myProfile(Request $request)
    {
        $redis = Redis::connection();
        $adminName = $request-&gt;route('admin_name');
        if ($redis) {
            echo 'connection done';
        } else {
            echo 'connection not done';
        }
        Redis::set('name', $adminName);
        echo $redis-&gt;get('name');
    }
}
</code></pre>

<p>Please help if anyone have an idea of it.</p>