1 安装

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
var_base=/root/helm
var_app=$var_base/redis
var_version=17.11.3

mkdir -p $var_app
cd $var_app

helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
helm pull bitnami/redis --version $var_version
tar xf redis-$var_version.tgz

helm upgrade --install --dry-run --debug \
  --namespace=middleware \
  --create-namespace \
  --set global.storageClass=rook-cephfs \
  --set global.redis.password='bo9qvLfV^2egR9FhD' \
  --set architecture=standalone \
  --set auth.enabled=true \
  --set image.registry='harbor.example.com' \
  --set image.repository='library/redis' \
  --set image.tag='7.0.11' \
  redis ./redis

helm upgrade --install \
  --namespace=middleware \
  --create-namespace \
  --set global.storageClass=rook-cephfs \
  --set global.redis.password='bo9qvLfV^2egR9FhD' \
  --set architecture=standalone \
  --set auth.enabled=true \
  --set image.registry='harbor.example.com' \
  --set image.repository='library/redis' \
  --set image.tag='7.0.11' \
  redis ./redis

kubectl port-forward --namespace middleware svc/redis-master 6379:6379
kubectl exec -it --namespace middleware redis-master-0 -- /bin/bash

2 docker安装

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
docker volume create --driver local redis-data

cat <<EOF | tee redis.conf
dir /data
rename-command FLUSHDB ""
rename-command FLUSHALL ""
appendonly yes
save ""
requirepass password
EOF

docker run -d --name redis \
-p 6379:6379 \
-e TZ=Asia/Shanghai \
-v redis-data:/data \
-v ~/Codes/docker/redis/redis.conf:/usr/local/etc/redis.conf \
redis:7.2.3 \
--loglevel warning

docker exec -it redis redis-cli -h localhost -a password ping