Issues connecting to Redis from TablePlus and question about internal environment variables

norbertoskHOBBY

8 months ago

Hi everyone,

I launched a Redis project using the Railway template, but I'm having trouble connecting to the instance from a client like TablePlus. I'm using the public URL generated in the environment variable, but I can't establish the connection properly. The port in the public configuration is different from the default Redis port (49894 instead of 6379), but even with that information, it doesn't work.

Additionally, if I have another service running on Railway and want to use Redis, is it possible to use internal environment variables like RAILWAY_PRIVATE_DOMAIN and REDIS_URL to connect directly from that service?

Could anyone provide an example of how to configure this correctly?

Thanks for the help!

Solved

8 Replies

8 months ago

Hello,

When connecting to your railway-hosted database you would need to use the public URL and or public host and port.

The public host would not be 6379, as that is the private port.

When you are connecting from another service in the same environment you can use the private network, simply reference the database URL - https://docs.railway.app/guides/variables#reference-variables


norbertoskHOBBY

8 months ago

Hello,

When connecting to your railway-hosted database you would need to use the public URL and or public host and port.

The public host would not be 6379, as that is the private port.

When you are connecting from another service in the same environment you can use the private network, simply reference the database URL - https://docs.railway.app/guides/variables#reference-variables

Thanks for the reply.

If it doesn't connect, could I need to configure something after deploying the template?

I've left it as default.

I also tried changing the user and password, but I can't connect, table plus keeps waiting and never connects.

Thanks.


8 months ago

You do not need to change anything, and you likely shouldn't be changing anything, please keep in mind that we are not able to restore lost data that isn't a fault of the platform.

I would recommend deploying a new database and going from there, since I don't know what state you have put your database in.


norbertoskHOBBY

8 months ago

You do not need to change anything, and you likely shouldn't be changing anything, please keep in mind that we are not able to restore lost data that isn't a fault of the platform.

I would recommend deploying a new database and going from there, since I don't know what state you have put your database in.

Thank you.

I have deleted the redis project and created another one.

Although it still fails with tablePLus, I was able to connect from my project.

Now I have another problem, which I don't know how to solve.

When I use the variable from my API:

${{Redis.REDISHOST}}

My API gives an error, since that variable is empty, how can I solve it?

I have seen that if I edit REDISHOST in REDIS, this appears ${{RAILWAY_PRIVATE_DOMAIN}}

Thank you.


8 months ago

You need to enable private networking in your service settings -

Attachments


norbertoskHOBBY

8 months ago

You need to enable private networking in your service settings -

Thanks.

I can't get it to work, I've enabled the private network.

but I get an error.

I'm thinking of using the public URL, but it doesn't make sense.

Attachments



norbertoskHOBBY

8 months ago

Thanks.

After all, I was able to connect my NEST project with REDIS.

But I had to use other dependencies, and connect directly through the Internal Redis URL.

Anyway, the first thing I noticed is that the response from my app (front), whether I use cache or not, takes approximately the same time. I thought that with the cache, by avoiding going to the DB, the performance would improve.

But I will continue testing.

Thanks.


Status changed to Solved brody 8 months ago