您好,登錄后才能下訂單哦!
安裝RedisLive
升級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
安裝redis-stat
卸載老版本:
yum erase ruby ruby-libs ruby-mode ruby-rdoc ruby-irb ruby-ri ruby-docs
1.安裝ruby 2.0以上
tar -xf ruby-2.1.9.tar.gz cd ruby-2.1.9 ./configure --prefix=/usr/local/ruby2.0 make make install
配置連接:
cd /usr/local/ruby2.0/ for i in `ls`;do ln -s /usr/local/ruby2.0/bin/$i /usr/bin/$i;done
添加淘寶源:
gem sources --add https://ruby.taobao.org/ --remove https://rubygems.org/
2.安裝redis-stat
cd /data/ git clone https://github.com/junegunn/redis-stat.git cd /data/redis-stat/bin/ # ./redis-stat --help usage: redis-stat [HOST[:PORT] ...] [INTERVAL [COUNT]] -a, --auth=PASSWORD Password -v, --verbose Show more info --style=STYLE Output style: unicode|ascii --no-color Suppress ANSI color codes --csv[=CSV_FILE] Print or save the result in CSV --es=ELASTICSEARCH_URL Send results to ElasticSearch: [http://]HOST[:PORT][/INDEX] --server[=PORT] Launch redis-stat web server (default port: 63790) --daemon Daemonize redis-stat. Must be used with --server option. --version Show version --help Show this message
命令行運行:
redis-stat redis-stat 1 redis-stat 1 10 redis-stat --verbose redis-stat localhost:6380 1 10 redis-stat localhost localhost:6380 localhost:6381 5 redis-stat localhost localhost:6380 1 10 --csv=/tmp/output.csv --verbose
redis-stat運行為服務:
redis-stat --server redis-stat --verbose --server=8080 5 # redis-stat server can be daemonized redis-stat --server --daemon # Kill the daemon killall -9 redis-stat-daemon
以守護進程模式啟動:
redis-stat --verbose --server=8080 5 --daemon
運行其它主機實例:
./redis-stat 192.168.1.12 --auth='1234' --verbose --server=8080 5 --daemon
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。