Connection refused tcp://127.0.0.1:6379 #986
Comments
ChaerilM commented May 28, 2017 •
Issue:
What seems to be going wrong?
start laravel with nginx mysql and redis
ConnectionException in AbstractConnection.php line 155:
Connection refused [tcp://127.0.0.1:6379]
i can ssh to redis container, command redis-server would return
Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
Creating Server TCP listening socket *:6379: bind: Address already in use
Expected behavior:
What should be happening instead?
Reproduce:
How might we be able to reproduce the error?
Relevant Code:
The text was updated successfully, but these errors were encountered:
We are unable to convert the task to an issue at this time. Please try again.
The issue was successfully created but we are unable to update the comment at this time.
ChaerilM commented May 29, 2017 •
after hours of googling finally know that i need to add docker name / hostname to etc/host before using it :(.
can you tell to add docker name / hostname to etc/host in guide?, in case there is more docker newbie using laradock
SamoilenkoEvgeniy commented Mar 23, 2018
If someone also received such a problem, this is explanation:
jasperf commented Jun 16, 2018 •
as I do not need them for local development. That worked and from that moment on I could connect to horizon from the workspace and the horizon gui started working in the browser as well.
ryancwalsh commented Jul 12, 2018
I’m running my Docker in production, so I want good security, so I tried to follow https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-redis-on-ubuntu-18-04, which says that bind 127.0.0.1 ::1 is important.
But I was getting multiple Predis\Connection\ConnectionException, Code: 111: Connection refused [tcp://redis:6379] errors per second.
This is my workaround for now:
docker inspect laradock_redis_1 | grep «IPAddress» showed me that my Redis IP is 172.20.0.4.
I think it seems to be working now.
However, my concern is that I’ve also seen the IP be 172.20.0.3. How can I specify a static IP that I can rely on? I don’t want my config to fail just because I took a container down and restarted it, for example.
connection issue #493
Comments
ankushktr commented Mar 4, 2018 •
Hi when we create a script in php file as example below we get exceptions of connection
Fatal error: Uncaught Predis\Connection\ConnectionException: Connection refused [tcp://127.0.0.1:6379] in /opt/lampp/htdocs/get/predis/src/Connection/AbstractConnection.php:155 Stack trace: #0 /opt/lampp/htdocs/get/predis/src/Connection/StreamConnection.php(128): Predis\Connection\AbstractConnection->onConnectionError(‘Connection refu. ‘, 111) #1 /opt/lampp/htdocs/get/predis/src/Connection/StreamConnection.php(178): Predis\Connection\StreamConnection->createStreamSocket(Object(Predis\Connection\Parameters), ‘tcp://127.0.0.1. ‘, 4) #2 /opt/lampp/htdocs/get/predis/src/Connection/StreamConnection.php(100): Predis\Connection\StreamConnection->tcpStreamInitializer(Object(Predis\Connection\Parameters)) #3 /opt/lampp/htdocs/get/predis/src/Connection/AbstractConnection.php(81): Predis\Connection\StreamConnection->createResource() #4 /opt/lampp/htdocs/get/predis/src/Connection/StreamConnection.php(258): Predis\Connection\AbstractConnection->connect() #5 /opt/lampp/htdocs/get/predis/src/Connection/AbstractConnection.php(180): Pre in /opt/lampp/htdocs/get/predis/src/Connection/AbstractConnection.php on line 155
The text was updated successfully, but these errors were encountered:
We are unable to convert the task to an issue at this time. Please try again.
The issue was successfully created but we are unable to update the comment at this time.
Connection refused [tcp://127.0.0.1:6379] But I already set other host and port #295
Comments
iyaozhen commented Dec 24, 2015
I run this script in cli:
But when I request url http://xxx.com/test.php return 500
I del predis code, phpredis code run success, this url return string ‘bar2’.
My webserver is Nginx + PHP-FPM. Before this I connect use local unix sock, Now I change local redis to remote server.
I am confused, I already set host[10.58.174.11] and port[6479], why php-cli is OK, but url is failure.
The text was updated successfully, but these errors were encountered:
We are unable to convert the task to an issue at this time. Please try again.
The issue was successfully created but we are unable to update the comment at this time.
tin-cat commented Dec 24, 2015
You’ve specified the IP 10.58.174.11 in your code, yet the error returned is about trying to connect to the 127.0.0.1 IP, that would be where to start investigating, I guess. Try passing connection parameters to Predis\Client as a hashed array instead of a connection string, like so:
$redis = new Predis\Client([ ‘scheme’ => ‘tcp’, ‘host’ => ‘10.58.174.11’, ‘port’ => 6379, ]);
Also, you’re using a different port for the Redis server (6479) instead of the default (6379), that ok?
iyaozhen commented Dec 24, 2015
@tin-cat Thx. I determine, It is 6479. And php-cli is success.
Hashed array config is failure too.
I am tired Last night, make some mistake. Go home sleep, Maybe tomorrow morning It is OK.
tin-cat commented Dec 24, 2015
😀 happens often, you’ll see this a lot clearer tomorrow, have a good night!
nrk commented Jan 7, 2016
I doubt this issue is directly related to Predis so I’m closing it, but feel free to re-open it if there are updates.
ivanferrer commented Nov 9, 2016
The httpd scripts by default are not allowed to connect out to the network.
This would prevent a hacker from breaking into you httpd server
and attacking other machines. If you need scripts to be able to:
Redis queue : «Error while reading line from the server» #355
Comments
trompx commented Feb 5, 2016
First I am not sure this is a lumen specific error or a Laravel error too.
I have an app running on laravel (5.1) which dispatch jobs, handled by a lumen (5.1) worker.
`[2016-02-05 02:27:07] lumen.ERROR: exception ‘Predis\Connection\ConnectionException’ with message ‘Error while reading line from the server. [tcp://127.0.0.1:6379]’ in /var/www/app/vendor/predis/predis/src/Connection/AbstractConnection.php:168
Stack trace:
#0 /var/www/app/vendor/predis/predis/src/Connection/StreamConnection.php(210): Predis\Connection\AbstractConnection->onConnectionError(‘Error while rea. ‘)
#1 /var/www/app/vendor/predis/predis/src/Connection/AbstractConnection.php(133): Predis\Connection\StreamConnection->read()
#2 /var/www/app/vendor/predis/predis/src/Connection/AbstractConnection.php(125): Predis\Connection\AbstractConnection->readResponse(Object(Predis\Command\ZSetRemove))
#3 /var/www/app/vendor/predis/predis/src/Client.php(326): Predis\Connection\AbstractConnection->executeCommand(Object(Predis\Command\ZSetRemove))
#4 /var/www/app/vendor/predis/predis/src/Client.php(310): Predis\Client->executeCommand(Object(Predis\Command\ZSetRemove))
#5 /var/www/app/vendor/illuminate/queue/RedisQueue.php(154): Predis\Client->__call(‘zrem’, Array)
#6 /var/www/app/vendor/illuminate/queue/RedisQueue.php(154): Predis\Client->zrem(‘queues:processi. ‘, ‘ <"job":"Illumin. ')
#7 /var/www/app/vendor/illuminate/queue/Jobs/RedisJob.php(73): Illuminate\Queue\RedisQueue->deleteReserved(‘processing’, ‘ <"job":"Illumin. ')
#8 /var/www/app/vendor/illuminate/queue/CallQueuedHandler.php(46): Illuminate\Queue\Jobs\RedisJob->delete()
#9 /var/www/app/vendor/illuminate/queue/Jobs/Job.php(129): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\RedisJob), Array)
#10 /var/www/app/vendor/illuminate/queue/Jobs/RedisJob.php(51): Illuminate\Queue\Jobs\Job->resolveAndFire(Array)
#11 /var/www/app/vendor/illuminate/queue/Worker.php(208): Illuminate\Queue\Jobs\RedisJob->fire()
#12 /var/www/app/vendor/illuminate/queue/Worker.php(159): Illuminate\Queue\Worker->process(‘redis’, Object(Illuminate\Queue\Jobs\RedisJob), ‘3’, 0)
#13 /var/www/app/vendor/illuminate/queue/Worker.php(111): Illuminate\Queue\Worker->pop(NULL, ‘processing’, 0, ‘3’, ‘3’)
#14 /var/www/app/vendor/illuminate/queue/Worker.php(87): Illuminate\Queue\Worker->runNextJobForDaemon(NULL, ‘processing’, 0, ‘3’, ‘3’)
#15 /var/www/app/vendor/illuminate/queue/Console/WorkCommand.php(103): Illuminate\Queue\Worker->daemon(NULL, ‘processing’, 0, 128, ‘3’, ‘3’)
#16 /var/www/app/vendor/illuminate/queue/Console/WorkCommand.php(71): Illuminate\Queue\Console\WorkCommand->runWorker(NULL, ‘processing’, 0, 128, true)
#17 [internal function]: Illuminate\Queue\Console\WorkCommand->fire()
#18 /var/www/app/vendor/illuminate/container/Container.php(502): call_user_func_array(Array, Array)
#19 /var/www/app/vendor/illuminate/console/Command.php(150): Illuminate\Container\Container->call(Array)
#20 /var/www/app/vendor/symfony/console/Command/Command.php(259): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /var/www/app/vendor/illuminate/console/Command.php(136): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /var/www/app/vendor/symfony/console/Application.php(878): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /var/www/app/vendor/symfony/console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /var/www/app/vendor/symfony/console/Application.php(126): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /var/www/app/vendor/laravel/lumen-framework/src/Console/Kernel.php(78): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 /var/www/app/artisan(35): Laravel\Lumen\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27
I stumble upon this issue predis/predis#121 but that wasn’t that.
For the record, some of the jobs use PhpRedis (no persistent connection) so I don’t know if that may conflict with Predis (which seems not as all jobs running under 60s don’t trigger the error).
Let me know if I can provide more infos.
The text was updated successfully, but these errors were encountered:
Whoops, looks like something went wrong. #66
Comments
yuri25 commented Jun 15, 2014
Predis \ Connection \ ConnectionException
Connection refused [tcp://127.0.0.1:6379]
The text was updated successfully, but these errors were encountered:
We are unable to convert the task to an issue at this time. Please try again.
The issue was successfully created but we are unable to update the comment at this time.
jjordansd commented Jun 26, 2014
The error is saying it can’t connect to your redis cache server. You can use the file cache driver (removing the need to connect to a redis server). Do this by updating the app/config/cache.php and comment update the driver to ‘file’:
‘driver’ => ‘file’,
// ‘driver’ => ‘redis’,
If you want to use redis, you need to verify it is installed or on Mac OS X install it with:
brew install redis-server
And start it with:
redis-server
For redis cache, make sure the app/config/cache.php driver setting is set to:
‘driver’ => ‘redis’,
yuri25 commented Jun 29, 2014
Admin panel for editing / creating tags and categories
But I did not find such opportunities, although logged as msurguy and password password.
Please tell me how?
msurguy commented Jun 29, 2014
The admin panel for editing tags / categories is at these URLs relative to the root:
msurguy commented Jun 29, 2014
It seems that your hostname is not defined in the bootstrap/start.php file and because of that the environment gets set as production and not local
yuri25 commented Jun 30, 2014
Great, everything works. Thank you very much.
stigoleg commented Jul 3, 2014
I have the same problem as @yuri25 had earlier. After installing the app, all I see is «Whoops, looks like something went wrong.»
I have tried to comment out ‘driver’ => ‘redis’, in both cache.php and session.php.
Anyone that know how I can solve this?
stidges commented Jul 3, 2014
@Posterum Try adding your hostname to the local aray in the bootstrap/start.php file. This should show you a more detailed error of what is going wrong
stigoleg commented Jul 3, 2014
Thanks, but I have added it to the local array:
stidges commented Jul 3, 2014
Is that your machine name? Since Laravel 4.1 it requires you to enter your machine name instead of the url of your app.
stigoleg commented Jul 3, 2014
Ah, sorry my bad. Changed it to sog and everyting works 🙂
Thansk for helping me! 🙂
koppenhoefer commented Apr 25, 2017 •
In case anyone, like me, is trying to solve this using Docker containers on a Mac. and using Laradock (which I believe is currenty Laravel5.2)(https://github.com/laradock/laradock). Here are the edits I needed to get beyond this ‘Whoops error’. 🙂
Ensure that your php-fpm container has a defined hostname.
I edited laradoc/docker-compose.yml to add the following line to the php-fpm container definition.
hostname: php-fpm
Edit bootstrap/start.php detectEnvironment section to use that hostname.
I did this: ‘local’ => array(‘php-fpm’),
turn off redis by editting app/config/cache.php to become this:
‘driver’ => ‘file’,
// ‘driver’ => ‘redis’,
I couldn’t figure out how to get laravel-tricks to use my Redis Docker Container.
Edit main.blade.php to change css/laratricks.min.4.css to be css/laratricks.min.css
Edit navigation.blade.php to fix logo@2x.1.png to read logo@2x.png.