Skip to content

Commit a420df6

Browse files
committed
update docs
1 parent de02a6e commit a420df6

12 files changed

Lines changed: 365 additions & 215 deletions

File tree

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@
2121
- [Mysql 维护](docs/sql/mysql/mysql-ops.md)
2222
- [Mysql 原理](docs/sql/mysql/mysql-theory.md)
2323
- :four: [Redis](docs/nosql/redis/README.md)
24-
- [Redis 快速入门](docs/nosql/redis/redis-quickstart.md)
24+
- [Redis 快速入门](docs/nosql/redis/redis.md)
25+
- [Redis 数据类型](docs/nosql/redis/redis-data-type.md)
26+
- [Redis 复制](docs/nosql/redis/redis-replication.md)
27+
- [Redis 哨兵](docs/nosql/redis/redis-sentinel.md)
28+
- [Redis 集群](docs/nosql/redis/redis-cluster.md)
2529

2630
## :door: 传送门
2731

assets/eddx/redis.eddx

41.4 KB
Binary file not shown.

docs/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,12 @@
2121
- [Mysql 维护](sql/mysql/mysql-ops.md)
2222
- [Mysql 原理](sql/mysql/mysql-theory.md)
2323
- :four: Redis
24-
- [Redis 快速入门](nosql/redis/redis-quickstart.md)
25-
- [Redis 复制](nosql/redis/Redis复制.md)
26-
- [Redis 哨兵](nosql/redis/Redis哨兵.md)
24+
- [Redis 入门指南](nosql/redis/redis.md)
25+
- [Redis 数据类型](nosql/redis/redis-data-type.md)
26+
- [Redis 复制](nosql/redis/redis-replication.md)
27+
- [Redis 哨兵](nosql/redis/redis-sentinel.md)
28+
- [Redis 集群](nosql/redis/redis-cluster.md)
29+
- [Redis 运维](nosql/redis/redis-ops.md)
2730

2831
## 传送门
2932

docs/nosql/redis/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Redis
22

3-
- [Redis 复制](Redis复制.md)
3+
- [Redis 复制](redis-replication.md)
44

55
## 命令行
66

docs/nosql/redis/redis-cluster.md

Lines changed: 265 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
---
2-
title: Redis 数据类型
3-
date: 2018-06-09
4-
categories:
5-
- database
6-
tags:
7-
- database
8-
- nosql
9-
---
10-
111
# Redis 数据类型
122

133
<!-- TOC depthFrom:2 depthTo:3 -->
@@ -241,3 +231,7 @@ OK
241231
3) "mongodb"
242232
4) "2"
243233
```
234+
235+
## 参考资料
236+
237+
《Redis 设计与实现》

docs/nosql/redis/redis-ops.md

Lines changed: 82 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,86 @@
33
<!-- TOC depthFrom:2 depthTo:3 -->
44

55
- [安装](#安装)
6-
- [启动](#启动)
6+
- [Window 下安装](#window-下安装)
7+
- [Linux 下安装](#linux-下安装)
8+
- [Ubuntu 下安装](#ubuntu-下安装)
9+
- [启动 Redis](#启动-redis)
10+
- [查看 redis 是否启动?](#查看-redis-是否启动)
711
- [脚本](#脚本)
812

913
<!-- /TOC -->
1014

1115
## 安装
1216

13-
安装步骤如下:
17+
### Window 下安装
1418

15-
(1)下载并解压到本地
19+
**下载地址:**<https://github.com/MSOpenTech/redis/releases>
1620

17-
进入官网下载地址:https://redis.io/download ,选择合适的版本下载
21+
Redis 支持 32 位和 64 位。这个需要根据你系统平台的实际情况选择,这里我们下载 **Redis-x64-xxx.zip**压缩包到 C 盘,解压后,将文件夹重新命名为 **redis**
1822

19-
我选择的是最新稳定版本 4.0.8:http://download.redis.io/releases/redis-4.0.8.tar.gz
23+
打开一个 **cmd** 窗口 使用 cd 命令切换目录到 **C:\redis** 运行 **redis-server.exe redis.windows.conf**
2024

21-
我个人喜欢存放在:`/opt/redis`
25+
如果想方便的话,可以把 redis 的路径加到系统的环境变量里,这样就省得再输路径了,后面的那个 redis.windows.conf 可以省略,如果省略,会启用默认的。输入之后,会显示如下界面:
2226

27+
这时候另启一个 cmd 窗口,原来的不要关闭,不然就无法访问服务端了。
28+
29+
切换到 redis 目录下运行 **redis-cli.exe -h 127.0.0.1 -p 6379**
30+
31+
设置键值对 **set myKey abc**
32+
33+
取出键值对 **get myKey**
34+
35+
### Linux 下安装
36+
37+
**下载地址:** http://redis.io/download,下载最新文档版本。
38+
39+
本教程使用的最新文档版本为 2.8.17,下载并安装:
40+
41+
```
42+
$ wget -O /opt/redis/redis-4.0.8.tar.gz http://download.redis.io/releases/redis-4.0.8.tar.gz
43+
$ cd /opt/redis
44+
$ tar zxvf redis-4.0.8.tar.gz
45+
```
46+
47+
make 完后 redis-2.8.17 目录下会出现编译后的 redis 服务程序 redis-server,还有用于测试的客户端程序 redis-cli,两个程序位于安装目录 src 目录下:
48+
49+
下面启动 redis 服务.
50+
51+
```
52+
$ cd src
53+
$ ./redis-server
54+
```
55+
56+
注意这种方式启动 redis 使用的是默认配置。也可以通过启动参数告诉 redis 使用指定配置文件使用下面命令启动。
57+
58+
```
59+
$ cd src
60+
$ ./redis-server redis.conf
2361
```
24-
wget -O /opt/redis/redis-4.0.8.tar.gz http://download.redis.io/releases/redis-4.0.8.tar.gz
25-
cd /opt/redis
26-
tar zxvf redis-4.0.8.tar.gz
62+
63+
redis.conf 是一个默认的配置文件。我们可以根据需要使用自己的配置文件。
64+
65+
启动 redis 服务进程后,就可以使用测试客户端程序 redis-cli 和 redis 服务交互了。 比如:
66+
67+
```
68+
$ cd src
69+
$ ./redis-cli
70+
redis> set foo bar
71+
OK
72+
redis> get foo
73+
"bar"
2774
```
2875

29-
(2)编译安装
76+
### Ubuntu 下安装
3077

31-
执行以下命令:
78+
在 Ubuntu 系统安装 Redi 可以使用以下命令:
3279

3380
```
34-
cd /opt/redis/redis-4.0.8
35-
make
81+
$sudo apt-get update
82+
$sudo apt-get install redis-server
3683
```
3784

38-
## 启动
85+
### 启动 Redis
3986

4087
**启动 redis 服务**
4188

@@ -51,6 +98,27 @@ cd /opt/redis/redis-4.0.8/src
5198
./redis-cli
5299
```
53100

101+
### 查看 redis 是否启动?
102+
103+
```
104+
$ redis-cli
105+
```
106+
107+
以上命令将打开以下终端:
108+
109+
```
110+
redis 127.0.0.1:6379>
111+
```
112+
113+
127.0.0.1 是本机 IP ,6379 是 redis 服务端口。现在我们输入 PING 命令。
114+
115+
```
116+
redis 127.0.0.1:6379> ping
117+
PONG
118+
```
119+
120+
以上说明我们已经成功安装了 redis。
121+
54122
## 脚本
55123

56124
以上两种安装方式,我都写了脚本去执行:

docs/nosql/redis/redis-quickstart.md

Lines changed: 0 additions & 173 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)