您好,登錄后才能下訂單哦!
這篇文章給大家分享的是有關RedisLive監控工具如何安裝的內容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。
1.安裝python2.7.5 和pip
http://blog.itpub.net/30089851/viewspace-2132450/
2.下載RedisLive
[root@sht-sgmhadoopdn-04 app]# wget https://github.com/nkrode/RedisLive/archive/master.zip
[root@sht-sgmhadoopdn-04 app]# unzip master
[root@sht-sgmhadoopdn-04 app]# mv RedisLive-master RedisLive
[root@sht-sgmhadoopdn-04 app]# cd RedisLive/
[root@sht-sgmhadoopdn-04 RedisLive]# ll
total 20
drwxr-xr-x 2 root root 4096 Aug 20 2015 design
-rw-r--r-- 1 root root 1067 Aug 20 2015 MIT-LICENSE.txt
-rw-r--r-- 1 root root 902 Aug 20 2015 README.md
-rw-r--r-- 1 root root 58 Aug 20 2015 requirements.txt
drwxr-xr-x 7 root root 4096 Aug 20 2015 src
[root@sht-sgmhadoopdn-04 RedisLive]#
3.查看版本要求(剛開始安裝沒注意版本,直接pip導致后面各種問題,所以請仔細看下面過程)
[root@sht-sgmhadoopdn-04 RedisLive]# cat requirements.txt
argparse==1.2.1
python-dateutil==1.5
redis
tornado==2.1.1
[root@sht-sgmhadoopdn-04 RedisLive]# cd ../
4.pip安裝環境要求
[root@sht-sgmhadoopdn-04 app]# pip install tornado
[root@sht-sgmhadoopdn-04 app]# pip install redis
[root@sht-sgmhadoopdn-04 app]# pip install python-dateutil
[root@sht-sgmhadoopdn-04 app]# pip install argparse
5.進入 /root/learnproject/app/RedisLive/src目錄,配置redis-live.conf文件
[root@sht-sgmhadoopdn-04 app]# cd -
/root/learnproject/app/RedisLive
[root@sht-sgmhadoopdn-04 RedisLive]# cd src
[root@sht-sgmhadoopdn-04 src]# ll
total 40
drwxr-xr-x 4 root root 4096 Aug 20 2015 api
drwxr-xr-x 2 root root 4096 Aug 20 2015 dataprovider
drwxr-xr-x 2 root root 4096 Aug 20 2015 db
-rw-r--r-- 1 root root 0 Aug 20 2015 __init__.py
-rw-r--r-- 1 root root 381 Aug 20 2015 redis-live.conf.example
-rwxr-xr-x 1 root root 1343 Aug 20 2015 redis-live.py
-rwxr-xr-x 1 root root 9800 Aug 20 2015 redis-monitor.py
drwxr-xr-x 2 root root 4096 Aug 20 2015 util
drwxr-xr-x 4 root root 4096 Aug 20 2015 www
You have mail in /var/spool/mail/root
[root@sht-sgmhadoopdn-04 src]#
[root@sht-sgmhadoopdn-04 src]# cp redis-live.conf.example redis-live.conf
[root@sht-sgmhadoopdn-04 src]#
[root@sht-sgmhadoopdn-04 src]# vi redis-live.conf
{
"RedisServers":
[
{
"server": "172.16.101.66",
"port" : 6379
}
],
"DataStoreType" : "redis",
"RedisStatsServer":
{
"server" : "172.16.101.66",
"port" : 6379
}
}
~
6.第一次嘗試啟動redis-monitor.py拋錯 _sqlite3
[root@sht-sgmhadoopdn-04 src]# ./redis-monitor.py --duration 120
ImportError: No module named _sqlite3
[root@sht-sgmhadoopdn-04 src]# yum install -y sqlite-devel
[root@sht-sgmhadoopdn-04 src]# yum install -y sqlite
[root@sht-sgmhadoopdn-04 ~]# find / -name _sqlite3.so
/usr/local/python27/lib/python2.7/lib-dynload/_sqlite3.so
/usr/local/Python-2.7.5/build/lib.linux-x86_64-2.7/_sqlite3.so
/usr/lib64/python2.6/lib-dynload/_sqlite3.so
[root@sht-sgmhadoopdn-04 ~]# cp /usr/local/python27/lib/python2.7/lib-dynload/_sqlite3.so /usr/local/lib/python2.7/lib-dynload/
[root@sht-sgmhadoopdn-04 ~]# python
Python 2.7.5 (default, Sep 17 2016, 15:34:31)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>>
參考: http://ju.outofmemory.cn/entry/97658
7.第二次嘗試啟動redis-monitor.py拋錯 redis
[root@sht-sgmhadoopdn-04 src]# ./redis-monitor.py --duration 120
ImportError: No module named redis
[root@sht-sgmhadoopdn-04 src]# find / -name redis
/etc/rc.d/init.d/redis
/root/learnproject/app/redis
/root/learnproject/app/redis-monitor/src/main/java/sun/redis
/root/learnproject/app/redis-monitor/src/test/java/sun/redis
/usr/local/redis
/usr/local/python27/lib/python2.7/site-packages/redis
[root@sht-sgmhadoopdn-04 src]#
[root@sht-sgmhadoopdn-04 src]# cp -r /usr/local/python27/lib/python2.7/site-packages/redis /usr/local/lib/python2.7/lib-dynload/
[root@sht-sgmhadoopdn-04 src]# python
Python 2.7.5 (default, Sep 17 2016, 15:34:31)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import redis
>>>
8.第三次嘗試啟動redis-monitor.py,成功;按ctrl+c中斷掉
[root@sht-sgmhadoopdn-04 src]# ./redis-monitor.py --duration 120
^Cshutting down...
You have mail in /var/spool/mail/root
[root@sht-sgmhadoopdn-04 src]#
9.嘗試第一次啟動redis-live.py ,tornado.ioloop
[root@sht-sgmhadoopdn-04 src]# ./redis-live.py
Traceback (most recent call last):
File "./redis-live.py", line 3, in <module>
import tornado.ioloop
ImportError: No module named tornado.ioloop
[root@sht-sgmhadoopdn-04 src]# find / -name tornado
/usr/local/python27/lib/python2.7/site-packages/tornado
[root@sht-sgmhadoopdn-04 src]# cp -r /usr/local/python27/lib/python2.7/site-packages/tornado /usr/local/lib/python2.7/lib-dynload/
10.嘗試第二次啟動redis-live.py ,singledispatch
[root@sht-sgmhadoopdn-04 src]# ./redis-live.py
Traceback (most recent call last):
File "./redis-live.py", line 6, in <module>
import tornado.web
File "/usr/local/lib/python2.7/lib-dynload/tornado/web.py", line 84, in <module>
from tornado import gen
File "/usr/local/lib/python2.7/lib-dynload/tornado/gen.py", line 98, in <module>
from singledispatch import singledispatch # backport
ImportError: No module named singledispatch
###這個 singledispatch 錯誤,其實就是在tornado里的,谷歌和思考過后,懷疑是版本問題,于是果斷卸載tornado
[root@sht-sgmhadoopdn-04 src]# pip uninstall tornado
[root@sht-sgmhadoopdn-04 src]# rm -rf /usr/local/lib/python2.7/lib-dynload/tornado
[root@sht-sgmhadoopdn-04 src]# find / -name tornado
[root@sht-sgmhadoopdn-04 src]#
##假如find有的話 ,就要手工刪除掉
11.于是想想其他也是要卸載掉
[root@sht-sgmhadoopdn-04 src]# pip uninstall argparse
[root@sht-sgmhadoopdn-04 src]# pip uninstall python-dateutil
[root@sht-sgmhadoopdn-04 src]# find / -name argparse
[root@sht-sgmhadoopdn-04 src]# find / -name python-dateutil
##假如find有的話 ,就要手工刪除掉
12.關鍵一步: 根據step3的指定版本來安裝
[root@sht-sgmhadoopdn-04 src]# pip install -v tornado==2.1.1
[root@sht-sgmhadoopdn-04 src]# pip install -v argparse==1.2.1
[root@sht-sgmhadoopdn-04 src]# pip install -v python-dateutil==1.5
13.再次嘗試啟動redis-live.py ,拋錯dateutil.parser
[root@sht-sgmhadoopdn-04 src]# ./redis-live.py
Traceback (most recent call last):
File "./redis-live.py", line 10, in <module>
from api.controller.ServerListController import ServerListController
File "/root/learnproject/app/RedisLive/src/api/controller/ServerListController.py", line 1, in <module>
from BaseController import BaseController
File "/root/learnproject/app/RedisLive/src/api/controller/BaseController.py", line 4, in <module>
import dateutil.parser
ImportError: No module named dateutil.parser
[root@sht-sgmhadoopdn-04 src]#
[root@sht-sgmhadoopdn-04 src]#
[root@sht-sgmhadoopdn-04 src]#
[root@sht-sgmhadoopdn-04 src]#
[root@sht-sgmhadoopdn-04 src]# find / -name dateutil
/usr/local/python27/lib/python2.7/site-packages/dateutil
[root@sht-sgmhadoopdn-04 src]# cp -r /usr/local/python27/lib/python2.7/site-packages/dateutil /usr/local/lib/python2.7/lib-dynload/
You have mail in /var/spool/mail/root
14.再在嘗試啟動redis-live.py ,成功了,然后按ctrl+c中斷掉
[root@sht-sgmhadoopdn-04 src]# ./redis-live.py
^CTraceback (most recent call last):
File "./redis-live.py", line 36, in <module>
tornado.ioloop.IOLoop.instance().start()
File "/usr/local/lib/python2.7/lib-dynload/tornado/ioloop.py", line 283, in start
event_pairs = self._impl.poll(poll_timeout)
KeyboardInterrupt
[root@sht-sgmhadoopdn-04 src]#
15.啟動
[root@sht-sgmhadoopdn-04 src]# ./redis-monitor.py --duration 120 &
[root@sht-sgmhadoopdn-04 src]# ./redis-live.py &
打開web界面
http://172.16.101.66:8888/index.html
感謝各位的閱讀!關于“RedisLive監控工具如何安裝”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。