To connect to a remote Redis server, you can use the redis-cli command with the -h option to specify the hostname or IP address of the remote server and the -p option to specify the port if it's different from the default (6379). Here’s the command:
redis-cli -h <remote_host> -p <port>
Replace <remote_host> with the IP address or hostname of the remote Redis server and <port> with the port number if it's not the default.
For example, to connect to a Redis server at IP address 192.168.1.100 on the default port, you would use:
redis-cli -h 192.168.1.100
If your Redis server requires authentication, you can add the -a option followed by the password:
redis-cli -h <remote_host> -p <port> -a <password>
Make sure that the Redis server is configured to allow remote connections and that any necessary firewall rules are set up to permit access.
