centos7没有redis-cli shutdown
时间: 2024-04-27 16:17:43 浏览: 25
在CentOS 7下,默认情况下,Redis服务器是以守护进程的方式运行的,无法通过`redis-cli shutdown`命令来关闭。但是,你可以使用以下命令来关闭Redis服务器:
```shell
sudo systemctl stop redis
```
这会停止Redis服务器的运行。如果你希望在系统启动时自动启动Redis服务器,可以使用以下命令:
```shell
sudo systemctl enable redis
```
这样,Redis服务器将在系统启动时自动启动。
相关问题
centos7安装redis
好的,下面是在 CentOS 7 上安装 Redis 的步骤:
1. 更新系统软件包:
```
sudo yum update
```
2. 安装 GCC 和基本开发工具:
```
sudo yum install gcc make
```
3. 下载 Redis 源代码:
```
curl -O http://download.redis.io/releases/redis-6.0.9.tar.gz
tar xzvf redis-6.0.9.tar.gz
cd redis-6.0.9
```
4. 编译并安装 Redis:
```
make
sudo make install
```
5. 创建 Redis 配置文件目录:
```
sudo mkdir /etc/redis
sudo cp redis.conf /etc/redis
```
6. 创建 Redis 启动脚本:
```
sudo vi /etc/systemd/system/redis.service
```
并将以下内容添加到该文件中:
```
[Unit]
Description=Redis In-Memory Data Store
After=network.target
[Service]
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always
[Install]
WantedBy=multi-user.target
```
7. 启动 Redis 服务:
```
sudo systemctl start redis
sudo systemctl enable redis
```
8. 测试 Redis 运行状态:
```
redis-cli ping
```
如果 Redis 安装成功,该命令将返回 `PONG`。
希望这些信息对你有所帮助!
centos7启动redis
你可以按照以下步骤启动Redis:
1. 打开终端,进入Redis安装目录。
2. 输入以下命令启动Redis服务:
```
redis-server
```
3. 如果你想在后台运行Redis,则可以使用以下命令:
```
redis-server --daemonize yes
```
4. 接着,你可以使用以下命令检查Redis是否正在运行:
```
redis-cli ping
```
如果Redis正在运行,它将返回“PONG”作为响应。
5. 如果你想停止Redis服务,可以使用以下命令:
```
redis-cli shutdown
```
或者,你可以使用以下命令杀死Redis进程:
```
pkill redis
```
希望这个回答能够帮到你!
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)