OpenTSDB-2.1.0RC1安装记录

来源:互联网 发布:淘宝上好看的女装店铺 编辑:程序博客网 时间:2024/05/17 16:14

最近在做监控系统相关的项目,在调研了一阵之后,决定选取OpenTSDB作为监控数据的核心存储,主要基于其提供可扩展的存储机制,易于做跟现有图表展现框架grafana做整合,轻松绘制专业的监控图表展现UI,同时提供了方便的HTTP API,可在其基础上开发报警模块。

现整理下安装配置过程:

1、下载软件包,下载地址是 https://github.com/OpenTSDB/opentsdb/releases/download/v2.1.0RC1/opentsdb-2.1.0RC1.noarch.rpm, 也可以采取直接下载源码包编译安装,但考虑到没有对源码做任何改动,便没有必要这么干了。

2、安装RPM,将下载好的软件包放到服务某个目录,如/usr/local/src,然后执行rpm -i opentsdb-2.1.0RC1.noarch.rpm,接着执行rpm -qa opentsdb,如果提示信息包括如下则表示安装成功:[root@hadoop4 src]# rpm -qa opentsdb
opentsdb-2.1.0RC1-1.noarch

3、配置

# --------- NETWORK ----------# The TCP port TSD should use for communications# *** REQUIRED ***tsd.network.port = 4242# The IPv4 network address to bind to, defaults to all addresses# tsd.network.bind = 0.0.0.0# Enables Nagel's algorithm to reduce the number of packets sent over the# network, default is True#tsd.network.tcpnodelay = true# Determines whether or not to send keepalive packets to peers, default# is True#tsd.network.keepalive = true# Determines if the same socket should be used for new connections, default# is True#tsd.network.reuseaddress = true# Number of worker threads dedicated to Netty, defaults to # of CPUs * 2tsd.network.worker_threads = 4# Whether or not to use NIO or tradditional blocking IO, defaults to True#tsd.network.async_io = true# ----------- HTTP -----------# The location of static files for the HTTP GUI interface.# *** REQUIRED ***tsd.http.staticroot = /usr/share/opentsdb/static/# Where TSD should write it's cache files to# *** REQUIRED ***tsd.http.cachedir = /tmp/opentsdb# --------- NETWORK ----------# The TCP port TSD should use for communications# *** REQUIRED ***tsd.network.port = 4242# The IPv4 network address to bind to, defaults to all addressestsd.network.bind = 0.0.0.0# Enables Nagel's algorithm to reduce the number of packets sent over the# network, default is Truetsd.network.tcpnodelay = true# Determines whether or not to send keepalive packets to peers, default# is Truetsd.network.keepalive = true# Determines if the same socket should be used for new connections, default# is Truetsd.network.reuseaddress = true# Number of worker threads dedicated to Netty, defaults to # of CPUs * 2tsd.network.worker_threads = 4# Whether or not to use NIO or tradditional blocking IO, defaults to Truetsd.network.async_io = true# ----------- HTTP -----------# The location of static files for the HTTP GUI interface.# *** REQUIRED ***tsd.http.staticroot = /usr/share/opentsdb/static/# Where TSD should write it's cache files to# *** REQUIRED ***tsd.http.cachedir = /tmp/opentsdb# --------- CORE ----------# Whether or not to automatically create UIDs for new metric types, default# is Falsetsd.core.auto_create_metrics = false# Full path to a directory containing plugins for OpenTSDBtsd.core.plugin_path = /usr/share/opentsdb/plugins# --------- STORAGE ----------# Whether or not to enable data compaction in HBase, default is Truetsd.storage.enable_compaction = true# How often, in milliseconds, to flush the data point queue to storage,# default is 1,000tsd.storage.flush_interval = 1000# Name of the HBase table where data points are stored, default is "tsdb"tsd.storage.hbase.data_table = tsdb# Name of the HBase table where UID information is stored, default is "tsdb-uid"tsd.storage.hbase.uid_table = tsdb-uid# Path under which the znode for the -ROOT- region is located, default is "/hbase"tsd.storage.hbase.zk_basedir = /hbase# A space separated list of Zookeeper hosts to connect to, with or without# port specifiers, default is "localhost"tsd.storage.hbase.zk_quorum = 192.168.64.15


4、启动测试

预先保证HBase集群正常工作,并用以下脚本创建好几张表:

create 'tsdb',  {NAME => 't', VERSIONS => '1', TTL => '31104000', COMPRESSION => 'LZO', BLOOMFILTER => 'ROW'}create 'tsdb-tree',  {NAME => 't', VERSIONS => '1', COMPRESSION => 'LZO', BLOOMFILTER => 'ROW'}create 'tsdb-uid',  {NAME => 'id', COMPRESSION => 'LZO', BLOOMFILTER => 'ROW'},  {NAME => 'name', COMPRESSION => 'LZO', BLOOMFILTER => 'ROW'}create 'tsdb-meta',  {NAME => 'name', COMPRESSION => 'LZO', BLOOMFILTER => 'ROW'}

需要稍微修改下启动脚本,vim /usr/bin/tsdb, 在开头加入一行,指定本机的JAVA安装根路径,同时修改最后一行:  

JAVA_HOME='/usr/local/jdk1.7.0_55'  // 开头

exec "$JAVA_HOME/bin/java" $JVMARGS -classpath "$CLASSPATH" net.opentsdb.tools.$MAINCLASS "$@"   // 最后一行

 最后,就可以启动OpenTSDB了,命令行下执行 service opentsdb start(停止位 service opentsdb stop),注意观察日志下面是否有错误信息

/var/log/opentsdb  err日志应该没有才行

直接通过界面访问,可以看到  http://192.168.64.15:4242


 在实际情况下,需要部署多个TSD,因为其实无状态服务,多个同时提供服务,在外层搭一个Ngnix作为负载均衡。外部查询,写入配置一个统一的地址就行,比如

http://opentsdb.xianwei.com




0 0
原创粉丝点击