Redis常用配置
小技巧: vim中使用 :/搜索内容,进行快速搜索
网络配置
################################################################ vim /usr/local/redis/redis-6.2.3/redis.conf ... port 6379 # 端口可以自行改,但是记住防火墙开放你设置的端口 ... bind 127.0.0.1 -::1 # 改为自己Linux系统IP 192.168.46.130 ... ################################################################# [root@jh redis-6.2.3]# redis-server redis.conf & #修改配置文件后,启动需要加上配置文件名不然还是默认配置 [root@jh redis-6.2.3]# ps -ef|grep redis root 4700 3471 0 00:14 pts/0 00:00:00 redis-server 192.168.46.130:6379 root 4727 3471 0 00:15 pts/0 00:00:00 grep --color=auto redis [root@jh redis-6.2.3]# redis-cli shutdown #修改配置文件后,关闭需要在指令中加入-h IP -p 端口号 Could not connect to Redis at 127.0.0.1:6379: Connection refused [root@jh redis-6.2.3]# redis-cli -h 192.168.46.130 -p 6379 shutdown
常规配置
################################################################ ... databases 16 # 默认16个数据库 ... ... loglevel notice # 日志等级 ... logfile "" # 可以在"" 中指定日志文件 ... ################################################################# [root@jh redis-6.2.3]# redis-server redis.conf & [1] 5225 [root@jh redis-6.2.3]# ls 00-RELEASENOTES CONTRIBUTING dump.rdb MANIFESTO redis.conf runtest-moduleapi src utils BUGS COPYING INSTALL myRedis.log runtest runtest-sentinel tests CONDUCT deps Makefile README.md runtest-cluster sentinel.conf TLS.md [root@jh redis-6.2.3]# cat myRedis.log .... # 所有打印信息都被放入myRedis.log