0

While playing around with redis, I notice that, connecting with Predis and redis-cli lead to different keyspaces both with the name db0. Both connections were made to a redis-server running on tcp://localhost:6379. I can see that the dumps are in different locations aswell.

Here's the info from both instances :

From redis-cli : info server

# Server
redis_version:2.8.19
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:70633d1af7244f5e
redis_mode:standalone
os:Darwin 14.3.0 x86_64
arch_bits:64
multiplexing_api:kqueue
gcc_version:4.2.1
process_id:517
run_id:900bab4b7a89ed6616bababd8c7d443b7d53f6a8
tcp_port:6379
uptime_in_seconds:136898
uptime_in_days:1
hz:10
lru_clock:5781598
config_file:/usr/local/etc/redis.conf

and

from predis, info

  'Server' => 
    array (size=17)
      'redis_version' => string '2.8.19' (length=6)
      'redis_git_sha1' => string '00000000' (length=8)
      'redis_git_dirty' => string '0' (length=1)
      'redis_build_id' => string '70633d1af7244f5e' (length=16)
      'redis_mode' => string 'standalone' (length=10)
      'os' => string 'Darwin 14.3.0 x86_64' (length=20)
      'arch_bits' => string '64' (length=2)
      'multiplexing_api' => string 'kqueue' (length=6)
      'gcc_version' => string '4.2.1' (length=5)
      'process_id' => string '8894' (length=4)
      'run_id' => string 'fff57e23438c261c83dc0e91ca4829a743d5919a' (length=40)
      'tcp_port' => string '6379' (length=4)
      'uptime_in_seconds' => string '5621' (length=4)
      'uptime_in_days' => string '0' (length=1)
      'hz' => string '10' (length=2)
      'lru_clock' => string '5781216' (length=7)
      'config_file' => string '' (length=0)

2 Answers2

1
run_id:900bab4b7a89ed6616bababd8c7d443b7d53f6a8
'run_id' => string 'fff57e23438c261c83dc0e91ca4829a743d5919a' (length=40)

The above is the proof you are connecting with two different Redis servers, so the answer is simply that there is a different problem to solve, that is, to understand why it is happening. After checking the obvious reasons, if you don't find any clue, check if you are perhaps talking with one server listening into an IPv6 address and one listening to an IPv4 address, same port.

antirez
  • 18,314
  • 5
  • 50
  • 44
0

The solution was simpler than I imagined. Apparently I had another redis-server running because while installing through homebrew I had inadvertently added a plist file to run a redis daemon by default.

Checking all redis instances with

ps aux | grep "redis"

cleared up the matter.

  • It is not possible to have multiple instances running in the same ip/address, so the only option was that you had one running bound in an ipv4 address and one in an ipv6, since in the two INFO outputs the port is the same (6379). Probably you used "localhost" in one side, and "127.0.0.1" in another side, the first resolved to the ipv6 loopback address. – antirez May 22 '15 at 21:18