安装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
[root@redoop 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