首页 > 其他分享 >OpenTSDB 安装

OpenTSDB 安装

时间:2023-05-06 15:05:47浏览次数:38  
标签:COMPRESSION ENCODING DATA opentsdb OpenTSDB 安装 tsdb BLOCK


 

下载目录

https://github.com/OpenTSDB/opentsdb/releases
https://github.com/OpenTSDB/opentsdb/releases/download/v2.4.0/opentsdb-2.4.0.noarch.rpm

安装 GnuPlot

yum install gnuplot -y

直接安装OpenTSDB会报错

[root@ecs-t-001-0001 openTSDB]# rpm -ivh opentsdb-2.4.0.noarch.rpm error: Failed dependencies: gnuplot is needed by opentsdb-2.4.0-1.noarch

 安装OpenTSDB

[root@ecs opt]# rpm -ivh opentsdb-2.4.0.noarch.rpm 
Preparing...                          ################################# [100%]
Updating / installing...
   1:opentsdb-2.4.0-1                 ################################# [100%]

默认配置目录

/etc/opentsdb - Configuration files 
    /tmp/opentsdb - Temporary cache files 
    /usr/share/opentsdb - Application files 
    /usr/share/opentsdb/bin - The "tsdb" startup script that launches a TSD or commandline tools 
    /usr/share/opentsdb/lib - Java JAR library files 
    /usr/share/opentsdb/plugins - Location for plugin files and dependencies 
    /usr/share/opentsdb/static - Static files for the GUI 
    /usr/share/opentsdb/tools - Scripts and other tools 
    /var/log/opentsdb - Logs

修改配置

进入目录 /usr/share/opentsdb/etc/opentsdb 修改配置文件 opentsdb.conf

> vim opentsdb.conf

tsd.storage.hbase.zk_quorum = zk:2181
tsd.network.port = 10080
tsd.http.staticroot = /usr/share/opentsdb/static/
tsd.http.cachedir = /tmp/opentsdb
tsd.core.plugin_path = /usr/share/opentsdb/plugins

初始化OpenTSDB表

进入目录/usr/share/opentsdb/tools,修改create_table.sh

我们加入的内容

HBASE_HOME=/opt/cloudera/parcels/CDH-6.3.2-1.cdh6.3.2.p0.1605554/lib/hbase
COMPRESSION=SNAPPY

 全部内容

[root@ecs tools]# cat create_table.sh 
#!/bin/sh
# Small script to setup the HBase tables used by OpenTSDB.

HBASE_HOME=/opt/cloudera/parcels/CDH-6.3.2-1.cdh6.3.2.p0.1605554/lib/hbase
COMPRESSION=SNAPPY

test -n "$HBASE_HOME" || {
  echo >&2 'The environment variable HBASE_HOME must be set'
  exit 1
}
test -d "$HBASE_HOME" || {
  echo >&2 "No such directory: HBASE_HOME=$HBASE_HOME"
  exit 1
}

TSDB_TABLE=${TSDB_TABLE-'tsdb'}
UID_TABLE=${UID_TABLE-'tsdb-uid'}
TREE_TABLE=${TREE_TABLE-'tsdb-tree'}
META_TABLE=${META_TABLE-'tsdb-meta'}
BLOOMFILTER=${BLOOMFILTER-'ROW'}
# LZO requires lzo2 64bit to be installed + the hadoop-gpl-compression jar.
COMPRESSION=${COMPRESSION-'LZO'}
# All compression codec names are upper case (NONE, LZO, SNAPPY, etc).
COMPRESSION=`echo "$COMPRESSION" | tr a-z A-Z`
# DIFF encoding is very useful for OpenTSDB's case that many small KVs and common prefix.
# This can save a lot of storage space.
DATA_BLOCK_ENCODING=${DATA_BLOCK_ENCODING-'DIFF'}
DATA_BLOCK_ENCODING=`echo "$DATA_BLOCK_ENCODING" | tr a-z A-Z`
TSDB_TTL=${TSDB_TTL-'FOREVER'}

case $COMPRESSION in
  (NONE|LZO|GZIP|SNAPPY)  :;;  # Known good.
  (*)
    echo >&2 "warning: compression codec '$COMPRESSION' might not be supported."
    ;;
esac

case $DATA_BLOCK_ENCODING in
  (NONE|PREFIX|DIFF|FAST_DIFF|ROW_INDEX_V1)  :;; # Know good
  (*)
    echo >&2 "warning: encoding '$DATA_BLOCK_ENCODING' might not be supported."
    ;;
esac

# HBase scripts also use a variable named `HBASE_HOME', and having this
# variable in the environment with a value somewhat different from what
# they expect can confuse them in some cases.  So rename the variable.
hbh=$HBASE_HOME
unset HBASE_HOME
exec "$hbh/bin/hbase" shell <<EOF
create '$UID_TABLE',
  {NAME => 'id', COMPRESSION => '$COMPRESSION', BLOOMFILTER => '$BLOOMFILTER', DATA_BLOCK_ENCODING => '$DATA_BLOCK_ENCODING'},
  {NAME => 'name', COMPRESSION => '$COMPRESSION', BLOOMFILTER => '$BLOOMFILTER', DATA_BLOCK_ENCODING => '$DATA_BLOCK_ENCODING'}

create '$TSDB_TABLE',
  {NAME => 't', VERSIONS => 1, COMPRESSION => '$COMPRESSION', BLOOMFILTER => '$BLOOMFILTER', DATA_BLOCK_ENCODING => '$DATA_BLOCK_ENCODING', TTL => '$TSDB_TTL'}
  
create '$TREE_TABLE',
  {NAME => 't', VERSIONS => 1, COMPRESSION => '$COMPRESSION', BLOOMFILTER => '$BLOOMFILTER', DATA_BLOCK_ENCODING => '$DATA_BLOCK_ENCODING'}
  
create '$META_TABLE',
  {NAME => 'name', COMPRESSION => '$COMPRESSION', BLOOMFILTER => '$BLOOMFILTER', DATA_BLOCK_ENCODING => '$DATA_BLOCK_ENCODING'}
EOF

创建成功

[root@ecs tools]# sh create_table.sh 
HBase Shell
Use "help" to get list of supported commands.
Use "exit" to quit this interactive shell.
For Reference, please visit: http://hbase.apache.org/2.0/book.html#shell
Version 2.1.0-cdh6.3.2, rUnknown, Fri Nov  8 05:44:07 PST 2019
Took 0.0006 seconds                                                                                                                                                                                
create 'tsdb-uid',
  {NAME => 'id', COMPRESSION => 'SNAPPY', BLOOMFILTER => 'ROW', DATA_BLOCK_ENCODING => 'DIFF'},
  {NAME => 'name', COMPRESSION => 'SNAPPY', BLOOMFILTER => 'ROW', DATA_BLOCK_ENCODING => 'DIFF'}
Created table tsdb-uid
Took 1.0398 seconds                                                                                                                                                                                
Hbase::Table - tsdb-uid

create 'tsdb',
  {NAME => 't', VERSIONS => 1, COMPRESSION => 'SNAPPY', BLOOMFILTER => 'ROW', DATA_BLOCK_ENCODING => 'DIFF', TTL => 'FOREVER'}
Created table tsdb
Took 0.7233 seconds                                                                                                                                                                                
Hbase::Table - tsdb
  
create 'tsdb-tree',
  {NAME => 't', VERSIONS => 1, COMPRESSION => 'SNAPPY', BLOOMFILTER => 'ROW', DATA_BLOCK_ENCODING => 'DIFF'}
Created table tsdb-tree
Took 0.7198 seconds                                                                                                                                                                                
Hbase::Table - tsdb-tree
  
create 'tsdb-meta',
  {NAME => 'name', COMPRESSION => 'SNAPPY', BLOOMFILTER => 'ROW', DATA_BLOCK_ENCODING => 'DIFF'}
Created table tsdb-meta
Took 0.7197 seconds                                                                                                                                                                                
Hbase::Table - tsdb-meta

启动TSDB

nohup sh /usr/share/opentsdb/bin/tsdb tsd >tsdb-start.log &

 访问页面

 

OpenTSDB 安装_github

 

写入数据

上面如果没有设置 tsd.core.auto_create_metrics = true 参数时,需要手动创建 metric

tsdb mkmetric sys.cpu.user

否则会提示异常如下

[root@ecs-t-001-0002 ~]# telnet ip port
Escape character is '^]'.
put sys.cpu.user 1588302377 42.5 host=webserver01 cpu=0
put: unknown metric: No such name for 'metrics': 'sys.cpu.user'

 

加入两条数据,我们使用 telnet 方式添加数据,

put sys.cpu.user 1588292377 45.5 host=webserver01 cpu=0
put sys.cpu.user 1588302377 41.5 host=webserver01 cpu=0

 

再web页面我们简单查询看一下数据,右下角的一根线就是我们刚刚插入的两个点连成的线

OpenTSDB 安装_数据_02

这回我们插入四条数据,写入两个host

put sys.cpu.user 1588292377 45.5 host=webserver01 cpu=0
put sys.cpu.user 1588302377 41.5 host=webserver01 cpu=0
put sys.cpu.user 1588292377 12.5 host=webserver02 cpu=0
put sys.cpu.user 1588302377 80.5 host=webserver02 cpu=0

我们再指定tags查询看看效果,指定webserver02小时如下,结果是从12.5-80.5两个点没问题

OpenTSDB 安装_ci_03

看下webserver01,数据也没问题

OpenTSDB 安装_ci_04

至此,服务安装与初步使用介绍完成,下一步介绍下Api接口使用

 

 

 

标签:COMPRESSION,ENCODING,DATA,opentsdb,OpenTSDB,安装,tsdb,BLOCK
From: https://blog.51cto.com/u_13721902/6249918

相关文章

  • ubuntu安装redis
    redis是C语言编写的一款非关系型数据库,使用键值对存储数据,数据缓存在内存中首先下载安装redis,并测试是否安装正确wgethttp://download.redis.io/releases/redis-6.0.8.tar.gztar-zxvfredis-6.0.8.tar.gzcdredis-6.0.8makemaketest如果make失败,则需要升级gcc如果mak......
  • 消息队列Rabbitmq介绍、rabbitmq安装、基于queue实现生产者消费者、基本使用、消息安
    目录1消息队列Rabbitmq介绍2rabbitmq安装3基于queue实现生产者消费者4基本使用4.1发送者4.2消费者5消息安全(详见笔记)6持久化(详见笔记)7闲置消费(详见笔记)8发布订阅(详见笔记)9发布订阅高级之Routing(按关键字匹配)(详见笔记)1消息队列Rabbitmq介绍#消息队列 -......
  • ubuntu x64 安装java 7
    安装步骤来自社区:https://help.ubuntu.com/community/Java中的http://askubuntu.com/questions/56104/how-can-i-install-sun-oracles-proprietary-java-6-7-jre-or-jdk因为是初次安装.所以,提示会不一样.简单的操作完成后.就可以使用了.安装jdk也一样的道理.操作完全可都一样.htt......
  • conda 安装pytorch新环境
    1.创建环境condacreate-npytorch1.7.1python=3.72.安装pytorch安装pytorch官网上面安装指令https://pytorch.org/get-started/previous-versions/condainstallpytorch==1.7.1torchvision==0.8.2cudatoolkit=11.0-cpytorch##torchaudio==0.7.2语言的不需要......
  • Wireshark的安装及基本使用【计算机网络】
    Wireshark的安装与基本使用【计算机网络】前言推荐Wireshark的安装与基本使用一、下载二、安装三、使用技巧四、简单使用4.1捕获4.2简单介绍4.3过滤问题最后前言2023-5-420:51:42以下内容源自《【计算机网络】》仅供学习交流使用推荐Wireshark的下载安装及简单使用教程链接:ht......
  • Ubuntu 安装 Docker Engine 并配置用户权限
    1.删除旧版本Docker,没有可以跳过sudoapt-getremovedockerdocker-enginedocker.iocontainerdrunc2.更新apt包索引并安装包,以允许apt通过HTTPS使用存储库sudoapt-getupdatesudoapt-getinstallca-certificatescurlgnupg3.使用以下命令设置存储库echo\"d......
  • Centos7下的pm2环境离线安装
    一、下载node离线包并安装官网:https://nodejs.org/en/download/根据操作系统类型下载指定包:wget https://nodejs.org/dist/v16.20.0/node-v16.20.0-linux-x64.tar.xz解压:tar-xvfnode-v16.20.0-linux-x64.tar.xz 移动到指定目录并重新命名为nodemvnode-v16.20.0-linux-x64......
  • 安装msi软件报错:The installer has encountered an unexpected error installing this
    因为安装权限不足以管理员身份运行cmd运行安装命令msiexec/package"E:\xxx\charles-proxy-4.6.4-win64.msi"......
  • GPT4free安装部署教程 - 白嫖GPT
    前言为啥之前一直没有更新GPT相关的内容,因为个人觉得如果每次都需要使用付费使用API的话,那这个工具还是很难在个人手上被运用起来,多测试几次关键字和清洗数据,API的费用对个人来说都太高昂了直到GPT4free出现公众号后台回复1002,获取GPT试用网址部署使用直接开始部署吧,别像其他文......
  • 虚拟机安装VMware tools
    点击虚拟机上的安装:打开虚拟机了再点击在虚拟机上安装VMwaretools:图中是安装后的在主机上新建一个文件夹并设置共享在VMware上设置要共享的主机文件夹虚拟机中出现共享文件夹......