Redis:修订间差异
来自康健生活
| (未显示同一用户的9个中间版本) | |||
| 第1行: | 第1行: | ||
== Redis == | == Redis == | ||
=== docker === | |||
查看可用版本 | |||
{{Shc_out|<syntaxhighlight lang="bash"> | |||
sudo docker search redis | |||
</syntaxhighlight>|<syntaxhighlight lang="bash">INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED | |||
docker.io docker.io/redis Redis is an open source key-value store th... 11498 [OK] | |||
docker.io docker.io/bitnami/redis Bitnami Redis Docker Image 231 [OK] | |||
docker.io docker.io/bitnami/redis-sentinel Bitnami Docker Image for Redis Sentinel 40 [OK] | |||
docker.io docker.io/bitnami/redis-cluster 35 | |||
docker.io docker.io/redis/redis-stack redis-stack installs a Redis server with a... 20 | |||
docker.io docker.io/rapidfort/redis RapidFort optimized, hardened image for Re... 15 | |||
docker.io docker.io/rapidfort/redis-cluster RapidFort optimized, hardened image for Re... 15 | |||
docker.io docker.io/ubuntu/redis Redis, an open source key-value store. Lon... 15 | |||
docker.io docker.io/circleci/redis CircleCI images for Redis 14 [OK] | |||
docker.io docker.io/bitnami/redis-exporter 11 | |||
docker.io docker.io/redis/redis-stack-server redis-stack-server installs a Redis server... 11 | |||
docker.io docker.io/clearlinux/redis Redis key-value data structure server with... 4 | |||
docker.io docker.io/bitnami/redis-sentinel-exporter 1 | |||
docker.io docker.io/ibmcom/ibm-cloud-databases-redis-operator Container image for the IBM Operator for R... 1 | |||
docker.io docker.io/ibmcom/redis-ha 1 | |||
docker.io docker.io/blackflysolutions/redis Redis container for Drupal and CiviCRM 0 | |||
docker.io docker.io/cimg/redis 0 | |||
docker.io docker.io/corpusops/redis https://github.com/corpusops/docker-images/ 0 | |||
docker.io docker.io/drud/redis redis 0 [OK] | |||
docker.io docker.io/greenbone/redis-server A redis service container image for the Gr... 0 | |||
docker.io docker.io/ibmcom/redis-ppc64le 0 | |||
docker.io docker.io/ibmcom/redisearch-ppc64le 0 | |||
docker.io docker.io/rancher/redislabs-ssl 0 | |||
docker.io docker.io/rapidfort/redis6-ib RapidFort optimized, hardened image for Re... 0 | |||
docker.io docker.io/vmware/redis-photon 0 | |||
</syntaxhighlight>|$|/home/kangkk}} | |||
拉取镜像 | |||
{{Shc_out|<syntaxhighlight lang="bash"> | |||
sudo docker pull redis:latest</syntaxhighlight>|<syntaxhighlight lang="bash">Trying to pull repository docker.io/library/redis ... | |||
latest: Pulling from docker.io/library/redis | |||
bd159e379b3b: Pull complete | |||
729b630784ac: Pull complete | |||
065c77bf222a: Pull complete | |||
961784053f68: Pull complete | |||
b42f16846808: Pull complete | |||
0f1fa5bb0033: Pull complete | |||
Digest: sha256:c95835a74c37b3a784fb55f7b2c211bd20c650d5e55dae422c3caa9c01eb39fa | |||
Status: Downloaded newer image for docker.io/redis:latest | |||
</syntaxhighlight>|$|/home/kangkk}} | |||
运行镜像 | |||
{{Shc_out|<syntaxhighlight lang="bash"> | |||
sudo docker run -itd --name redis-latest -p 6379:6379 redis:latest --requirepass kangjian</syntaxhighlight>|<syntaxhighlight lang="bash"> | |||
bab071a1bc2f5d26a41b479acc79636db96a84009260ba6eaa85900da2cee48d | |||
</syntaxhighlight>|$|/home/kangkk}} | |||
== 配置 == | |||
=== 远程访问配置 === | === 远程访问配置 === | ||
修改 Redis 的配置文件 让其监听所有外网 IP。 | 修改 Redis 的配置文件 让其监听所有外网 IP。 | ||
| 第23行: | 第76行: | ||
{{shc|<syntaxhighlight lang="bash"> | {{shc|<syntaxhighlight lang="bash"> | ||
systemctl restart redis.service</syntaxhighlight>|#}} | systemctl restart redis.service</syntaxhighlight>|#}} | ||
== 模式 == | |||
=== 主从模式 === | |||
特点是主从数据的同步。 | |||
=== 集群模式 === | |||
=== 哨兵模式 === | |||
== Module == | |||
{| class="wikitable" | |||
|- | |||
! Module!! 标题文字 !! 标题文字 | |||
|- | |||
| redisml || 示例 || 示例 | |||
|- | |||
| redistimeseries || 示例 || 示例 | |||
|- | |||
| rediscell || 示例 || 示例 | |||
|- | |||
| redisbloom || 示例 || 示例 | |||
|- | |||
| redisjson || 示例 || 示例 | |||
|- | |||
| redisearch || 示例 || 示例 | |||
|- | |||
| neuralredis || 示例 || 示例 | |||
|} | |||
== 分布式锁 == | |||
互斥锁具有三个基本特性:<code>互斥</code>、<code>死锁释放</code>、<code>错误容忍</code>。 | |||
=== 红锁 === | |||
=== 参考 === | |||
* https://www.npmjs.com/package/redlock | |||
* https://www.npmjs.com/package/redlock-node | |||
== 文档 == | |||
* https://redis.io/commands/set/ | |||
== error == | |||
* setsockopt(SO_RCVTIMEO): Invalid argument | |||