OpenTSDB-2.0.0安装布署

2014-02-27 11:07:49|  分类: 大数据 |  标签:hadoop  |举报|字号 订阅

1、介绍
OpenTSDB是一个架构在Hbase系统之上的实时监控信息收集和展示平台。它支持秒级数据采集所有metrics,支持永久存储,可以做容量规划,并很容易的接入到现有的报警系统里。OpenTSDB可以从大规模的集群(包括集群中的网络设备、操作系统、应用程序)中获取相应的metrics并进行存储、索引以及服务,从而使得这些数据更容易让人理解,如web化,图形化等。

2、安装
安装Gnuplot
Gnuplot 是一个命令行的交互式绘图工具(command-driven interactive function plotting program)。用户通过输入命令,可以逐步设置或修改绘图环境,并以图形描述数据或函数,使我们可以借由图形做更进一步的分析。
yum install gnuplot

如果是下载压缩包压缩包的话,解压后进入目录分别执行 ./configure; make; make check; make install

下载压缩包安装过程如下:
# based on a minimal installation, you need some packages in order to compile, I suggest
yum install gcc gcc-c++ make libX11 xauth
yum install cairo-devel pango-devel freetype-devel gd-devel

cd /usr/local/src/
wget http://sourceforge.net/projects/gnuplot/files/gnuplot/4.4.2/gnuplot-4.4.2.tar.gz/download
tar xzf gnuplot-4.4.2.tar.gz
cd gnuplot-4.4.2
less INSTALL

# start compiling. I usually install self-compiled stuff at /opt/[PKG-NAME]
./configure --prefix=/opt/gnuplot442
make
# make sure the shipped version of gnuplot is removed (this is probably not necessary but prevents version mix-up)
yum remove gnuplot
make install

# you might want to add a symlink
ln -s /opt/gnuplot442/bin/gnuplot /usr/bin/gnuplot

安装完成后执行gnuplot,确认支持png :执行set terminal可以查看
如果不支持则opentsdb在画图时会报错

安装完后可以验证是否可以正常画出png图片,画png图片示例如下:

[root@centos]#vim test.log
23:14 506.877
23:19 501.068
23:24 493.254
23:29 469.184
23:34 460.161
23:39 426.065
23:44 429.734
23:49 409.255
23:54 423.512
23:59 390.676
然后编写gnuplot的配置文件如下:
[root@centos]#vim log.conf
set terminal png truecolor size 550,250 #指定输出成png图片,且图片大小为550×250,需要ligpng支持,采用默认颜色设定
set output "log.png" #指定输出png图片的文件名
set autoscale #轴向标记自动控制
set xdata time #X轴数据格式为时间
set timefmt "%H:%M" #时间输入格式为"小时:分钟"
set style data lines #数据显示方式为连线
set xlabel "time per day" #X轴标题
set ylabel "Mbps" #Y轴标题
set title "image.tuku.china.com flow" #图片标题
set grid #显示网格
plot "test.log" using 1:2 title"access_flow" #从test.log文件中读取第一列和第二列作为X轴和Y轴数据,示例名"log_flow"
最后运行catlog.conf | gnuplot命令,就生成了log.png文件,如下:

画png图需要有arial字体支持,centos中arial字体安装方法如下:

经常运行一些生物信息软件的时候,提示:Could not find/open font when opening font “arial”, using internalnon-scalable font等信息。此时,表示CentOS系统缺乏相应的字体文件。需要安装,步骤如下:
1.widonws下载字体文件到Linux
windows的字体比较多,其字体文件位于 C:\WINDOWS\Fonts。从其中copy相应的字体到Linux系统的 /usr/share/font/下的文件夹中。以arial字体为例:
# mkdir/usr/share/fonts/arial
# cp arial*.ttf/usr/share/fonts/arial/
2. 为刚加入的字体设置缓存使之有效
# cd/usr/share/font/arial
# mkfontscale
# mkfontdir
# fc-cache -fv
经过这样的设置后,即可在Gnome界面的系统——首选项——外观——字体中进行字体的选择了。
3. 设置gunplot对arial的选择路径
本文首页提示的错误是由于程序调用gunplot造成,必须让gunplot识别arial字体所在的路径才行。
$ exportGDFONTPATH=/usr/share/fonts/arial
$ exportGNUPLOT_DEFAULT_GDFONT="arial"

gnuplot画图技巧

http://blog.csdn.net/wdzxl198/article/details/8970521
 
安装autoconf
Autoconf是一个用于生成可以自动地配置软件源代码包以适应多种Unix类系统的 shell脚本的工具。由Autoconf生成的配置脚本在运行的时候与Autoconf是无关的, 就是说配置脚本的用户并不需要拥有Autoconf。
yum install autoconf

安装git
yum -y install zlib-devel openssl-devel perl cpio expat-devel gettext-devel
yum install git

下载opentsdb2.0.0源码
//git clone git://github.com/stumbleupon/opentsdb.git

https://github.com/OpenTSDB/opentsdb/releases/tag/v2.0.0RC1
cd opentsdb
./build.sh

执行过程报错,错误信息如下
Can't exec "aclocal": No such file or directory at/usr/share/autoconf/Autom4te/FileUtils.pm line 326.

网上搜了一下,发现缺少automake工具
yum install automake
安装完antomake后进入opentsdb目录再次执行
./build.sh

3.设置&运行
先启动hadoop和hbase集群
配置环境变量,在shell中执行如下命令:
env COMPRESSION=none HBASE_HOME=/usr/hadoop/bbase0941

./opentsdb/src/create_table.sh
在hbase伪分布环境下貌似要修改create_table.sh,否则建表会卡住:

exec"$hbh/bin/hbase" shell <<EOF
create'$UID_TABLE','id', 'name'
# {NAME => 'id', COMPRESSION =>'$COMPRESSION', BLOOMFILTER => '$BLOOMFILTER'},
# {NAME => 'name', COMPRESSION =>'$COMPRESSION', BLOOMFILTER => '$BLOOMFILTER'}

create'$TSDB_TABLE','t'
# {NAME => 't', VERSIONS => 1,COMPRESSION => '$COMPRESSION', BLOOMFILTER => '$BLOOMFILTER'}

create'$TREE_TABLE','t'
# {NAME => 't', VERSIONS => 1,COMPRESSION => '$COMPRESSION', BLOOMFILTER => '$BLOOMFILTER'}

create'$META_TABLE','name'
# {NAME => 'name', COMPRESSION =>'$COMPRESSION', BLOOMFILTER => '$BLOOMFILTER'}

启动tsd服务

./build/tsdb tsd --port=4242--staticroot=build/staticroot --cachedir=/tmp/tsdtmp –zkquorum=localhost

tsd服务运行参数说明:
Usage: tsd --port=PORT --staticroot=PATH --cachedir=PATH
Starts the TSD, the Time Series Daemon
  --async-io=true|false Use async NIO (default true) or traditionalblocking io
  --auto-metric        Automatically add metrics to tsdb as they are inserted.  Warning:this may cause unexpected metrics to be tracked
  --cachedir=PATH       Directory underwhich to cache result of requests.
  --flush-interval=MSEC Maximum time for which a new data point canbe buffered (default: 1000).
  --port=NUM            TCPport to listen on.
  --staticroot=PATH     Web root from which toserve static files (/s URLs).
  --table=TABLE         Nameof the HBase table where to store the time series (default: tsdb).
  --uidtable=TABLE      Name of theHBase table to use for Unique IDs (default: tsdb-uid).
  --worker-threads=NUM  Number for async io workers(default: cpu * 2).
  --zkbasedir=PATH      Path underwhich is the znode for the -ROOT- region (default: /hbase).
  --zkquorum=SPEC       Specificationof the ZooKeeper quorum to use (default: localhost).

以下是tsdb可运行的命令
usage: tsdb <command> [args]
Valid commands: fsck, import, mkmetric, query, tsd, scan, uid

4.测试

保存标签

./build/tsdb mkmetric proc.loadavg.1mproc.loadavg.5m

编写脚本并运行
cat >loadavg-collector.sh <<\EOF
#!/bin/bash
set -e
while true; do
  awk -v now=`date +%s` -v host=`hostname` \
  '{ print "put proc.loadavg.1m " now " " $1" host=" host;
     print "put proc.loadavg.5m " now "" $2 " host=" host }' /proc/loadavg
  sleep 15
done | nc -w 30 192.168.145.1294242
EOF
chmod +x loadavg-collector.sh
nohup ./loadavg-collector.sh &
红字部分换成启动tsd服务的服务器IP和端口

vimnohup.out 可能显示-bash nc: not command found需要安装nc

yuminstall nc

每隔15秒会输出如下信息到tsd
put proc.loadavg.1m 1288946927 0.36 host=foo
put proc.loadavg.5m 1288946927 0.62 host=foo
put proc.loadavg.1m 1288946942 0.43 host=foo
put proc.loadavg.5m 1288946942 0.62 host=foo

使用浏览器登陆 192.168.145.129:4242,在from、to中选择好时间范围,在metrics里输入 “proc.loadavg.1m”,就能在图表中看到监控信息,如下图

5.总结opentsdb的表设计特点可以满足时间序列的数据存储在hbase中并能秒级相应。适合于以固定时间间隔的数据采集,例如系统软件和硬件的监控。结合logstash可以监控应用log日志信息。

附1:centos安装opentsdb

官方网站:http://opentsdb.net/getting-started.html(更新autoconf,automake到最新版)

1.安装gnuplot-4.4.6:http://www.gnuplot.info/

wget  http://nchc.dl.sourceforge.net/project/gnuplot/gnuplot/4.6.0/gnuplot-4.6.0.tar.gz

cd gnuplot-4.4.6

./configure

make

make install

2.安装git:http://my.oschina.net/lgc/blog/5370

yum -y install zlib-devel openssl-devel perlcpio expat-devel gettext-devel

wgethttp://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.gz

tar xzvf git-latest.tar.gz

cd git-{date}

autoconf

./configure --with-curl=/usr/local

make & make install

3.安装opentsdb

git clonegit://github.com/stumbleupon/opentsdb.git

cd opentsdb

./build.sh

env COMPRESSION=noneHBASE_HOME=path/to/hbase-0.92.X  ./src/create_table.sh

修改/usr/local/opentsdb/build/tsdb

vi /usr/local/opentsdb/build/tsdb

abs_srcdir=

abs_builddir=

修改为如下

abs_srcdir='/usr/local/opentsdb/build/..'(opentsdb安装位置)

abs_builddir='/usr/local/opentsdb/build'(opentsdb安装位置)

tsdtmp=${TMPDIR-'/tmp'}/tsd    # Forbest performance, make sure

mkdir -p "$tsdtmp"            # your temporary directory uses tmpfs

./build/tsdb tsd --port=4242--staticroot=build/staticroot --cachedir="$tsdtmp"--zkquorum=10.96.80.156,10.96.80.152

zkquorum表示zookeeper的位置

 

附2:OpenTsdb的eclipse配置

编译期:
MainClass:com.google.gwt.dev.Compiler
Arguments:-war staticroot  QueryUi,其中staticroot是编译后的静态文件的存放目录;
QueryUi是QueryUi.gwt.xml的名字,必须放在src目录下。

Eclipse的debug configuration中的classpath中必须包括src目录,因为compiler需要有源代码。

QueryUi.gwt.xml的内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<module>
  <inherits name="com.google.gwt.user.User"/>
  <inheritsname="com.google.gwt.user.theme.standard.Standard"/>
  <inherits name="com.google.gwt.http.HTTP"/>
  <inherits name="com.google.gwt.json.JSON"/>
  <entry-point class="tsd.client.QueryUi"/>
  <source path="tsd"/>
</module>
其中,tsd.client.QueryUi是类全名。类全名中必须有client。

开发期Eclipse运行:
MainClass:
net.opentsdb.tools.TSDMain
Arguments:
--port=4242
--staticroot=staticroot/QueryUi
--cachedir=cachedir
--zkquorum=192.168

转载于:https://www.cnblogs.com/legendary/p/3822360.html

转:openTSDB 2.0 安装相关推荐

  1. zabbix3.0 安装方法,一键实现短信、电话、微信、APP 告警

    引言 免费开源监控工具 Zabbix 因其强大的监控功能得到各大互联网公司的广泛认可,具体功能不再详细介绍,在之前发布的 Zabbix 2.4.1 安装及微信短信提醒已经做了详细介绍,本篇主要对 Za ...

  2. Debian 6.0 安装过程 及中文乱码

    2019独角兽企业重金招聘Python工程师标准>>> Debian 6.0 安装过程 Debian 6.0 安装过程 转(一个别人自录的安装过程录相) http://v.youku ...

  3. ESXi6.5环境搭建(三:vSphere Client6.0安装)

    实验目的及要求 完成VMware workstations安装,会应用相关操作: 完成虚拟机中ESXI6.5平台的安装及网络环境配置: 完成VMware vSphere Client 6.0软件在PC ...

  4. EasyPHP-2.0b1+ Mantis-1.1.0安装及技巧

    转载: EasyPHP-2.0b1+ Mantis-1.1.0安装及技巧 注:部分配置来源网络,写此文仅为以后配置提供参考 Mantis是一个轻量级的brower的bug管理系统,界面直观,简单易用, ...

  5. VMware9.0安装Ubuntu出现Software virtualization is incompatible 问题的解决

    问题描述 刚刚在VMware9.0安装Ubuntu,具体的参考可以见:http://wenku.baidu.com/view/3689981ba2161479171128c5.html 当所有步骤完成 ...

  6. torch==1.1.0和torchvision-0.3.0安装

    torch==1.1.0和torchvision-0.3.0安装 分开安装,每次都会把torch升级成1.5.0把版本.解决办法,一起安装. pip3 install --timeout=12000 ...

  7. Ubuntu14.04 x64 zabbix 3.0 安装

    Ubuntu14.04 x64  zabbix 3.0 安装 苦于网上的文档很多,但是对初学者来说,很多都搭建不成功,我重新安装一下.记录一下. 下载deb wget http://repo.zabb ...

  8. tensorflow1.14.0安装不上,报错

    pip install tensorflow==1.14.0 -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow1.14.0安装不上,报错 M ...

  9. Discuz! 6.0.0 安装图文教程

    一.所需环境要求 操作系统要求 Discuz! 具备跨平台特性,可以运行于 Linux/FreeBSD/Unix 及微软 Windows 2000/2003 等各种操作系统环境下.我们已在软件中针对上 ...

最新文章

  1. 封装了一套WeCenter的IOS SDK
  2. java 自定义arraylist_Java 中模仿源码自定义ArrayList
  3. Android 图片加载框架Coil使用总结
  4. 单片机平台的最小偏差圆弧插补算法
  5. C++复习总结(涵盖所有C++基本考点)!
  6. PHP函数调用的新的用法
  7. 背地砖上楼的机器人_德国发明铺地砖机器人,效率大幅度上升,节省千万!
  8. 服务器虚拟化nas存储服务器搭建,采用NAS架构优化VMware服务器虚拟化环境的存储管理.pdf...
  9. 双截止阀(DBB)行业调研报告 - 市场现状分析与发展前景预测
  10. Activity 生命周期图解
  11. Apple 隐私政策
  12. java事件轮询_用scala实现的nio事件轮询
  13. 80sec被黑原因分析
  14. 如何让iframe背景色透明
  15. pdf编辑器怎么使用
  16. 如何去除Excel图表网格线?
  17. 刘宝瑞相声《珍珠翡翠白玉汤》台词
  18. 2017-2018 Petrozavodsk Winter Training Camp, Saratov SU Contest C.Cover the Paths 贪心+DFS
  19. C#调用Qt写的dll,并处理异常来自 HRESULT:0x8007000B
  20. Ambarella面试小结

热门文章

  1. 百度前端技术学院html任务,重回百度前端技术学院第一天 HTML复习
  2. jsr303jsp页面怎么显示错误信息_jsp校验信息不显示
  3. linux flush 保证 磁盘,linux cache介绍及控制
  4. 嵌入式linux 配置usb otg,嵌入式系统设计中的USB OTG方案
  5. 信息系统项目管理师真题及答案
  6. 8个超好用的Python内置函数
  7. Docker-Compose简介与Ubuntu Server 上安装Compose
  8. 怎样在IDEA上将WebService接口打包部署到服务器
  9. Java中实现根据一个List中的数据的两个属性相同划分为同一类
  10. ElementUI的DateTimePicker组件修改时间格式