應用場景
當安裝完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/*