tonglin0325的个人主页

Ubuntu16.04安装opentsdb2.4.1

官方文档

1
2
https://github.com/OpenTSDB/opentsdb/wiki/Installation-on-Cloudera-Virtual-Machine

opentsdb的安装依赖Hbase,本文中使用的是CDH5.16.2中的Hbase 1.2.0+cdh5.16.2

1.git clone

1
2
git clone https://github.com/OpenTSDB/opentsdb.git

2.安装

1
2
3
4
cd opentsdb
./build.sh
env COMPRESSION=none HBASE_HOME=/opt/cloudera/parcels/CDH/lib/hbase ./src/create_table.sh

如果Hbase启用了kerberos,则需要先认证

1
2
kinit -kt ~/下载/hbase.keytab hbase/master@HADOOP.COM

上面的脚本会在hbase中初始化4张table

1
2
3
4
5
6
7
8
9
10
hbase(main):004:0> list
TABLE
tsdb
tsdb-meta
tsdb-tree
tsdb-uid
4 row(s) in 0.0370 seconds

=> ["tsdb", "tsdb-meta", "tsdb-tree", "tsdb-uid"]

如果遇到

1
2
3
4
5
create 'tsdb',
{NAME => 't', VERSIONS => 1, COMPRESSION => 'NONE', BLOOMFILTER => 'ROW', DATA_BLOCK_ENCODING => 'DIFF', TTL => 'FOREVER'}

ERROR: For input string: "FOREVER"

请修改 create_table.sh 脚本

1
2
lintong@master:~/software/opentsdb/src$ vim create_table.sh

将 TSDB_TTL=${TSDB_TTL-‘FOREVER’} 修改成 TSDB_TTL=${TSDB_TTL-‘2147483647’}

如果你的hbase开启了kerberos,则需要

1
2
mv ./src/opentsdb.conf ./build/

然后编译opentsdb.conf配置文件,添加KERBEROS相关配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 --------- NETWORK ----------
# The TCP port TSD should use for communications
# *** REQUIRED ***
tsd.network.port = 10015

# ----------- HTTP -----------
# The location of static files for the HTTP GUI interface.
# *** REQUIRED ***
tsd.http.staticroot = ./staticroot
# Where TSD should write it's cache files to
# *** REQUIRED ***
tsd.http.cachedir = /tmp/tsd

# --------- CORE ----------
# Whether or not to automatically create UIDs for new metric types, default
# is False
tsd.core.auto_create_metrics = true
# Name of the HBase table where data points are stored, default is "tsdb"
tsd.storage.hbase.data_table = tsdb
# Path under which the znode for the -ROOT- region is located, default is "/hbase"
tsd.storage.hbase.zk_basedir = /hbase
# A comma separated list of Zookeeper hosts to connect to, with or without
# port specifiers, default is "localhost"
tsd.storage.hbase.zk_quorum = master

#-------- KERBEROS -----
hbase.security.auth.enable=true
hbase.security.authentication=kerberos
hbase.sasl.clientconfig=Client
hbase.kerberos.regionserver.principal=hbase/_HOST@HADOOP.COM

同时添加jass文件

1
2
3
4
5
6
7
8
9
10
11
lintong@master:~/software/opentsdb/build/jaas$ ls
jaas.conf
lintong@master:~/software/opentsdb/build/jaas$ cat jaas.conf
Client {
com.sun.security.auth.module.Krb5LoginModule required
useKeyTab=true
useTicketCache=false
keyTab="/home/lintong/下载/hbase.keytab"
principal="hbase/master@HADOOP.COM";
};

参考:OpenTSDB搭建过程(CDH环境,kerberos认证)

HBase 1.1.2.2.6.0.3-8 TTL设置过之后,无法显示重置为FOREVER

3.创建缓存目录

1
2
mkdir /tmp/tsd

4.启动opentsdb

1
2
lintong@master:~/software/opentsdb/build$ JVMARGS="-Djava.security.auth.login.config=/home/lintong/software/opentsdb/build/jaas/jaas.conf -Dzookeeper.sasl.client=false" ./tsdb tsd

也可以添加到./tsdb启动脚本中

5.访问,我的是10015端口