How to turn off 'protected-mode' in Redis?

Turns out that the current server running isn't the same version as the binary I've installed.

How to reproduce this?

Simply connect via redis-cli to your redis instance and type INFO server which returns a bunch of informations.

127.0.0.1:6379> INFO server
# Server
redis_version:3.0.7
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:869e89100d5ea8c2
redis_mode:standalone
os:Linux 4.2.0-35-generic x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:4.8.4
process_id:26720
run_id:6645270dd2ac6a7f96caa054f9dbba9e66566755
tcp_port:6379
uptime_in_seconds:10971777
uptime_in_days:126
hz:10
lru_clock:6676576
config_file:/etc/redis/redis.conf

As you can see this redis-instance runs almost 127 days and uses redis_version:3.0.7.

How to fix this?

Restart your server and be sure that you realy restarted it! For example with most Linux distros you can do so by hitting the following commands.

root@svim-redis03 ~ # service redis-server stop
Stopping redis-server: redis-server.

Check if it's really offline by trying to connect with redis-cli. If you still can connect the instance is still running. Check this by searching for active redis processes.

root@svim-redis03 ~ # ps -efl |grep redis
1 S redis    12418     1  0  80   0 - 10673 ep_pol  2016 ?        05:33:17 /usr/bin/redis-server 127.0.0.1:6381
1 S redis    12442     1  0  80   0 - 11697 ep_pol  2016 ?        05:33:46 /usr/bin/redis-server 127.0.0.1:6382
1 S redis    12453     1  0  80   0 - 10673 ep_pol  2016 ?        05:40:17 /usr/bin/redis-server 127.0.0.1:6383
4 S root     16570 16386  0  80   0 -  2489 wait_w 10:42 pts/7    00:00:00 tail -f /var/log/redis/redis-server-6379.log
0 S root     17064 12637  0  80   0 -  3617 pipe_w 10:47 pts/1    00:00:00 grep --color=auto redis
1 S redis    26720     1  0  80   0 - 453041 ep_pol Mar07 ?       08:37:01 /usr/bin/redis-server 127.0.0.1:6379

As you can see there's still the instance (process id: 26720) running. Quit it with the following command.

kill 26720

After you've killed the process check again with ps -efl |grep redis if the instance is really down.

Finally start it again with

root@svim-redis03 ~ # service redis-server start
Starting redis-server: redis-server.

Now check if the instance is running with the correct version.

root@svim-redis03 ~ # redis-cli
127.0.0.1:6379> INFO server
# Server
redis_version:3.2.9
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:86450d2ba8219c1e
redis_mode:standalone
os:Linux 4.2.0-35-generic x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:4.8.4
process_id:17135
run_id:40d6fa2e2b25e8f5b97a3c97ec1bddb8edda0014
tcp_port:6379
uptime_in_seconds:11
uptime_in_days:0
hz:10
lru_clock:6677102
executable:/usr/bin/redis-server
config_file:/etc/redis/redis.conf