首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >服务未能在Ubuntu16.04和CentOS 7上启动

服务未能在Ubuntu16.04和CentOS 7上启动
EN

Server Fault用户
提问于 2018-02-27 06:02:57
回答 1查看 7.6K关注 0票数 1

很难让我的Redis哨兵系统启动。

我可以成功地手动运行哨兵--例如:

代码语言:javascript
复制
root@poolwc:/etc/redis# redis-sentinel ./sentinel.conf --sentinel

位于10.9.8.1、.2、.3的三台redis服务器

.2和.3是.1的奴隶,并且复制正在工作。

redis服务用户对所有三台主机都具有0600 r/w访问redis.confsentinel.conf的权限。

对于Slave1和Slave2 (10.9.8.2和10.9.8.3),在redis.conf中添加了以下内容:

代码语言:javascript
复制
+ slaveof 127.0.0.1 6380

对于硕士、Slave1和Slave2:

sentinel.conf

代码语言:javascript
复制
sentinel monitor mymaster 10.9.8.1 6379 2
sentinel down-after-milliseconds mymaster 60000
sentinel failover-timeout mymaster 180000
sentinel parallel-syncs mymaster 1

主服务器在服务启动时的输出:

代码语言:javascript
复制
root@poolwc:/etc/redis# systemctl start redis-sentinel
Job for redis-sentinel.service failed because the control process exited with error code. See "systemctl status redis-sentinel.service" and "journalctl -xe" for details.

    root@poolwc:/etc/redis# systemctl status redis-sentinel.service
    ● redis-sentinel.service - Advanced key-value store
       Loaded: loaded (/lib/systemd/system/redis-sentinel.service; enabled; vendor preset: enabled)
       Active: inactive (dead) (Result: exit-code) since Mon 2018-02-26 21:54:12 

PST;6s前的Docs:http://redis.io/documentation,man:redis-sentinel(1)进程: 5376 ExecStopPost=/bin/run-部件-详细/etc/redis/redis-postinel.d (code=exited,status=0/SUCCESS)进程: 7893 ExecStart=/usr/bin/redis-前哨/etc/redis/redis/Sentinel.conf (code=exited,status=1/FAILURE)进程: 7890 ExecStartPre=/bin/run/redis/resinel.up.d (code=exited,status=0/SUCCESS)

代码语言:javascript
复制
Feb 26 21:54:12 poolwc systemd[1]: redis-sentinel.service: Control process exited, code=exited status=1
Feb 26 21:54:12 poolwc systemd[1]: Failed to start Advanced key-value store.
Feb 26 21:54:12 poolwc systemd[1]: redis-sentinel.service: Unit entered failed state.
Feb 26 21:54:12 poolwc systemd[1]: redis-sentinel.service: Failed with result 'exit-code'.
Feb 26 21:54:12 poolwc systemd[1]: redis-sentinel.service: Service hold-off time over, scheduling restart.
Feb 26 21:54:12 poolwc systemd[1]: Stopped Advanced key-value store.
Feb 26 21:54:12 poolwc systemd[1]: redis-sentinel.service: Start request repeated too quickly.
Feb 26 21:54:12 poolwc systemd[1]: Failed to start Advanced key-value store.

从Slave2输出的服务开始运行,但为什么退出失败?:

代码语言:javascript
复制
[root@ns1 etc]# systemctl start redis-sentinel
[root@ns1 etc]# systemctl status redis-sentinel
● redis-sentinel.service - Redis Sentinel
   Loaded: loaded (/usr/lib/systemd/system/redis-sentinel.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/redis-sentinel.service.d
           └─limit.conf
   Active: active (running) since Mon 2018-02-26 21:55:58 PST; 5s ago
  Process: 12876 ExecStop=/usr/libexec/redis-shutdown redis-sentinel (code=exited, status=1/FAILURE)
 Main PID: 12944 (redis-sentinel)
   CGroup: /system.slice/redis-sentinel.service
           └─12944 /usr/bin/redis-sentinel *:26379 [sentinel]

Feb 26 21:55:58 ns1 redis-sentinel[12944]: |    `-._`-._        _.-'_.-'    |           http://redis.io
Feb 26 21:55:58 ns1 redis-sentinel[12944]: `-._    `-._`-.__.-'_.-'    _.-'
Feb 26 21:55:58 ns1 redis-sentinel[12944]: |`-._`-._    `-.__.-'    _.-'_.-'|
Feb 26 21:55:58 ns1 redis-sentinel[12944]: |    `-._`-._        _.-'_.-'    |
Feb 26 21:55:58 ns1 redis-sentinel[12944]: `-._    `-._`-.__.-'_.-'    _.-'
Feb 26 21:55:58 ns1 redis-sentinel[12944]: `-._    `-.__.-'    _.-'
Feb 26 21:55:58 ns1 redis-sentinel[12944]: `-._        _.-'
Feb 26 21:55:58 ns1 redis-sentinel[12944]: `-.__.-'
Feb 26 21:55:58 ns1 redis-sentinel[12944]: 12944:X 26 Feb 21:55:58.490 # Sentinel ID is 659761a6f8328e59d43086ef3265450fcec5d2f5
Feb 26 21:55:58 ns1 redis-sentinel[12944]: 12944:X 26 Feb 21:55:58.490 # +monitor master mymaster 10.9.8.1 6379 quorum 2

Slave2在服务启动时的输出:

代码语言:javascript
复制
root@poolec:/etc/redis# systemctl start redis-sentinel
Job for redis-sentinel.service failed because the control process exited with error code. See "systemctl status redis-sentinel.service" and "journalctl -xe" for details.
root@poolec:/etc/redis# systemctl status redis-sentinel

    ● redis-sentinel.service - Advanced key-value store
   Loaded: loaded (/lib/systemd/system/redis-sentinel.service; enabled; vendor preset: enabled)
   Active: inactive (dead) (Result: exit-code) since Tue 2018-02-27 05:57:09 UTC; 5s ago
     Docs: http://redis.io/documentation,
           man:redis-sentinel(1)
  Process: 4130 ExecStart=/usr/bin/redis-sentinel /etc/redis/sentinel.conf (code=exited, status=1/FAILURE)
  Process: 4127 ExecStartPre=/bin/run-parts --verbose /etc/redis/redis-sentinel.pre-up.d (code=exited, status=0/SUCCESS)

Feb 27 05:57:09 poolec systemd[1]: redis-sentinel.service: Unit entered failed state.
Feb 27 05:57:09 poolec systemd[1]: redis-sentinel.service: Failed with result 'exit-code'.
Feb 27 05:57:09 poolec systemd[1]: redis-sentinel.service: Service hold-off time over, scheduling restart.
Feb 27 05:57:09 poolec systemd[1]: Stopped Advanced key-value store.
Feb 27 05:57:09 poolec systemd[1]: redis-sentinel.service: Start request repeated too quickly.
Feb 27 05:57:09 poolec systemd[1]: Failed to start Advanced key-value store.

其中没有一个在/var/log/redis/中留下任何输出

有什么想法吗?

非常感谢!

EN

回答 1

Server Fault用户

发布于 2019-07-26 08:11:25

似乎是通过以下方法解决的,请在这里找到:Redis不是以systemctl开头的

请参阅配置文件:

如果您从upstart或systemd运行Redis,Redis可以与您的监督树交互。选项:监督不-无监督互动,监督新启动-信号启动通过将Redis放入SIGSTOP模式,监督系统-信号系统通过编写READY=1到$NOTIFY_SOCKET监督自动检测新启动或基于UPSTART_JOB或NOTIFY_SOCKET环境变量的系统方法注意:这些监督方法只有信号“准备好了”。它们不能使你的上司连续地保持活力。

代码语言:javascript
复制
supervised no

需要改为:

代码语言:javascript
复制
supervised systemd

您还可以在命令行上传递此命令,该命令行将重写redis.conf中的设置。基于红帽的系统可以做到这一点。这还允许手动或从systemd运行相同的redis实例,而无需更改配置文件。

ExecStart=/usr/bin/ redis -server /etc/redis.conf -监督的系统d此外,还需要通过在Type=notify部分中设置服务来告诉systemd,redis将在此模式下运行。

票数 2
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/899044

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档