天天看點

Opentsdb 2.4.0安裝

安裝opentsdb

一、下載下傳opentsdb-2.4.0.noarch.rpm

二、執行yum localinstall opentsdb-2.4.0RC2.noarch.rpm

三、配置

1、vim /etc/opentsdb/opentsdb.conf

# default value is "/hbase", change it according to your cluster configuration

hbase在zookeeper中的注冊路徑位置

tsd.storage.hbase.zk_basedir = /hbase

# change it according to your cluster configuration

tsd.storage.hbase.zk_quorum = localhost:2181

# not requried, it can help you insert data immediately without registering metrics first

tsd.core.auto_create_metrics = true

四、初始化資料庫

建立'tsdb-uid','tsdb','tsdb-tree','tsdb-meta'四個HBASE資料庫表     (opentsdb技術内幕p13)

create 'tsdb-uid',{NAME => 'id', COMPRESSION => 'SNAPPY', BLOOMFILTER => 'ROW'},{NAME => 'name', COMPRESSION => 'SNAPPY', BLOOMFILTER => 'ROW'}

create 'tsdb',{NAME => 't',VERSIONS=>1, COMPRESSION => 'SNAPPY', BLOOMFILTER => 'ROW'}

create 'tsdb-tree',{NAME => 't',VERSIONS=>1, COMPRESSION => 'SNAPPY', BLOOMFILTER => 'ROW'}

create 'tsdb-meta',{NAME => 'name', COMPRESSION => 'SNAPPY', BLOOMFILTER => 'ROW'}

五、直接啟動 service opentsdb start 報錯 Failed

[[email protected] apps]# service opentsdb start

Reloading systemd: [ OK ]

Starting opentsdb (via systemctl): Failed to start opentsdb.service: Unit opentsdb.service failed to load: No such file or directory

. [FAILED]

解決辦法:

https://mythinkpond.com/2016/03/23/how-to-configure-opentsdb-or-any-process-as-a-service-in-centos-7/

Step-1: Create CentOS 7 Service file:

1、vim /usr/lib/systemd/system/opentsdb.service

[Unit]

Description=OpenTSDB Service

After=network.target hbase.service

[Service]

Type=forking

PrivateTmp=yes

ExecStart=/usr/share/opentsdb/etc/init.d/opentsdb start

ExecStop=/usr/share/opentsdb/etc/init.d/opentsdb stop

Restart=on-abort

[Install] WantedBy=multi-user.target

配置opentsdb的java環境

2、vim /usr/bin/tsdb

export PATH=$PATH:/usr/java/jdk1.8.0_141-cloudera/bin自己java的路徑 

Step-2: Let’s test the start and stop of this new OpenTSDB service

$ sudo systemctl start opentsdb

# If it starts up good, you should see the website when you goto

http://<servername>:4242/ ps -leaf | grep "tsdb"

# shows you something similar then you can add it as a service to auto-start

sudo systemctl enable opentsdb

六、.器通路 localhost:4242

本文參考原文:https://note.youdao.com/ynoteshare1/index.html?id=1d07a3be3eb6651bb167a0c52a3b383f&type=note?auto

繼續閱讀