How to run redis server on a different port than default port 6379 in ubuntu

How to run redis server on a different port than default port 6379 in ubuntu

I used the following steps to install redis

  • sudo add-apt-repository ppa: rwky / redis
  • Sudo apt-get update
  • sudo apt-get -y install redis-server

I installed, but I do not know how to start the redis server on a different port than the default port 6379

Tell me how to change the default port to another port?

+5
source share
2 answers
  • Locate the redis.conf file (it will probably be located in /etc/redis/6379.conf ).
  • Copy the file or edit it and change the port directive to any free port.
  • Start Redis with a new configuration file (note that if you copied the file in the previous step, you will need to change the script service start to use this file).
+1
source

-p <port> Server port (default: 6379).

So, if your instance is running under port 1985, just run

 $redis-cli -p 1985 
+1
source

Source: https://habr.com/ru/post/1210881/


All Articles