How to Start Redis-Server on a Different Port Than the Default Port 6379 in Ubuntu

Open Redis port for remote connections

Did you set the bind option to allow remote access on the redis server?

Before (file /etc/redis/redis.conf)

bind 127.0.0.1

After

bind 0.0.0.0

and run sudo service redis-server restart to restart the server. If that's not the problem, you might want to check any firewalls that might block the access.

Important: If you don't use a firewall (iptables, ufw..) to control who connects to the port in use, ANYONE can connect to this Redis instance. Without using Redis' AUTH that means anyone can access/change/delete your data. Be safe!

How can I run redis on a single server on different ports?

Launch redis-server and supply a different argument for 'port' which can be done on the command-line:

edd@max:~$ redis-server -h
Usage: ./redis-server [/path/to/redis.conf] [options]
./redis-server - (read config from stdin)
./redis-server -v or --version
./redis-server -h or --help
./redis-server --test-memory <megabytes>

Examples:
./redis-server (run the server with default conf)
./redis-server /etc/redis/6379.conf
./redis-server --port 7777
./redis-server --port 7777 --slaveof 127.0.0.1 8888
./redis-server /etc/myredis.conf --loglevel verbose

Sentinel mode:
./redis-server /etc/sentinel.conf --sentinel
edd@max:~$

You can do this from, say, /etc/rc.local as well so that this happens at startup.

But maybe you can also rethink your approach. Redis is so good at handling writes that you may just get by with a second database?

Unable to ping redis server port 6379 from Windows Command Prompt

I doubt Redis responds to regular ping requests which use ICMP packets .

If you want to check your Redis server is up, install the redis-cli tools on Windows and send a Redis-style "ping" with:

redis-cli -h 172.29.0.1 PING

address already in use with redis-server

The problem shows that the port is already in use by another process or is open in another window.

Change the port of redis server

redis-server --port 6360 will start a Redis server listening to port 6360.

redis-cli -p 6360 - Now use this to make your client listen at this port.

Hope this helps solve your problem

Redis - Connect to Remote Server

First I'd check to verify it is listening on the IPs you expect it to be:

netstat -nlpt | grep 6379

Depending on how you start/stop you may not have actually restarted the instance when you thought you had. The netstat will tell you if it is listening where you think it is. If not, restart it and be sure it restarts.
If it restarts and still is not listening where you expect, check your config file just to be sure.

After establishing it is listening where you expect it to, from a remote node which should have access try:

redis-cli -h REMOTE.HOST ping

You could also try that from the local host but use the IP you expect it to be listening on instead of a hostname or localhost. You should see it PONG in response in both cases.

If not, your firewall(s) is/are blocking you. This would be either the local IPTables or possibly a firewall in between the nodes. You could add a logging statement to your IPtables configuration to log connections over 6379 to see what is happening. Also, trying he redis ping from local and non-local to the same IP should be illustrative. If it responds locally but not remotely, I'd lean toward an intervening firewall depending on the complexity of your on-node IP Tables rules.



Related Topics



Leave a reply



Submit