Laravel Forge setup connection between servers to access redis
I provisioned two servers via Forge and granted both access to each other via the Network tab. When trying to connect to server a's redis instance via server b over its private ip address it's not working. I am getting the:
(error) DENIED Redis is running in protected mode...
According to the forge docs this should work:
Once you have granted access from one server to another, you may access the other server via its private IP address.
You need to tell it which network adapter Redis needs to listen on in order to listen to the private network. By default it only listens to requests from its own server.
Try adding changing the bind setting to bind <private_ip> in the /etc/redis/redis.conf file, where <private_ip> is the private address of the redis server. Then it will listen to requests being sent to that ip, which will be those servers that have access to the private ip.
After you first create the cache server, you need to create a password for it: click the "Databases" section for your cache server, and set a password there. Then, for the server that needs to connect to it, make sure the REDIS_HOST is the private IP of your cache server, and REDIS_PASSWORD is the password that you just set.
Aside from that, check the "Network" section of your servers to make sure that they can connect to each other as-needed.