[root@xxx-0001 src]# redis-server /etc/redis-cluster/redis-7001.conf
*** FATAL CONFIG FILE ERROR ***
Reading the configuration file, at line 194
>>> 'always-show-logo yes'
Bad directive or wrong number of arguments
报错的意思是, 本次启动指定的配置文件目录是错误的或者配置文件的参数数量不对.
原因就出在, 第一次安装redis-4.0.8时, 写入了环境变量, 执行redis-server时, 会先去查询环境变量里有没有配置这条指令,
发现有(还是旧的4.0.8的). 但是使用的配置文件是5.0.7的
总结来说,就是环境变量里的redis-server是我之前版本导入的,我Redis更换了版本,就不能用之前导入的环境变量来执行
这样来看,解决方法就清晰了:
方法一:重新导入新版本Redis的redis-server到环境变量
方法二:直接用新版本Redis里的redis-server执行启动命令
最后给大家看一下解决后的情况
[root@xxx-0001 src]# ./redis-server /etc/redis-cluster/redis-7001.conf
27895:C 06 Dec 2021 13:09:29.818 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
27895:C 06 Dec 2021 13:09:29.818 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=27895, just started
27895:C 06 Dec 2021 13:09:29.818 # Configuration loaded
[root@apm-0003 src]# ./redis-server /etc/redis-cluster/redis-7002.conf
27952:C 06 Dec 2021 13:09:37.218 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
27952:C 06 Dec 2021 13:09:37.218 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=27952, just started
27952:C 06 Dec 2021 13:09:37.218 # Configuration loaded
[root@apm-0003 src]# ./redis-server /etc/redis-cluster/redis-7003.conf
27996:C 06 Dec 2021 13:09:40.829 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
27996:C 06 Dec 2021 13:09:40.829 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=27996, just started
27996:C 06 Dec 2021 13:09:40.829 # Configuration loaded
[root@apm-0003 src]# ./redis-server /etc/redis-cluster/redis-7004.conf
28021:C 06 Dec 2021 13:09:43.651 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
28021:C 06 Dec 2021 13:09:43.651 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=28021, just started
28021:C 06 Dec 2021 13:09:43.651 # Configuration loaded
[root@apm-0003 src]# ./redis-server /etc/redis-cluster/redis-7005.conf
28065:C 06 Dec 2021 13:09:46.736 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
28065:C 06 Dec 2021 13:09:46.737 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=28065, just started
28065:C 06 Dec 2021 13:09:46.737 # Configuration loaded
[root@apm-0003 src]# ./redis-server /etc/redis-cluster/redis-7006.conf
28124:C 06 Dec 2021 13:09:50.963 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
28124:C 06 Dec 2021 13:09:50.963 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=28124, just started
28124:C 06 Dec 2021 13:09:50.963 # Configuration loaded
[root@xxx-0001 src]# ps -ef|grep redis
root 6227 1 0 12:35 ? 00:00:04 redis-server 0.0.0.0:6379
root 27896 1 0 13:09 ? 00:00:00 ./redis-server 0.0.0.0:7001 [cluster]
root 27953 1 0 13:09 ? 00:00:00 ./redis-server 0.0.0.0:7002 [cluster]
root 27998 1 0 13:09 ? 00:00:00 ./redis-server 0.0.0.0:7003 [cluster]
root 28022 1 0 13:09 ? 00:00:00 ./redis-server 0.0.0.0:7004 [cluster]
root 28066 1 0 13:09 ? 00:00:00 ./redis-server 0.0.0.0:7005 [cluster]
root 28125 1 0 13:09 ? 00:00:00 ./redis-server 0.0.0.0:7006 [cluster]
root 28276 4581 0 13:10 pts/4 00:00:00 grep --color=auto redis