>>> ‘Redis configuration file example.‘ Bad directive or wrong number of arguments

  • Post author:
  • Post category:其他




错误产生环境:



问题描述


redis6.2.1中修改配置之后,导致连接不上

[root@linux1 bin]# redis-server /etc/redis.conf

*** FATAL CONFIG FILE ERROR (Redis 6.2.1) ***
Reading the configuration file, at line 1
>>> 'Redis configuration file example.'
Bad directive or wrong number of arguments
[root@linux1 bin]# ps -ef | grep redis
root       3248   3154  0 18:06 pts/0    00:00:00 grep redis




原因分析:

修改配置环境的时候误把配置文件开头的“#”删掉了

Redis configuration file example.
#
# Note that in order to read the configuration file, Redis must be
# started with the file path as first argument:
#
# ./redis-server /path/to/redis.conf

# Note on units: when memory size is needed, it is possible to specify
# it in the usual form of 1k 5GB 4M and so forth:
#
# 1k => 1000 bytes
# 1kb => 1024 bytes
# 1m => 1000000 bytes
# 1mb => 1024*1024 bytes
# 1g => 1000000000 bytes
# 1gb => 1024*1024*1024 bytes




解决方案:

加上“#”即可

# Redis configuration file example.
#
# Note that in order to read the configuration file, Redis must be
# started with the file path as first argument:
#
# ./redis-server /path/to/redis.conf

# Note on units: when memory size is needed, it is possible to specify
# it in the usual form of 1k 5GB 4M and so forth:
#
# 1k => 1000 bytes
# 1kb => 1024 bytes
# 1m => 1000000 bytes
# 1mb => 1024*1024 bytes
# 1g => 1000000000 bytes
# 1gb => 1024*1024*1024 bytes

[root@linux1 bin]# redis-server /etc/redis.conf
[root@linux1 bin]# redis-cli
127.0.0.1:6379> keys *



版权声明:本文为llllllllllllllllll1原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。