Cannot Connect to Local Redis Instance: Invalid Host Name "localhost"

8 visualizzazioni (ultimi 30 giorni)
Hi everyone,
I'm trying to get started with connecting MATLAB to a local Redis data cache instance. I've followed the basic example in the mps documentation but I've been getting the following error:
I'm on Mac OS Catalina 10.15.7. I've installed Redis via homebrew and was able to connect successfully from the command line (successful ping-pong output), including creating the sever with "-h localhost" and port #6379.
I don't really understand what's going on. Am I supposed to start the server from the command line first and then MATLAB connects to it, or does mps.cache.control create it? Does being on Mac require more setup first? Am I supposed to create the data cache with a specific configuration using the mps command line tools first (which I couldn't try because I couldn't find the path for the CLI code)?
Sorry if these are newbie questions, but I haven't really found anything that appears to be related yet in the documentation or online. Any other resources would be appreciated!

Risposte (1)

Seth DeLand
Seth DeLand il 24 Gen 2023
I encountered this same message, for me the problem was that my /etc/hosts file on MacOS had been modified when I did some work with docker/kubernetes. By default, that file has the following 3 lines:
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
Mine had this additional line that was uncommented:
127.0.0.1 kubernetes.docker.internal
When I commented out that line above (with a "#" sign) and saved the file, I was able to start the Redis cache from MATLAB.
  1 Commento
Nicole Bonfatti
Nicole Bonfatti il 1 Giu 2023
Modificato: Nicole Bonfatti il 1 Giu 2023
if you still want that "kubernetes.docker.internal" hostname to resolve, after commenting it out you can add it to the end of the first "localhost" line. IE:
127.0.0.1 localhost kubernetes.docker.internal
See: The wikipedia entry for the hosts file.

Accedi per commentare.

Prodotti


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by