000.Mac进入redis服务端错误信息:"Increased maximum number of open files to 10032 (it was originally set to 256)"

1.场景现象

Redis服务端正在加载数据时,由于退出redis服务端或者关闭redis服务端窗口....,导致无法再次进入redis服务端,如下错误:

>>>$ redis-server  # 启动redis服务端
1051:C 06 May 2021 14:13:49.227 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1051:C 06 May 2021 14:13:49.227 # Redis version=5.0.4, bits=64, commit=00000000, modified=0, pid=1051, just started
1051:C 06 May 2021 14:13:49.227 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
1051:M 06 May 2021 14:13:49.228 * Increased maximum number of open files to 10032 (it was originally set to 256).
1051:M 06 May 2021 14:13:49.228 # Could not create server TCP listening socket *:6379: bind: Address already in use

2. 解决方案

2.1 方案1

2.1.1 查看系统限制

$ ulimit -a 

# 设置“open files”数量  
$ ulimit -n 10032  

2.1.2 再次进入redis服务端,如下错误

>>>$ redis-server
1061:C 06 May 2021 14:14:36.611 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1061:C 06 May 2021 14:14:36.611 # Redis version=5.0.4, bits=64, commit=00000000, modified=0, pid=1061, just started
1061:C 06 May 2021 14:14:36.611 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
1061:M 06 May 2021 14:14:36.613 # Could not create server TCP listening socket *:6379: bind: Address already in use
6379地址已经在使用(6379是redis默认的端口)

2.2 方案2

2.2.1 查找进程

$ ps -ef | grep -i redis


进程号3272是redis的服务器

2.2.2 kill进程

# 使用"kill -9"命令
$ kill -9 3272  # 进程3272是redis服务器

2.2.3 重启Redis服务

$ redis-server
5377:C 05 May 2021 21:20:46.788 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
5377:C 05 May 2021 21:20:46.788 # Redis version=5.0.4, bits=64, commit=00000000, modified=0, pid=5377, just started
5377:C 05 May 2021 21:20:46.788 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 5.0.4 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 5377
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               
 
5377:M 05 May 2021 21:20:46.791 # Server initialized
5377:M 05 May 2021 21:20:46.791 * Ready to accept connections
posted @ 2021-07-05 10:52  可可逗豆  阅读(380)  评论(0)    收藏  举报