You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.3 KiB
70 lines
1.3 KiB
3 years ago
|
# 安装卸载
|
||
|
|
||
|
## 使用源码
|
||
|
|
||
|
- 下载
|
||
|
|
||
|
[官方源码](http://redis.io/download)
|
||
|
|
||
|
```shell
|
||
|
wget http://download.redis.io/releases/redis-6.0.8.tar.gz
|
||
|
```
|
||
|
|
||
|
下载后需解压
|
||
|
|
||
|
- 安装
|
||
|
|
||
|
```shell
|
||
|
tar xzf redis-6.0.8.tar.gz
|
||
|
cd redis-6.0.8
|
||
|
make
|
||
|
```
|
||
|
|
||
|
- 配置
|
||
|
|
||
|
默认配置文件为解压目录下`redis.conf`
|
||
|
|
||
|
| 配置项 | 作用 | 默认 |
|
||
|
| -------------- | --------------------- | --------- |
|
||
|
| daemonize | 是否后台运行redis服务 | no |
|
||
|
| requirepass | redis认证密码 | 无 |
|
||
|
| protected-mode | 是否开启远程保护 | yes |
|
||
|
| bind | 绑定访问地址 | 127.0.0.1 |
|
||
|
|
||
|
- 启动
|
||
|
|
||
|
在`src`目录下的r`edis-server`和`redis-cli`两个可执行文件,直接执行就可以启动`redis`服务或客户端
|
||
|
|
||
|
建议将这两个文件拷贝到`/sbin`目录下,并将`nginx.conf`拷贝到/etc目录下
|
||
|
|
||
|
方便在任意目录执行`redis-server /etc/redis.conf`启动服务
|
||
|
|
||
|
- 链接
|
||
|
|
||
|
`redis-cli` 链接
|
||
|
|
||
|
`auth $password` 进行密码验证
|
||
|
|
||
|
## 使用docker
|
||
|
|
||
|
- 安装**docker**
|
||
|
|
||
|
- 下载镜像
|
||
|
|
||
|
```shell
|
||
|
docker pull redis:latest
|
||
|
```
|
||
|
|
||
|
- 创建并运行容器
|
||
|
|
||
|
```shell
|
||
|
docker run -d --name redis -p 6379:6379 redis:latest
|
||
|
```
|
||
|
|
||
|
- 启动与停止容器
|
||
|
|
||
|
- 卸载
|
||
|
|
||
|
删除容器与镜像
|
||
|
|