- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在尝试将 redis 添加到我的 CentOS 虚拟机的启动中,但 chkconfig 似乎没有添加它。我对其他几个初始化脚本执行了相同的过程,并且它们添加得很好。任何帮助告诉我我做错了什么都会很棒。我查看了手册页并进行了谷歌搜索,但每件事都说要添加我已经拥有的 header 值。我为 hornetq init 脚本和 smpp 模拟器脚本编写了相同的 case 语句,并简单地更改了 do_start 和 do_stop 函数的内容以完成它们各自的工作。
我正在运行以下命令来添加初始化脚本:
chkconfig --add /etc/init.d/redis
然后我检查列表:
chkconfig --list
结果是:
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.
hornetq 0:off 1:off 2:off 3:on 4:on 5:on 6:off
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
smppsim 0:off 1:off 2:off 3:on 4:on 5:on 6:off
我写的脚本是这样的:
#!/bin/sh
#
# startup script for running redis as a service.
#
# chkconfig: 350 95 15
# description: redis startup script
do_start(){
systemctl start redis.service
}
do_stop(){
systemctl stop redis.service
}
do_status(){
systemctl status redis.service
}
case "$1" in
'start')
do_start
do_status
;;
'stop')
do_stop
do_status
;;
'status')
do_status
;;
'restart')
do_stop
do_start
;;
*)
echo "usage: $0 start|stop|status|restart"
esac
*****编辑******
仅供引用,运行“service redis start”就可以了
最佳答案
命令是 chkconfig --add [name]
而不是 chkconfig --add [path]
所以你需要 chkconfig --add redis
。
在 systemd 系统上,你甚至不应该为 init.d 服务脚本烦恼,因为你不需要它。
“遗留”service
命令已更新以正常处理启动 systemd 服务,因此您可能/可能甚至没有使用您的脚本(如果您是因为您的脚本只是转发到 systemctl
,您不需要它,因为我说过,service
命令已经为您完成了)。
要模拟在启动时启动服务的 chkconfig
功能,您需要使用 systemctl enable <service>
。
关于linux - chkconfig 不添加 redis 初始化脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31094002/
我有一个关于 Redis Pubsub 的练习,如下所示: 如果发布者发布消息但订阅者没有收到服务器崩溃。订阅者如何在重启服务器时收到该消息? 请帮帮我,谢谢! 最佳答案 在这种情况下,消息将永远消失
我们正在使用 Service Stack 的 RedisClient 的 BlockingDequeue 来保存一些数据,直到它可以被处理。调用代码看起来像 using (var client =
我有一个 Redis 服务器和多个 Redis 客户端。每个 Redis 客户端都是一个 WebSocket+HTTP 服务器,其中包括管理 WebSocket 连接。这些 WebSocket+HTT
我有多个 Redis 实例。我使用不同的端口创建了一个集群。现在我想将数据从预先存在的 redis 实例传输到集群。我知道如何将数据从一个实例传输到集群,但是当实例多于一个时,我无法做到这一点。 最佳
配置:三个redis集群分区,跨三组一主一从。当 Master 宕机时,Lettuce 会立即检测到中断并开始重试。但是,Lettuce 没有检测到关联的 slave 已经将自己提升为 master
我想根据从指定集合中检索这些键来删除 Redis 键(及其数据集),例如: HMSET id:1 password 123 category milk HMSET id:2 password 456
我正在编写一个机器人(其中包含要禁用的命令列表),用于监视 Redis。它通过执行禁用命令,例如 (rename-command ZADD "")当我重新启动我的机器人时,如果要禁用的命令列表发生变化
我的任务是为大量听众使用发布/订阅。这是来自 docs 的订阅的简化示例: r = redis.StrictRedis(...) p = r.pubsub() p.subscribe('my-firs
我一直在阅读有关使用 Redis 哨兵进行故障转移的内容。我打算有1个master+1个slave,如果master宕机超过1分钟,就把slave变成master。我知道这在 Sentinel 中是
与仅使用常规 Redis 和创建分片相比,使用 Redis 集群有哪些优势? 在我看来,Redis Cluster 更注重数据安全(让主从架构解决故障)。 最佳答案 我认为当您需要在不丢失任何数据的情
由于 Redis 以被动和主动方式使 key 过期, 有没有办法得到一个 key ,即使它的过期时间已过 (但 在 Redis 中仍然存在 )? 最佳答案 DEBUG OBJECT myKey 将返回
我想用redis lua来实现monitor命令,而不是redis-cli monitor。但我不知道怎么办。 redis.call('monitor') 不起作用。 最佳答案 您不能从 Redis
我读过 https://github.com/redisson/redisson 我发现有几个 Redis 复制设置(包括对 AWS ElastiCache 和 Azure Redis 缓存的支持)
Microsoft.AspNet.SignalR.Redis 和 StackExchange.Redis.Extensions.Core 在同一个项目中使用。前者需要StackExchange.Red
1. 认识 Redis Redis(Remote Dictionary Server)远程词典服务器,是一个基于内存的键值对型 NoSQL 数据库。 特征: 键值(key-value)型,value
1. Redis 数据结构介绍 Redis 是一个 key-value 的数据库,key 一般是 String 类型,但 value 类型多种多样,下面就举了几个例子: value 类型 示例 Str
1. 什么是缓存 缓存(Cache) 就是数据交换的缓冲区,是存贮数据的临时地方,一般读写性能较高。 缓存的作用: 降低后端负载 提高读写效率,降低响应时间 缓存的成本: 数据一致性成本 代码维护成本
我有一份记录 list 。对于我的每条记录,我都需要进行一些繁重的计算,因为我要在Redis中创建反向索引。为了达到到达记录,需要在管道中执行多个redis命令(sadd为100 s + set为1
我有一个三节点Redis和3节点哨兵,一切正常,所有主服务器和从属服务器都经过验证,并且哨兵配置文件已与所有Redis和哨兵节点一起更新,但是问题是当Redis主服务器关闭并且哨兵希望选举失败者时再次
我正在尝试计算Redis中存储的消息之间的响应时间。但是我不知道该怎么做。 首先,我必须像这样存储chat_messages的时间流 ZADD conversation:CONVERSATION_ID
我是一名优秀的程序员,十分优秀!