Error messages for geoset commands

(error) ERR unknown command ‘geoadd’ is shown even after I have updated my redis-server to version 5.0.7

I have installed it on WSL1 [Ubuntu]. Anyone knows how I can fix this error?

Are you running the command from code or from the command line? If from command line, then make sure you are using the correct quote symbol around your text. Such as:

GEOADD Sicily 13.361389 38.115556 "Palermo"

Sometimes copy & paste results in incompatible quotes around your text entry. So try typing in the quotes yourself.

redis 127.0.0.1:6379> geoadd Sicily 13.361389 38.115556 “Palermo”
(error) ERR unknown command ‘geoadd’
redis 127.0.0.1:6379> GEOADD Sicily 13.361389 38.115556 “Palermo”
(error) ERR unknown command ‘GEOADD’

This is what I get with your suggested text entry. The command line does not seem to recognize the command.

That’s a strange one. I wonder if somehow it’s connecting to another version. Do other 5.x commands work? Such as " XADD mystream * island Sicily city Palermo"? if not, try " set foo bar"

@nodetojoy1917 Two possibilities:

  1. You’ve renamed a command (unlikely)
  2. You’ve actually not updated your server and you’re connected to a very old version. (Most likely)

Run info in redis-cli and the second line will verify which version you are on.

E.g.:

127.0.0.1:6379> info
# Server
redis_version:5.0.7
...

127.0.0.1:6379> set foo bar
OK
127.0.0.1:6379> XADD mystream * island Sicily city Pale
(error) ERR unknown command ‘XADD’

This is what I obtain

sriganesh@LAPTOP-O38IOT4I:~$ redis-server
80:C 14 Jun 2020 22:36:05.957 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
80:C 14 Jun 2020 22:36:05.959 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=80, just started
80:C 14 Jun 2020 22:36:05.959 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
80:M 14 Jun 2020 22:36:05.969 * Increased maximum number of open files to 10032 (it was originally set to 1024).
80:M 14 Jun 2020 22:36:05.972 # Could not create server TCP listening socket *:6379: bind: Address already in use

This command says that my redis server version is 5.0.7

@nodetojoy1917 Take a look at the last line of your output Could not create server TCP listening socket *:6379: bind: Address already in use - this means you’re running another Redis server on you machine (in the background, probably).

To determine version, always use the INFO command from redis-cli. It’s very easy to confuse versions, INFO will tell you what you’re actually connected to, not what’s running.

Thanks, it finally worked for me.

2 Likes