页面“Django google authenticator”与“Redis批量删除key”之间的差异

来自linux中国网wiki
(页面间的差异)
跳到导航 跳到搜索
(导入1个版本)
 
 
第1行: 第1行:
=google-authenticator client=
+
[[category:ops]] [[category:redis]] 
  
==安装==
+
[[Redis-bigkeys]]
 +
=redis cluster 批量删除key=
 +
<pre>
 +
#June 19 2020  有空结果一下原来的版本再优化一下
 +
cat redis_del_key.sh
 +
#!/bin/bash
 +
# Usage
 +
#redis_list=("host:post" "host:post")
  
这个不用说啦  play 商店中 找 google 身份验证器.我的手机是android 7
+
redis_list=( "172.16.200.12:7003" "172.16.200.7:7004" "172.16.200.7:7005" "172.16.200.13:7000" "172.16.200.13:7001" "172.16.200.12:7002")
 +
#redis_list=( "172.16.200.13:7000" "172.16.200.13:7001" "172.16.200.12:7002")
 +
#redis_list=("172.16.200.7:7004")
 +
password="3636password"
  
 +
for info in ${redis_list[@]}
 +
    do
 +
        echo "开始执行:$info" 
 +
        ip=`echo $info | cut -d : -f 1`
 +
        port=`echo $info | cut -d : -f 2`
  
== config==
+
      for  loop in  `cat key.txt`
添加 ==> 输入提供的密钥  记得要保存好你的密钥哦
+
        do
 +
        #echo $loop  |xargs -t -n1 redis-cli -c  -h $ip -p $port -a $password -c del
 +
        echo $loop  |xargs -t -n1 redis-cli -c  -h $ip -p $port -a $password -c keys
 +
        done
  
 +
    done
 +
    echo "success done完成"
  
=google-authenticator server=
+
# cat key.txt
 +
infnce:wonderfulCache
 +
ext_info
  
=设想=
 
可以加个不回显示的验证码,哈哈 笑死
 
  
=参考=
 
  
[http://jungor.me/?p=547  最好的可以直接代码之Django + Google Authenticator]
+
#原来的版本
  
[https://medium.com/@jainsahil1997/simple-google-authentication-in-django-58101a34736b Simple Google Authentication in Django]
+
del hello_user_*
  
[https://zh.wikipedia.org/wiki/Google%E8%BA%AB%E4%BB%BD%E9%AA%8C%E8%AF%81%E5%99%A8 Google身份验证器]
+
redis-cli keys
  
https://pypi.python.org/pypi/django-google-authenticator
 
  
https://github.com/Bouke/django-two-factor-auth
+
redis-cli keys "hello_user_*" | xargs redis-cli del
  
  
 +
./redis-cli -h IP -p PORT -a PASSWORD keys 'key*' | xargs  ./redis-cli -h IP  -p PORT -a PASSWORD del
  
https://github.com/gnosis/django-google-authenticator
+
redis-cli    -c  -h    172.31.22.218  -p 7000  -a pass keys 'hello_user_*'| xargs -i redis-cli    -c  -h    172.31.22.218  -p 7000  -a pass  del {}
 +
redis-cli    -c  -h    172.31.22.218  -p 7001  -a pass keys 'hello_user_*'| xargs -i redis-cli    -c  -h    172.31.22.218  -p 7001  -a pass  del {}
  
 +
redis-cli    -c  -h    172.31.16.135  -p 7002  -a pass keys 'hello_user_*'| xargs -i  redis-cli    -c  -h    172.31.16.135  -p 7002 -a pass  del {}
 +
redis-cli    -c  -h    172.31.16.135  -p 7003  -a pass keys 'hello_user_*'| xargs  -i redis-cli    -c  -h    172.31.16.135  -p 7003 -a pass  del {}
  
 +
redis-cli    -c  -h    172.31.23.43  -p 7004  -a pass keys 'hello_user_*'| xargs -i  redis-cli    -c  -h    172.31.23.43  -p 7004 -a pass  del {}
 +
redis-cli    -c  -h    172.31.23.43  -p 7005  -a pass keys 'hello_user_*'| xargs -i  redis-cli    -c  -h    172.31.23.43  -p 7005 -a pass  del {}
  
  
[https://www.jianshu.com/p/6c751ddbbc7c 谷歌身份验证使用教程及失效详解]
 
  
[https://help.aliyun.com/document_detail/28669.html 安卓版Google Authenticator安装及使用指导]
+
#!/bin/bash
 +
redis_comm=/usr/local/redis-5.0.3/bin/redis-cli
 +
redis_ser01=192.168.50.175
 +
redis_ser02=192.168.50.174
 +
$redis_comm -c -h $redis_ser01  -p 7001 -a xxx  keys $1 | xargs -i $redis_comm -c -h $redis_ser01  -p 7001 -a xxx del {}
 +
$redis_comm -c -h $redis_ser02  -p 7001 -a xxx  keys $1 | xargs -i $redis_comm -c -h $redis_ser02  -p 7001 -a xxx del {}
  
[https://gadgets.ndtv.com/apps/features/google-authenticator-app-gmail-account-two-factor-security-1684339 How to Use Google Authenticator App to Secure Your Gmail Account ]
+
运行:
[https://www.jianshu.com/p/5806ff9c0cc5 在Django中定制身份验证]
 
  
[https://support.google.com/accounts/troubleshooter/4430955?hl=zh-Hans#ts=4430956 google使用新手机接收两步验证码]
+
./redis_del_key.sh  匹配的key*
  
[https://www.google.com/landing/2step/#tab=how-it-works 增强 Google 帐户的安全性]
+
err 
  
[https://www.howtoing.com/secure-ssh-with-google-authenticator-on-centos-7 CentOS 7上使用Google Authenticator双重身份验证保护SSH安全]
+
-i  {} 都是一定要的
  
[https://www.freehao123.com/two-factor-authentication/ WordPress和VPS利用Google Authenticator两步验证]
+
redis-cli -n 0 keys "test*" | xargs redis-cli -n 0 del
 +
(error) CROSSSLOT Keys in request don't hash to the same slot
  
[https://django-two-factor-auth.readthedocs.io/en/stable/index.html Django Two-Factor Authentication Documentation]
+
</pre>
  
[https://teakki.com/p/5929371e6e5c97852743d7e7 在Django中自定义身份验证]
+
=see also=
  
  
 +
[https://blog.csdn.net/yangyangye/article/details/100523387  redis集群批量删除模糊key shell脚本]
  
 +
[https://www.cnblogs.com/feng0520/p/11067025.html  redis cluster集群批量删除中的key]
  
== github上的GoogleAuthenticator ==
+
[https://my.oschina.net/u/1255588/blog/1563672 Redis集群批量删除key]
  
https://github.com/collective/collective.googleauthenticator
+
[https://blog.csdn.net/zj20142213/article/details/80879744  redis集群批量删除指定的key]
  
https://github.com/shinsaka/googleauthenticator_demo
+
https://blog.csdn.net/qq_36090419/article/details/80537684
 
 
https://github.com/cqf539/GoogleAuthenticator
 
 
 
https://github.com/gnosis/django-google-authenticator
 
 
 
==google 验证 ==
 
 
 
[http://www.williamlong.info/archives/2754.html Google两步验证安装使用方法]
 
 
 
[https://www.zhihu.com/question/20462696 谷歌验证 (Google Authenticator) 的实现原理]
 
 
 
[[category:django]]
 

2020年6月22日 (一) 11:37的版本


Redis-bigkeys

redis cluster 批量删除key

#June 19 2020   有空结果一下原来的版本再优化一下 
cat redis_del_key.sh
#!/bin/bash
# Usage 
#redis_list=("host:post" "host:post")

redis_list=( "172.16.200.12:7003" "172.16.200.7:7004" "172.16.200.7:7005" "172.16.200.13:7000" "172.16.200.13:7001" "172.16.200.12:7002")
#redis_list=( "172.16.200.13:7000" "172.16.200.13:7001" "172.16.200.12:7002")
#redis_list=("172.16.200.7:7004")
password="3636password"

for info in ${redis_list[@]}
    do
        echo "开始执行:$info"  
        ip=`echo $info | cut -d : -f 1`
        port=`echo $info | cut -d : -f 2`

      for  loop in  `cat key.txt`
         do
         #echo $loop  |xargs -t -n1 redis-cli -c  -h $ip -p $port -a $password -c del
         echo $loop  |xargs -t -n1 redis-cli -c  -h $ip -p $port -a $password -c keys 
         done

    done
    echo "success done完成"

# cat key.txt 
infnce:wonderfulCache
ext_info



#原来的版本

del hello_user_* 

redis-cli keys


 redis-cli keys "hello_user_*" | xargs redis-cli del


./redis-cli -h IP -p PORT -a PASSWORD keys 'key*' | xargs  ./redis-cli -h IP  -p PORT -a PASSWORD del

redis-cli    -c  -h    172.31.22.218   -p 7000  -a pass keys 'hello_user_*'| xargs -i redis-cli    -c  -h    172.31.22.218   -p 7000  -a pass  del {}
redis-cli    -c  -h    172.31.22.218   -p 7001  -a pass keys 'hello_user_*'| xargs -i redis-cli    -c  -h    172.31.22.218   -p 7001  -a pass  del {}

redis-cli    -c  -h    172.31.16.135  -p 7002  -a pass keys 'hello_user_*'| xargs -i  redis-cli    -c  -h    172.31.16.135   -p 7002 -a pass  del {}
redis-cli    -c  -h    172.31.16.135  -p 7003  -a pass keys 'hello_user_*'| xargs  -i redis-cli    -c  -h    172.31.16.135   -p 7003 -a pass  del {}

redis-cli    -c  -h     172.31.23.43   -p 7004  -a pass keys 'hello_user_*'| xargs -i  redis-cli    -c  -h    172.31.23.43   -p 7004 -a pass  del {}
redis-cli    -c  -h     172.31.23.43   -p 7005  -a pass keys 'hello_user_*'| xargs -i  redis-cli    -c  -h    172.31.23.43   -p 7005 -a pass  del {}



#!/bin/bash
redis_comm=/usr/local/redis-5.0.3/bin/redis-cli
redis_ser01=192.168.50.175
redis_ser02=192.168.50.174
$redis_comm -c -h $redis_ser01  -p 7001 -a xxx  keys $1 | xargs -i $redis_comm -c -h $redis_ser01  -p 7001 -a xxx del {}
$redis_comm -c -h $redis_ser02  -p 7001 -a xxx  keys $1 | xargs -i $redis_comm -c -h $redis_ser02  -p 7001 -a xxx del {}

运行:

./redis_del_key.sh  匹配的key*

err  

-i  {} 都是一定要的 

redis-cli -n 0 keys "test*" | xargs redis-cli -n 0 del
(error) CROSSSLOT Keys in request don't hash to the same slot

see also

redis集群批量删除模糊key shell脚本

redis cluster集群批量删除中的key

Redis集群批量删除key

redis集群批量删除指定的key

https://blog.csdn.net/qq_36090419/article/details/80537684