Connect to Remote Redis Server – Guidelines

redis cli connect to remote

Today in this article we shall see how to connect to Remote Redis Server. We shall see all the basic commands and various ways of connecting.

Today in this article, we will cover below aspects,

Redis-cli connects to remote Redis Server – using host & port

By default redis-cli connects to the server at 127.0.0.1 i.e your localhost and port 6379.

You can change the host or port using command-line options.

To use a different hostname or an IP address, use -h. To use a different port, use -p.

Command

redis-cli -h host -p port

Example

redis cli connect to remote

Connect to Remote Redis Server using the password

If your Redis server is password protected then additionally -a command is used.

-a command is actually equivalent of the below AUTH command,

AUTH <password>

Command

redis-cli -h host -p port -a password

Example

redis cli connect to remoteConnect to Remote Redis Server

Connect to Remote Redis using uri option in command

You can connect to the Redis server using the valid URL option  -u <uri> option.

Command

$ redis-cli -u redis://password@host:port

Example:

redis-cli -u redis://[email protected]:6379 ping

redis cli connect to remote

Connect to Remote Redis Server using SSL/TLS

By default, redis-cli connects to Redis via a standard TCP connection. 

Command using —tls or  —cacert or — cacertdir can be used to enable SSL/TLS.

Reference :

Do you have any comments or ideas or any better suggestions to share?

Please sound off your comments below.

Happy Coding !!



Please bookmark this page and share it with your friends. Please Subscribe to the blog to receive notifications on freshly published(2024) best practices and guidelines for software design and development.



Leave a Reply

Your email address will not be published. Required fields are marked *