如何找到linux centos7 中 redis.conf

本文介绍了一种找到Redis配置文件redis.conf的有效方法。通过检查系统服务状态和初始化脚本,可以发现配置文件的具体路径,避免了使用find命令或依赖包管理器查找的无效尝试。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  我们假设redis正在运行,但是我们找不带redis的配置文件redis.conf.

正确的示范:

(1)systemctl status redis

● redis.service - LSB: starts Redis
Loaded: loaded (/etc/rc.d/init.d/redis; bad; vendor preset: disabled)
Active: inactive (dead)
Docs: man:systemd-sysv-generator(8)

  由此处可见,redis在/etc/rc.d/init.d/redis

 

 

 

(2)cat /etc/rc.d/init.d/redis

#!/bin/sh
# chkconfig: 2345 56 26
# description: Redis Service

### BEGIN INIT INFO
# Provides: Redis
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts Redis
# Description: starts the BT-Web
### END INIT INFO

# Simple Redis init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem.

CONF="/www/server/redis/redis.conf"
REDISPORT=$(cat $CONF |grep port|grep -v '#'|awk '{print $2}')
REDISPASS=$(cat $CONF |grep requirepass|grep -v '#'|awk '{print $2}')
if [ "$REDISPASS" != "" ];then
REDISPASS=" -a $REDISPASS"
fi
if [ -f /www/server/redis/start.pl ];then
STARPORT=$(cat /www/server/redis/start.pl)
else
STARPORT=6379
fi
EXEC=/www/server/redis/src/redis-server
CLIEXEC="/www/server/redis/src/redis-cli -p $STARPORT$REDISPASS"
PIDFILE=/var/run/redis_6379.pid

.. ... (后续内容省略)

  由此可见 redis.conf 在这儿 CONF="/www/server/redis/redis.conf"

 

 

 

 

错误的示范

(1)find / redis.conf  (找不到)

(2)find / 6379.conf (某位网友的建议,然而没卵用)

(3)rpm -ql redis (也不行)

 

转载于:https://www.cnblogs.com/chenyansu/p/11106967.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值