Automation Suite
2023.10
False
横幅背景图像
Linux 版 Automation Suite 安装指南
上次更新日期 2024年4月19日

如何清除 Redis 数据

要清除 Redis 中存储的所有数据并将其重置为空状态,请执行以下步骤:

  1. 识别密钥名称、密码和端口:

    export KUBECONFIG="/etc/rancher/rke2/rke2.yaml"; export PATH=$PATH:/var/lib/rancher/rke2/bin;
    secretName=$(kubectl get redb redis-cluster-db -o jsonpath="{.spec.databaseSecretName}" -n redis-system)
    password=$(kubectl get secret $secretName -o jsonpath="{.data.password}" -n redis-system | base64 --decode)
    port=$(kubectl get secret $secretName -o jsonpath="{.data.port}" -n redis-system | base64 --decode)export KUBECONFIG="/etc/rancher/rke2/rke2.yaml"; export PATH=$PATH:/var/lib/rancher/rke2/bin;
    secretName=$(kubectl get redb redis-cluster-db -o jsonpath="{.spec.databaseSecretName}" -n redis-system)
    password=$(kubectl get secret $secretName -o jsonpath="{.data.password}" -n redis-system | base64 --decode)
    port=$(kubectl get secret $secretName -o jsonpath="{.data.port}" -n redis-system | base64 --decode)
  2. 识别服务名称:

    kubectl get secret $secretName -o jsonpath="{.data.service_names}" -n redis-system | base64 --decodekubectl get secret $secretName -o jsonpath="{.data.service_names}" -n redis-system | base64 --decode
  3. 假设上一个命令的输出是:redis-cluster-db, redis-cluster-db-headless。您必须调用以下 FLUSHALL 命令:
    kubectl exec -ti -n redis-system redis-cluster-0 -- redis-cli -h redis-cluster-db -p $port -a $password FLUSHALL
    
    kubectl exec -ti -n redis-system redis-cluster-0 -- redis-cli -h redis-cluster-db-headless -p $port -a $password FLUSHALLkubectl exec -ti -n redis-system redis-cluster-0 -- redis-cli -h redis-cluster-db -p $port -a $password FLUSHALL
    
    kubectl exec -ti -n redis-system redis-cluster-0 -- redis-cli -h redis-cluster-db-headless -p $port -a $password FLUSHALL

此页面是否有帮助?

获取您需要的帮助
了解 RPA - 自动化课程
UiPath Community 论坛
Uipath 白色徽标
信任与安全
© 2005-2024 UiPath. All rights reserved.