Redis管理工具-RedisWebManager

2018-12-22  本文已影响0人  Willis1

关注及时更新请查看我的博客:Redis管理工具-RedisWebManager

这是我自己写的一个Redis管理工具,自动decode Redis缓存中的json串为数组,自动unserialize Redis缓存中的序列化串为对象,这样可以非常直观的查看数据(当然这两个功能目前仅限php),这可能是目前php版本的最好用的redis管理工具了,虽然目前还无法添加和修改redis内容,只能查看和删除,但调试项目的时候一般都是查看和删除比较多,如果要修改一个值,你把它删除了程序重新从数据库取也是一样的,所以个人认为添加和修改用的并不多,暂时就没做,以后有时间,有需要的话可能会加上。

首页预览: image 弹窗方式查看key值(在RedisWebManager/config/params.php配置文件中设置valDisplayType为popup即可): image 在行内查看key值(在RedisWebManager/config/params.php配置文件中设置valDisplayType为inline即可): image 在新页面查看key值(当内容太长时,可能弹窗/行内显示都不是很方便清晰,所以可以点击『View』按钮跳转到新页面查看,看起来会更清晰更方便一点): image

从上面几张图的内容可以看到,RedisWebManager是直接显示查出的值的原始内容(如数组或对象),而不是显示json化后的json字符串,或者序列化后的字符串,这是本工具最大的优势,也是我写本工具的最重要的原因,特别项目测试时,有时候需要查看缓存数据,这个功能会非常方便(但反序列化目前仅针对php有效,未测试过其他语言的序列化与反序列化)!

功能

安装

git clone https://github.com/xiebruce/RedisWebManager.git

Redis 配置

配置文件在(在本地自动加载redis_local.php文件,在线上自动加载 redis.php文件):

RedisWebManager/config/redis.php
RedisWebManager/config/redis_local.php

配置清空db的密码 & 配置快速查询的Key

RedisWebManager/config/params.php
RedisWebManager/config/params_local.php

登录账号密码配置

RedisWebManager/models/User.php
如图,username为账号,password为密码,只需要修改username和password对应的值即可,如果你想要多个账号,那就复制多份,注意把key和id值改一下,这个就相当于数据库查出来的一条数据,key和id就是数据库的自增id,因为我们不配置数据库,所以直接写死在这里。 image

设置权限

sudo chmod -R 777 /path/to/RedisWebManager/runtime
sudo chmod -R 777 /path/to/RedisWebManager/web/assets

Nginx 配置

建议添加nginx密码认证,这样就算别人知道地址也无法进入:Nginx添加密码认证

server {
    charset utf-8;
    client_max_body_size 128M;

    listen 80; ## listen for ipv4
    #listen [::]:80 default_server ipv6only=on; ## listen for ipv6

    server_name redis.mydomain.com;
    root        /data/wwwroot/RedisWebManager/web;
    index       index.php;

    access_log  /path/to/RedisWebManager/log/access.log;
    error_log   /path/to/RedisWebManager/log/error.log;

    location / {
        # Redirect everything that isn't a real file to index.php
        try_files $uri $uri/ /index.php$is_args$args;
    }

    # uncomment to avoid processing of calls to non-existing static files by Yii
    #location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
    #    try_files $uri =404;
    #}
    #error_page 404 /404.html;

    # deny accessing php files for the /assets directory
    location ~ ^/assets/.*\.php$ {
        deny all;
    }

    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass 127.0.0.1:9000;
        #fastcgi_pass unix:/var/run/php5-fpm.sock;
        try_files $uri =404;
    }

    location ~* /\. {
        deny all;
    }
}

注意事项

由于redis的特殊,分页其实并不太准确,你刷新一次它的数据都不一样,所以上一页下一页并不是太重要,要查数据直接查就行,靠分页肉眼看数据会比较累。

更新日志

2018-12-19 v0.2

2018-12-14 v0.1

上一篇 下一篇

猜你喜欢

热点阅读