1.編輯啓動腳本 cat start_tsdb.sh
OPENTSDB_HOME=/data/opentsdb
JVMARGS="${JVMARGS} -Djava.security.auth.login.config=${OPENTSDB_HOME}/jaas.conf -Dzookeeper.sasl.client=false" ./tsdb tsd --config=${OPENTSDB_HOME}/opentsdb.conf --zkquorum=IP1,IP2,IP3
2.編輯jaas.conf 配置
Client {
com.sun.security.auth.module.Krb5LoginModule required
useKeyTab=true
useTicketCache=true
keyTab="/data/username/test.keytab"
principal="[email protected]";
};
編輯 opentsdb.conf
tsd.network.port = 14242
# Number of worker threads dedicated to Netty, defaults to # of CPUs * 2
tsd.network.worker_threads = 24
tsd.http.staticroot = /usr/share/opentsdb/static/
tsd.http.cachedir = /tmp/opentsdb
tsd.storage.hbase.zk_basedir = /hbase
tsd.core.auto_create_metrics = true
tsd.core.plugin_path = /usr/share/opentsdb/plugins
# --------- STORAGE ----------
# Whether or not to enable data compaction in HBase, default is True
#tsd.storage.enable_compaction = true
# Name of the HBase table where data points are stored, default is "tsdb"
#tsd.storage.hbase.data_table = tsdb
tsd.storage.salt.width = 1
tsd.storage.salt.buckets = 16
tsd.storage.hbase.data_table = namespace:tsdb-test
tsd.storage.hbase.uid_table = namespace:tsdb-uid-test
tsd.core.uid.random_metrics = true
tsd.storage.enable_appends = true
hbase.zookeeper.quorum=IP1,IP2,IP3
hbase.zookeeper.znode.parent=/hbase
hbase.security.auth.enable=true
hbase.security.authentication=kerberos
hbase.security.simple.username=test
hbase.kerberos.regionserver.principal=hbase/[email protected]
hbase.sasl.clientconfig=Client
tsd.http.request.enable_chunked=true
tsd.http.request.max_chunk = 65536
4.opentsdb寫熱點問題
Opentsdb當中,存儲數據表的表名字叫做tsdb表,tsdb表的行健結構是
指標UID(指標+標籤的某個組合)+ 數據生成時間(取整小時)+標籤1-Key的UID+標籤1-Vlaue的UID+…+標籤N-Key的UID+標籤N-Vlaue的UID,
所以可以根據自己的監控指標建表時預分區