应用场景
当安装完redis后,通过shell端或者客户端对redis进行操作,但是缺少了对redis的监控工具,下面介绍redis的web端的监控工具Webdis。
操作步骤
1. 安装软件包
安装依赖
# cd /root
# yum -y install zlib-devel openssl-devel perl cpio expat-devel gettext-devel curl
# yum -y install libevent-devel
# yum -y install git
下载编译源码
# git clone git://github.com/nicolasff/webdis.git
# cd webdis
# make
创建安装目录并拷贝安装与配置文件
# mkdir /usr/local/webdis
# cp webdis /usr/local/webdis
# cp webdis.json /usr/local/webdis
2. 修改配置文件
编辑修改webdis配置文件webdis.json以下参数:
# vim /usr/local/webdis/webdis.json
{
"redis_host": "127.0.0.1",
"redis_port": 6379,
"redis_auth": null,
"http_host": "0.0.0.0",
"http_port": 7379,
"threads": 5,
"pool_size": 20,
"daemonize": true,
"websockets": false,
"database": 0,
"acl": [
{
"disabled": ["DEBUG", "FLUSHDB", "FLUSHALL"]
},
{
"http_basic_auth": "user:password",
"enabled": ["DEBUG"]
}
],
"verbosity": 6,
"logfile": "/usr/local/webdis/webdis.log",
"pidfile": "/usr/local/webdis/webdis.pid"
}
3. 配置自启动
增加自启动命令,需配置在redis启动命令下面
# vim /etc/rc.local
/usr/local/webdis/webdis /usr/local/webdis/webdis.json
重启服务器
# reboot
4. 安装验证
测试常用API,或者在浏览器打开对应地址测试:
# curl http://127.0.0.1:7379/SET/key/value
# curl http://127.0.0.1:7379/GET/key
# curl http://127.0.0.1:7379/DEL/key
# curl http://127.0.0.1:7379/keys/*