Timetombs

泛义的工具是文明的基础,而确指的工具却是愚人的器物

66h / 118a
,更新于 2024-11-10T12:35:26Z+08:00 by   330589a

[Redis] install

版权声明 - CC BY-NC-SA 4.0

1 源码安装

适用于Linux和macOS1

下载地址:https://download.redis.io/releases/redis-6.2.1.tar.gz

wget https://download.redis.io/releases/redis-6.2.1.tar.gz
tar xzf redis-6.2.1.tar.gz
cd redis-6.2.1
make

编译完成后的二进制文件(redis-server,redis-cli等等)位于src目录中。

2 docker安装

https://hub.docker.com/_/redis

docker run --name redis -d redis:6.2
# https://hub.docker.com/_/redis/
# https://github.com/docker-library/redis/blob/master/6.2/Dockerfile
FROM redis:6.2

EXPOSE 6379

3 本地运行

bind 127.0.0.1
port 6379

# RDB
save 300 10
stop-writes-on-bgsave-error yes
dir /lnh/_data/_redis/
dbfilename dump.rdb
rdbcompression yes
rdbchecksum no
rdb-del-sync-files no


# AOF
appendonly yes
appendfsync everysec
appendfilename appendonly.aof
auto-aof-rewrite-min-size 64mb
auto-aof-rewrite-percentage 100
no-appendfsync-on-rewrite yes
aof-load-truncated yes
aof-use-rdb-preamble yes

3.1 运行服务端

$ redis-server
5177:C 19 Mar 2021 04:08:38.090 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
5177:C 19 Mar 2021 04:08:38.090 # Redis version=6.2.1, bits=64, commit=00000000, modified=0, pid=5177, just started
5177:C 19 Mar 2021 04:08:38.090 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
5177:M 19 Mar 2021 04:08:38.091 * monotonic clock: POSIX clock_gettime
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 6.2.1 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 5177
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

5177:M 19 Mar 2021 04:08:38.095 # Server initialized
5177:M 19 Mar 2021 04:08:38.096 * Ready to accept connections

3.2 运行客户端

使用redis-cli简单测试一下设置和获取一个名为test的string类型的缓存。

$ redis-cli
127.0.0.1:6379> set test Timetombs
OK
127.0.0.1:6379> get test
"Timetombs"
127.0.0.1:6379> 

4 online运行

http://try.redis.io

5 参考

https://redis.io/download

下一篇 : [Redis] resp