您的位置:首页 > 数据库

opentsdb 分布式时间序列数据库安装实践

2016-07-06 11:14 399 查看
简介:

opentsdb是一个分布式、易扩展的分布式时间序列数据库。基于HBase做存储,一方面使其能支持海量的数据,一方面也非常容易扩展。主要用于一些服务的监控,比如性能等等。

官方文档:

http://opentsdb.net/docs/build/html/installation.html#runtime-requirements

http://opentsdb.net/docs/build/html/user_guide/configuration.html

参考文章:

http://liubin.org/blog/2016/03/05/tsdb-opentsdb/

前期准备:

A Linux system

Java Runtime Environment 1.6 or later

HBase 0.92 or later

GnuPlot 4.2 or later

HBase、ZooKeeper:线上已经安装好,文章不在讲述

安装过程:

1) 依赖库安装:

sudo yum install -y gd gd-devel libpng libpng-devel

2) gnuplot-5.0.1安装:

下载,解压,三步走(./configure & make & make install) #不用指定prefix前缀,会安装到prefix指定目录下的 /share /bin /libexec下

3)安装opentsdb,

下载tar或者git clone , ./build.sh #服务器需要能连接外网

编译日志:

Linking into /home/hadoop/opentsdb/build/gwt/queryui --后面遇到了问题,根据编译日志解决

Link succeeded

Compilation succeeded -- 30.289s

/bin/mkdir -p staticroot

cp ../src/tsd/static/favicon.ico ../src/tsd/static/opentsdb_header.jpg staticroot

find -L staticroot -type l -exec rm {} \;

p=`pwd`/gwt/queryui && cd staticroot \

&& for i in $p/*; do ln -s -f "$i" || break; done

find -L staticroot/gwt -type f | xargs touch

make64[1]: Leaving directory `/home/hadoop/opentsdb/build'

建表:

env COMPRESSION=NONE HBASE_HOME=/home/hadoop/hbase-1.0.0-cdh5.5.1/ ./src/create_table.sh #根据需要自己判断是否使用压缩

修改配置:

OpenTSDB 2.2 works off a configuration file that is shared between the daemon and command line tools. If you compiled from source, copy the ./src/opentsdb.conf file to a proper directory as documented in Configuration and edit the following, required settings:

tsd.http.cachedir - Path to write temporary files to
tsd.http.staticroot - Path to the static GUI files found in ./build/staticroot
tsd.storage.hbase.zk_quorum - If HBase and Zookeeper are not running on the same machine, specify the host and port here.
With the config file written, you can start a tsd with the command:

You can use the --config command line argument to specify the full path to a configuration file. Otherwise if not specified, OpenTSDB and some of the command-line tools will attempt to search for a valid configuration file in the following locations:

./opentsdb.conf
/etc/opentsdb.conf
/etc/opentsdb/opentsdb.conf
/opt/opentsdb/opentsdb.conf


修改的配置:
cp src/opentsdb.conf .   #按官方文档,复制配置文件到opentsdb安装目录

tsd.network.port = 8999   #端口修改

# The location of static files for the HTTP GUI interface.
# *** REQUIRED ***
 tsd.http.staticroot = /home/data/opentsdb/static #自己定义的,有问题,看问题2            = /home/hadoop/opentsdb/build/staticroot #正确的
# Where TSD should write it's cache files to
# *** REQUIRED ***
tsd.http.cachedir = /home/data/opentsdb/cache
tsd.storage.hbase.zk_quorum = host1:2181,host:2181,host3:2181


++++++++++++++++++++++++++++++ 遇到的问题和解决办法 ++++++++++++++++++++++++++

问题1:日志目录

16:46:33,197 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - Active log file name: /var/log/opentsdb/opentsdb.log

16:46:33,197 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - File property is set to [/var/log/opentsdb/opentsdb.log]

16:46:33,198 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - Failed to create parent directories for [/var/log/opentsdb/opentsdb.log]

16:46:33,199 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - openFile(/var/log/opentsdb/opentsdb.log,true) call failed. java.io.FileNotFoundException: /var/log/opentsdb/opentsdb.log (No such file or directory)

修改:src/logback.xml 把日志目录改成自己定义的

问题2:web界面打不开,日志报找不到文件

2016-07-05 16:48:03,362 INFO [OpenTSDB I/O Worker #1] HttpQuery: [id: 0xd617c536, /xxx:xxx:xx:xx:52403 => /xx:xx:xx:xx:8999] HTTP /s/opentsdb_header.jpg done in 0ms

2016-07-05 16:48:03,810 WARN [OpenTSDB I/O Worker #1] HttpQuery: [id: 0xd617c536, /xx:xx:xx:xx:52403 => /xx:xx:xx:xx:8999] File not found: /home/data/opentsdb/static/favicon.ico (No such file or directory)

查看编译时的日志:

Linking into /home/hadoop/opentsdb/build/gwt/queryui

Link succeeded

Compilation succeeded -- 30.289s

/bin/mkdir -p staticroot

cp ../src/tsd/static/favicon.ico ../src/tsd/static/opentsdb_header.jpg staticroot

修改配置:

tsd.http.staticroot = /home/hadoop/opentsdb/build/staticroot
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  opentsdb opentsdb安装