为什么有的时候开机,redis没有自动起来呢?
伊谢尔伦
伊谢尔伦 2017-04-21 11:15:41
0
1
691

不常见,但有的时候开机redis没有自个启动,不知道如何查找原因,请高人指点

$ redis-cli
Could not connect to Redis at 127.0.0.1:6379: Connection refused

我看了下日至,如下

[207] 29 Sep 18:22:41.020 * 1 changes in 900 seconds. Saving...
[207] 29 Sep 18:22:41.099 * Background saving started by pid 2473
[2473] 29 Sep 18:22:41.685 * DB saved on disk
[207] 29 Sep 18:22:42.014 * Background saving terminated with success
[207 | signal handler] (1380450274) Received SIGTERM, scheduling shutdown...
[207] 29 Sep 18:24:34.759 # User requested shutdown...
[207 | signal handler] (1380450274) Received SIGTERM, scheduling shutdown...
[207] 29 Sep 18:24:34.899 * Saving the final RDB snapshot before exiting.
[207] 29 Sep 18:24:35.050 * DB saved on disk
[207] 29 Sep 18:24:35.050 * Removing the pid file.
[207] 29 Sep 18:24:35.150 # Redis is now ready to exit, bye bye...
[620] 29 Sep 21:50:35.953 * Max number of open files set to 10032
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 2.6.14 (00000000/0) 64 bit
  .-`` .-".  "\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in stand alone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 620
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

[620] 29 Sep 21:50:35.971 # Server started, Redis version 2.6.14
[620] 29 Sep 21:50:35.984 * DB loaded from disk: 0.013 seconds
[620] 29 Sep 21:50:35.984 * The server is now ready to accept connections on port 6379

好像也没有异常,上面提到的

[207] 29 Sep 18:24:35.050 * Removing the pid file.

因该是我关机的缘故,pid删除了,一般的情况下,开机会自动启动pid的,但是这次没有,上面启动界面是我最有一次手动启动的log信息

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

모든 응답(1)
Ty80

Redis는 시작 시 SIGTERM 신호에 대한 신호 처리 기능을 등록합니다. 이 기능을 사용하면 Redis는 작업을 종료하기 전에 RDB 파일 저장 및 PID 파일 삭제와 같은 일부 리소스 정리 작업을 수행할 수 있습니다. redis는 데몬 모드에서 실행됩니다.) 이러한 모든 작업이 완료되면 종료 기능을 호출하여 종료합니다.

이 로그의 내용은 다음과 같습니다.

으아악

모두 위에서 언급한 프로세스와 일치합니다. SIGTERM 신호 수신 -> 리소스 처리 -> Redis 서비스 종료

그러나 다음 로그의 시간은 위와 달라야 합니다.

으아악

그래서 문제의 핵심은 왜 Redis가 시작될 때 SIGTERM 신호를 받는 걸까요?

최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!