11.10
This commit is contained in:
1 parent
aeaaf2aef5
commit
239c367309
2 files changed
+50
No files matched your search
@@ -0,0 +1,50 @@
|
|||||||
|
---
|
||||||
|
title: "windows系统自启redis服务"
|
||||||
|
date: "2024-11-10T10:09:16+08:00"
|
||||||
|
slug: "20241110-strat-redis"
|
||||||
|
draft: false
|
||||||
|
categories: []
|
||||||
|
tags: []
|
||||||
|
author: "小赵同学"
|
||||||
|
layout: "post"
|
||||||
|
status: "hidden"
|
||||||
|
categories: ["笔记"]
|
||||||
|
tags: []
|
||||||
|
---
|
||||||
|
|
||||||
|
最近在学习redis,每次都需要手动启动redis,很麻烦
|
||||||
|
|
||||||
|
于是看了一下windows的bat脚本语法,照葫芦画瓢弄了个redis-start脚本
|
||||||
|
|
||||||
|
此文章主要记录备忘
|
||||||
|
|
||||||
|
## 基本概述
|
||||||
|
|
||||||
|
切换到E盘下的redis目录,启动redis-server.exe服务,并指定配置文件 redis.windows.conf
|
||||||
|
|
||||||
|
```
|
||||||
|
@echo off
|
||||||
|
cd /d E:\Redis
|
||||||
|
redis-server.exe redis.windows.conf
|
||||||
|
pause
|
||||||
|
```
|
||||||
|
|
||||||
|
## 解释:
|
||||||
|
|
||||||
|
1. `@echo off`:禁用命令回显,确保命令输出更干净。
|
||||||
|
2. `cd /d E:\Redis`:切换到 `E:\Redis` 目录。`/d` 用于切换驱动器(如果你当前在其他驱动器上)。
|
||||||
|
3. `redis-server.exe redis.windows.conf`:执行 Redis 服务器并加载指定的配置文件。
|
||||||
|
4. `pause`:命令执行后暂停,保持窗口打开,这样你可以看到任何错误消息或日志输出。
|
||||||
|
|
||||||
|
## 使用方法:
|
||||||
|
|
||||||
|
1. 将上面的代码保存为 `start_redis.bat` 文件。
|
||||||
|
2. 双击 `start_redis.bat` 即可启动 Redis 服务
|
||||||
|
|
||||||
|
## 开机自启方法
|
||||||
|
|
||||||
|
windows系统键盘快捷键输入win+r输入`shell:startup`
|
||||||
|
|
||||||
|
将bat脚本放进该目录即可
|
||||||
|
|
||||||
|

|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
Reference in new issue
Block a user