十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
安装redisLive
网页设计是网站建设的前奏,好的网页设计更深度的剖析产品和设计风格定位,结合最新的网页设计流行趋势,与WVI应用标准,设计出具企业表现力,大器而深稳的网站界面设。创新互联公司公司2013年成立,是成都网站建设公司:提供企业网站设计,成都品牌网站建设,营销型企业网站建设方案,响应式网站设计,微信小程序定制开发,专业建站公司做网站。
升级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, infrom api.controller.ServerListController import ServerListController File "/data/RedisLive/src/api/controller/ServerListController.py", line 1, in from BaseController import BaseController File "/data/RedisLive/src/api/controller/BaseController.py", line 1, in from dataprovider.dataprovider import RedisLiveDataProvider File "/data/RedisLive/src/dataprovider/dataprovider.py", line 2, in import sqliteprovider File "/data/RedisLive/src/dataprovider/sqliteprovider.py", line 3, in import sqlite3 File "/usr/local/python2.7/lib/python2.7/sqlite3/__init__.py", line 24, in from dbapi2 import * File "/usr/local/python2.7/lib/python2.7/sqlite3/dbapi2.py", line 28, in 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, infrom api.controller.ServerListController import ServerListController File "/data/RedisLive/src/api/controller/ServerListController.py", line 1, in from BaseController import BaseController File "/data/RedisLive/src/api/controller/BaseController.py", line 7, in 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