Installed a redis in ubuntu 16.4 in digitalocean.
I've changed the default redis server 127.0.0.1:6379
into my own ip in digitalocean 178.xxx.xxx.xxx:6379
by editing editing vim /etc/redis/redis.conf
After that I tried redis-cli
and redis-cli shutdown
all responded this: Could not connect to Redis at 127.0.0.1:6379: Connection refused
But if ps aux|grep redis
I get:
redis 11734 0.0 0.1 41852 3892 ? Ssl 15:45 0:11 /usr/local/bin/redis-server 178.xxx.xxx.xxx:6379
root 12735 0.0 0.0 12944 948 pts/0 S+ 19:11 0:00 grep --color=auto redis
Is this normal?Or what should I do?
What you should do depends on how you want it to work...
If you want to be able to connect to Redis via any network interface, comment out all the bind
directives in your config file by putting a #
at the start of the line beginning bind
.
If you want to only be able to connect by specifying 178.xxx.xxx.xxx, then put the following in your config file:
bind 178.xxx.xxx.xxx
If you want to use 127.0.0.1 or 178.xxx.xxx.xxx, then put:
bind 178.xxx.xxx.xxx 127.0.0.1
I'm guessing you want this option, but see security note below.
In general though, it is not advisable from a security point of view, to expose your Redis server to the whole Internet - and all the options above do exactly that. You probably want to bind to 127.0.0.1 and set up an ssh
tunnel from your 178.xxx.xxx.xxx public address to 127.0.0.1.
Whatever you put in there, restart Redis to make changes take effect.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments