erikdubbelboer / phpRedisAdmin

Simple web interface to manage Redis databases.
http://dubbelboer.com/phpRedisAdmin/
3.11k stars 666 forks source link

Uncaught Predis\Connection\ConnectionException: Error while reading line from the server. #183

Closed JESii closed 2 years ago

JESii commented 2 years ago

I'm running phpRedisAdmin through an ssh tunnel to one of our work environments. MacOS : 11.6.5 Redis: 6.2.6 Redis there is configured to use port 6380, so I ran the following docker command:

docker run --rm \
  -p 8092:80 \
  -e NODE_TLS_REJECT_UNAUTHORIZED=0 \
  -e REDIS_1_HOST=host.docker.internal \
  -e REDIS_1_NAME=redis \
  -e REDIS_1_PORT=6380 \
  -e REDIS_TLS=true \
  -e REDIS_PASSWORD=$1 \
  erikdubbelboer/phpredisadmin:latest

when I run http://localhost:8092, there's pause and then:

<br />
<b>Fatal error</b>:  Uncaught Predis\Connection\ConnectionException: Error while reading line from the server. [tcp://host.docker.internal:6380] in /src/app/vendor/predis/predis/src/Connection/AbstractConnection.php:155
Stack trace:
#0 /src/app/vendor/predis/predis/src/Connection/StreamConnection.php(314): Predis\Connection\AbstractConnection-&gt;onConnectionError('Error while rea...')
#1 /src/app/vendor/predis/predis/src/Connection/AbstractConnection.php(120): Predis\Connection\StreamConnection-&gt;read()
#2 /src/app/vendor/predis/predis/src/Connection/AbstractConnection.php(112): Predis\Connection\AbstractConnection-&gt;readResponse(Object(Predis\Command\KeyScan))
#3 /src/app/vendor/predis/predis/src/Client.php(331): Predis\Connection\AbstractConnection-&gt;executeCommand(Object(Predis\Command\KeyScan))
#4 /src/app/vendor/predis/predis/src/Client.php(314): Predis\Client-&gt;executeCommand(Object(Predis\Command\KeyScan))
#5 /src/app/index.php(14): Predis\Client-&gt;__call('scan', Array)
#6 {main}
  thrown in <b>/src/app/vendor/predis/predis/src/Connection/AbstractConnection.php</b> on line <b>155</b><br />

Not sure where I should start looking for a solution to this issue.

erikdubbelboer commented 2 years ago

It basically says it can't connect to tcp://host.docker.internal:6380. Make sure Redis is running on the same machine on port 6380 outside of Docker. If you run Redis in Docker as well you'll probably have to use docker-compose to start both inside the same network and use the container hostname to connect to instead of host.docker.internal.

JESii commented 2 years ago

Thanks... First off, I'm running through an ssh tunnel, so Redis is on the other side of the tunnel and exposing port 6380. Second, the following works to start rediscommander thru the tunnel

docker run --rm \
  -p 8181:8081 \
  -e NODE_TLS_REJECT_UNAUTHORIZED=0 \
  -e REDIS_HOST=host.docker.internal \
  -e REDIS_PORT=6380 \
  -e REDIS_TLS=true \
  -e REDIS_PASSWORD=$1 \
  rediscommander/redis-commander:latest

so I can't figure out what's causing phpRedisAdmin to fail... I'll keep trying things, but any insight you have would be most appreciated.

erikdubbelboer commented 2 years ago

Could it be that you have the SCAN command disabled? It is trying to execute this command and the error happens when receiving the response. Otherwise I have no idea how to help you further.

Side note: What is the benefit of using phpRedisAdmin over redis-commander? It seems like redis-commander has more features and is being actively developed.

JESii commented 2 years ago

Thank you, Erik… I really appreciate your weighing in. And no… SCAN is not disabled as RD is using that (at least I’ve said “useScan” — I’ll confirm).

The problem is that when using RD through an SSH tunnel — what we have to do to get to our production servers — it is incredibly slow: 16 minutes to load up the contents before we can view and start troubleshooting. I have been looking for a better experience and was hoping that your product would help. I really like the pRA interface — too many of the products I’ve reviewed don’t have a tree view which is an absolute requirement, IMO. And I had used phpMyAdmin for many years and the name of your offering naturally caught my eye.

Anyway, thanks again… I appreciate the help.

All the best…Jon Stay safe; be well.

On Jul 14, 2022, at 1:15 AM, Erik Dubbelboer @.***> wrote:

Could it be that you have the SCAN command disabled? It is trying to execute this command and the error happens when receiving the response. Otherwise I have no idea how to help you further.

Side note: What is the benefit of using phpRedisAdmin over redis-commander? It seems like redis-commander has more features and is being actively developed.

— Reply to this email directly, view it on GitHub https://github.com/erikdubbelboer/phpRedisAdmin/issues/183#issuecomment-1184139888, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAADZXX2Q6SIETOLTCGUUDVT7EBFANCNFSM53PU24YQ. You are receiving this because you authored the thread.

erikdubbelboer commented 2 years ago

Sounds like you have a lot of keys in your Redis. These kinds of admin interfaces are more for smaller instances or for during development. To maintain some production system with a lot of keys I would always just use the CLI interface. I heard some good things about https://www.redsmin.com/ in the past, but I have never used it myself.

JESii commented 2 years ago

Thanks again, Erik… I’ll check them out!