title: Connection refused [tcp://127.0.0.1:6379] Laravel Predis
body: <p>I'm trying to setup Redis client to connect to the Redis server in Laravel 6.0 version, but when I try to change the REDIS_HOST  in database.php file in config it gives me an error:</p>
  
  <blockquote>
    <p>Connection refused 127.0.0.1:6379</p>
  </blockquote>
  
  <p>This is how my code looks like in routes <code>api.php</code> file </p>
  
  <pre class="lang-php prettyprint-override"><code>Route::get('test',function(Request $request){
  
    $redis=Redis::connection();
    $redis-&gt;set("key1","keyValue");
    $a=$redis-&gt;get("key1");
    return response()-&gt;json( ['test'=&gt;$a,]);
  });
  </code></pre>
  
  <p>and this is how my <code>database.php</code> file looks like </p>
  
  <pre class="lang-php prettyprint-override"><code>      'redis' =&gt; [
  
              'client' =&gt; env('REDIS_CLIENT', 'predis'),
  
              'options' =&gt; [
                  'cluster' =&gt; env('REDIS_CLUSTER', 'redis'),
                  'prefix' =&gt; env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
              ],
  
              'default' =&gt; [
                  'url' =&gt; env('REDIS_URL'),
                  'host' =&gt; env('REDIS_HOST', '127.0.0.1'),
                  'password' =&gt; env('REDIS_PASSWORD', null),
                  'port' =&gt; env('REDIS_PORT', 6379),
                  'database' =&gt; env('REDIS_DB', 0),
              ],
  
              'cache' =&gt; [
                  'url' =&gt; env('REDIS_URL'),
                  'host' =&gt; env('REDIS_HOST', '127.0.0.1'),
                  'password' =&gt; env('REDIS_PASSWORD', null),
                  'port' =&gt; env('REDIS_PORT', 6379),
                  'database' =&gt; env('REDIS_CACHE_DB', 1),
              ],
          ],
  </code></pre>
  
  <p>So when i change the REDIS_HOST its gives me error,any idea  is my code problem the configurations?</p>
  
  <p>Thanks ! </p>