标签:redislive
1.升级python
1.1.安装:
tar -xf Python-2.7.10.tar.xz cd Python-2.7.10 ./configure --prefix=/usr/local/pyhon2.7 make make install
1.2.备份老版本文件
mv /usr/bin/python /usr/bin/python2.6.6
1.3.连接新文件
ln -s /usr/local/pyhon2.7/bin/python /usr/bin/python
安装完成
验证:
[root@ckl-soft]# python Python 2.7.10 (default, Jun 21 2016, 09:33:37)
2.安装setuptools
tar -xf setuptools-23.0.0.tar.gz cd setuptools-23.0.0 python setup.py install
3.安装tornado
git https://github.com/tornadoweb/tornado.git unzip tornado-master.zip cd tornado-master python setup.py install
4.安装redis-py
wget https://github.com/andymccurdy/redis-py/archive/master.zip unzip master cd redis-py-master/ python setup.py install
5.安装python-dateutil
tar -xf python-dateutil-2.4.2.tar.gz cd python-dateutil-2.4.2 python setup.py install
6.安装argparse
tar -xf argparse-1.4.0.tar.gz cd argparse-1.4.0 python setup.py install
7.安装RedisLive
https://github.com/nkrode/RedisLive tar -xf RedisLive-master.zip -C /data/ cd /data/ mv RedisLive-master RedisLive
修改配置文件:
cd /data/RedisLive/src cp redis-live.conf.example cp redis-live.conf vim redis-live.conf { "RedisServers": [ { "server": "192.168.1.11", "port" : 6379, "password" : "112233" } ], "DataStoreType" : "sqlite", "RedisStatsServer": { "server" : "127.0.0.1", "port" : 6385 }, "SqliteStatsStore" : { "path": "/data/RedisLive/src/db/redislive.sqlite" } }
增加crontab
*/3 * * * * cd /data/RedisLive/src/;./redis-monitor.py --duration 20 >/dev/null 2>&1
启动进程:
./redis-live.py &
[1] 9483 [root@pro-kibana src]# Traceback (most recent call last): File "./redis-live.py", line 10, in <module> from api.controller.ServerListController import ServerListController File "/data/RedisLive/src/api/controller/ServerListController.py", line 1, in <module> from BaseController import BaseController File "/data/RedisLive/src/api/controller/BaseController.py", line 1, in <module> from dataprovider.dataprovider import RedisLiveDataProvider File "/data/RedisLive/src/dataprovider/dataprovider.py", line 2, in <module> import sqliteprovider File "/data/RedisLive/src/dataprovider/sqliteprovider.py", line 3, in <module> import sqlite3 File "/usr/local/python2.7/lib/python2.7/sqlite3/__init__.py", line 24, in <module> from dbapi2 import * File "/usr/local/python2.7/lib/python2.7/sqlite3/dbapi2.py", line 28, in <module> from _sqlite3 import * ImportError: No module named _sqlite3
解决:安装sqlite
tar -xf setuptools-23.0.0.tar.gz cd sqlite-autoconf-3130000 ./configure --prefix=/usr/local/sqlite3 make && make install
重新编译python:
vi Python-2.7.10/setup.py ... sqlite_inc_paths = [ ‘/usr/include‘, ‘/usr/local/sqlite3/include‘, #增加到这里 ‘/usr/include/sqlite‘, ‘/usr/include/sqlite3‘, ‘/usr/local/include‘, ‘/usr/local/include/sqlite‘,
重新编译即可
再次启动:
./redis-live.py &
[1] 21249 [root@pro-kibana src]# Traceback (most recent call last): File "./redis-live.py", line 10, in <module> from api.controller.ServerListController import ServerListController File "/data/RedisLive/src/api/controller/ServerListController.py", line 1, in <module> from BaseController import BaseController File "/data/RedisLive/src/api/controller/BaseController.py", line 7, in <module> class BaseController(tornado.web.RequestHandler): File "/data/RedisLive/src/api/controller/BaseController.py", line 9, in BaseController stats_provider = RedisLiveDataProvider.get_provider() File "/data/RedisLive/src/dataprovider/dataprovider.py", line 16, in get_provider data_store_type = settings.get_data_store_type() File "/data/RedisLive/src/api/util/settings.py", line 24, in get_data_store_type config = get_settings() File "/data/RedisLive/src/api/util/settings.py", line 10, in get_settings return json.load(config) File "/usr/local/python2.7/lib/python2.7/json/__init__.py", line 290, in load **kw) File "/usr/local/python2.7/lib/python2.7/json/__init__.py", line 338, in loads return _default_decoder.decode(s) File "/usr/local/python2.7/lib/python2.7/json/decoder.py", line 366, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/local/python2.7/lib/python2.7/json/decoder.py", line 382, in raw_decode obj, end = self.scan_once(s, idx) ValueError: Expecting , delimiter: line 7 column 25 (char 101) [1]+ Exit 1 ./redis-live.py
检查配置文件json格式语法有错误,少了一个","
启动后8888端口
http://192.168.1.80:8888/index.html
本文出自 “深呼吸再出击” 博客,请务必保留此出处http://ckl893.blog.51cto.com/8827818/1791301
标签:redislive
原文地址:http://ckl893.blog.51cto.com/8827818/1791301