程序文档之RedisMI

 程序文档  GitHub  flask  python  程序文档   2016-11-28   评论次 

RedisMI

Redis Management Interface with Python Client;

这是一个Python Redis API, 用于检查Redis集群状态,是否正常提供服务,是否可读写,master与slave节点是否在线,负载性能是否在可接受范围等。

要求:

1.MySQL数据库

2.Python第三方模块

3.Python2.7+

使用:

0.用virtualenv新建一个python2.7+的虚拟环境;

1.导入init/rmi.sql(内有创建数据库指令);

2.安装Python模块,pip install -r requirements.txt

3.填写src/conf/config.py配置:

3.1 开发环境可以用python src/api.py启动
3.2 生产环境通过CtlRun.sh start/stop/restart

4.Nginx配置,根据实际情况修改:
4.1 生产环境nginx配置如下(如果没有证书可去掉https部分,并修改http部分。):

upstream rmi {
    server 127.0.0.1:10080;
    #server 127.0.0.1:10090;
    check interval=3000 rise=2 fall=5 timeout=1000 type=http;
    check_http_send "GET /help HTTP/1.0\r\n\r\n";
}

server {
    listen 80;
    server_name your_domain;
    rewrite ^/(.*)$ https://your_domain/$1 permanent;
}

server {
    listen 443;
    server_name your_domain;
    ssl on;
    ssl_certificate your_ssl_crt;
    ssl_certificate_key your_ssl_key;
    #不允许搜索引擎抓取信息
    if ($http_user_agent ~* "qihoobot|Baiduspider|Googlebot|Googlebot-Mobile|Googlebot-Image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo! Slurp|Yahoo! Slurp China|YoudaoBot|Sosospider|Sogou spider|Sogou web spider|MSNBot|ia_archiver|Tomato Bot") {
        return 403;
    }
    #处理静态资源:
    location ~ ^\/static\/.*$ {
        root Your_App_Directory;
    }
    location /status {
        check_status;
        access_log off;
    }
    location / {
        proxy_pass_header Server;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Scheme $scheme;
        proxy_pass http://rmi;
    }
}

4.2 开发环境,nginx配置如下:

server {
   listen 80;
   server_name Your_domain;
   #不允许搜索引擎抓取信息
   if ($http_user_agent ~* "qihoobot|Baiduspider|Googlebot|Googlebot-Mobile|Googlebot-Image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo! Slurp|Yahoo! Slurp China|YoudaoBot|Sosospider|Sogou spider|Sogou web spider|MSNBot|ia_archiver|Tomato Bot") {
       return 403;
   }
   # 处理静态资源:
   location ~ ^\/static\/.*$ {
        root Your_App_Directory;
   }
   location / {
       proxy_pass http://127.0.0.1:10080;
       proxy_set_header Host $host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-Proto https;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   }
}

功能:

1.集群与实例检测;

2.数据Action操作;

3.etc.

点赞 打赏
取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

交流分享

QQ扫一扫或点击二维码加入,群号577543189
微信扫一扫,手滑关注它
微信扫一扫,进入小程序

推荐文章

标签云集

友情链接  交换友链

推广位