OpenTsDb安裝

weixin_33727510發表於2018-11-23

1.版本

zookeeper: 3.4.10
hbase: 1.2.6單機安裝
opentsdb: 2.3.1


2.安裝

1.安裝zookeeper + hbase單機版地址

https://www.jianshu.com/p/8387d891eb1f

2.安裝opentsdb
1.解壓編譯

進入上傳目錄cd /usr/local
解壓tar -zxvf opentsdb-2.3.1.tar.gz -C /usr/local
進入解壓目錄cd /usr/local/opentsdb-2.3.1
編譯./build.sh
編譯報錯如下

sd/BadRequestException.java ../src/tsd/ConnectionManager.java ../src/tsd/DropCachesRpc.java ../src/tsd/GnuplotException.java ../src/tsd/GraphHandler.java ../src/tsd/HttpJsonSerializer.java ../src/tsd/HttpSerializer.java ../src/tsd/HttpQuery.java ../src/tsd/HttpRpc.java ../src/tsd/HttpRpcPlugin.java ../src/tsd/HttpRpcPluginQuery.java ../src/tsd/LineBasedFrameDecoder.java ../src/tsd/LogsRpc.java ../src/tsd/PipelineFactory.java ../src/tsd/PutDataPointRpc.java ../src/tsd/QueryExecutor.java ../src/tsd/QueryRpc.java ../src/tsd/RpcHandler.java ../src/tsd/RpcPlugin.java ../src/tsd/RpcManager.java ../src/tsd/RpcUtil.java ../src/tsd/RTPublisher.java ../src/tsd/SearchRpc.java ../src/tsd/StaticFileRpc.java ../src/tsd/StatsRpc.java ../src/tsd/StorageExceptionHandler.java ../src/tsd/SuggestRpc.java ../src/tsd/TelnetRpc.java ../src/tsd/TreeRpc.java ../src/tsd/UniqueIdRpc.java ../src/tsd/WordSplitter.java ../src/uid/FailedToAssignUniqueIdException.java ../src/uid/NoSuchUniqueId.java ../src/uid/NoSuchUniqueName.java ../src/uid/RandomUniqueId.java ../src/uid/UniqueId.java ../src/uid/UniqueIdFilterPlugin.java ../src/uid/UniqueIdInterface.java ../src/utils/ByteArrayPair.java ../src/utils/ByteSet.java ../src/utils/Config.java ../src/utils/DateTime.java ../src/utils/Exceptions.java ../src/utils/FileSystem.java ../src/utils/JSON.java ../src/utils/JSONException.java ../src/utils/Pair.java ../src/utils/PluginLoader.java ../src/utils/Threads.java ../src/tools/BuildData.java ./src/net/opentsdb/query/expression/parser/*.java
javac: file not found: ./src/net/opentsdb/query/expression/parser/*.java
Usage: javac <options> <source files>
use -help for a list of possible options
make[1]: *** [.javac-stamp] Error 2
make[1]: Leaving directory `/usr/local/opentsdb-2.3.0/build'
make: *** [all] Error 2

解決方法,建立build目錄,拷貝third_partybuild目錄,再次執行./build
mkdir build
cp -r third_party ./build
./build.sh

2.建立表

執行指令碼,在hbase中建立opentsdb相關表
env COMPRESSION=NONE HBASE_HOME=/usr/local/hbase-1.2.6 ./src/create_table.sh
進入hbase目錄cd /usr/local/hbase-1.2.6/bin
進入hbase控制檯hbase shell
檢視是否建立了表list

7176245-90f87467608e896f.png
opentsdb建立的表

3.opentsdb配置

進入opentsdb目錄cd /usr/local/opentsdb-2.3.1
移動confbuild目錄mv opentsdb.conf build/opentsdb.conf
配置conf,配置含義可以自行百度

# --------- NETWORK ----------
# The TCP port TSD should use for communications
# *** REQUIRED ***
tsd.network.port = 4242

# The IPv4 network address to bind to, defaults to all addresses
#tsd.network.bind = 0.0.0.0

# Disable Nagel's algorithm, default is True
#tsd.network.tcp_no_delay = true

# Determines whether or not to send keepalive packets to peers, default
# is True
tsd.network.keep_alive = true

# Determines if the same socket should be used for new connections, default
# is True
#tsd.network.reuse_address = true

# Number of worker threads dedicated to Netty, defaults to # of CPUs * 2
#tsd.network.worker_threads = 8

# Whether or not to use NIO or tradditional blocking IO, defaults to True
#tsd.network.async_io = true

# ----------- 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 = /usr/local/opentsdb-2.3.1/cache

# --------- CORE ----------
# Whether or not to automatically create UIDs for new metric types, default
# is False
tsd.core.auto_create_metrics = true

# Whether or not to enable the built-in UI Rpc Plugins, default
# is True
#tsd.core.enable_ui = true

# Whether or not to enable the built-in API Rpc Plugins, default
# is True
#tsd.core.enable_api = true

# --------- STORAGE ----------
# Whether or not to enable data compaction in HBase, default is True
#tsd.storage.enable_compaction = true

# How often, in milliseconds, to flush the data point queue to storage,
# default is 1,000
# tsd.storage.flush_interval = 1000

# Max number of rows to be returned per Scanner round trip
# tsd.storage.hbase.scanner.maxNumRows = 128

# Name of the HBase table where data points are stored, default is "tsdb"
tsd.storage.hbase.data_table = tsdb

# Name of the HBase table where UID information is stored, default is "tsdb-uid"
#tsd.storage.hbase.uid_table = tsdb-uid

# 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 = localhost:2181

# --------- COMPACTIONS ---------------------------------
# Frequency at which compaction thread wakes up to flush stuff in seconds, default 10
# tsd.storage.compaction.flush_interval = 10

# Minimum rows attempted to compact at once, default 100
# tsd.storage.compaction.min_flush_threshold = 100

# Maximum number of rows, compacted concirrently, default 10000
# tsd.storage.compaction.max_concurrent_flushes = 10000

# Compaction flush speed multiplier, default 2
# tsd.storage.compaction.flush_speed = 2

3.啟動&測試

預先啟動zookeeper和hbase,參考上方安裝連結
進入build目錄cd /usr/local/opentsdb-2.3.1/build
啟動./tsdb tsd &
ctrl + c退出控制檯jps檢視程式

7176245-72196511bc1ea1be.png
opentsdb程式

4.叢集

需要預先啟動hadoop + hbase叢集
每臺機器重複上方配置啟動即可,連線地址根據叢集情況填寫

相關文章