安裝opentsdb
一、安裝hbase
1、下載安裝包
官方下載地址:http://hbase.apache.org/downloads.html
也可以去鏡像下載
wget https://mirrors.ustc.edu.cn/apache/hbase/2.2.2/hbase-2.2.2-bin.tar.gz
2、解壓安裝包
tar -xvf hbase-2.2.2-bin.tar.gz
3、修改配置文件
vim conf/hbase-env.sh
export JAVA_HOME=/opt/java/jdk1.8.0_131 ##指定Java環境
export HBASE_MANAGES_ZK=true ##使用hbase自帶的zookeeper
vim conf/hbase-site.xml 將文件中<configuration>按照下面配置即可
<configuration>
<property>
<name>hbase.rootdir</name>
<value>file:///home/testuser/hbase</value> ##指定hbase的根目錄
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/home/testuser/zookeeper</value> ##指定zookeeper的目錄
</property>
<property>
<name>hbase.unsafe.stream.capability.enforce</name>
<value>false</value>
</property>
</configuration>
vim /etc/profile ##添加環境變量,完成之后,source /etc/profile生效
export HBASE_HOME=/data/hbase-2.2.2 ##hbase安裝路徑
export PATH=$HBASE_HOME/bin:$PATH
4、啟動
./bin/start-hbase.sh ##正常啟動之后可以訪問http://ip:16010端口
二、安裝opentsdb
1、下載安裝包
下載地址:https://github.com/OpenTSDB/opentsdb/releases
下載自己需要的版本
2、安裝
我這里直接使用rpm安裝
yum install https://github.com/OpenTSDB/opentsdb/releases/download/v2.4.0/opentsdb-2.4.0.noarch.rpm -y
之后會幫助安裝依賴包,完成后,會安裝到/usr/share/opentsdb下
安裝好之后做幾個軟連接方便管理
ln -s /usr/share/opentsdb/etc/init.d/opentsdb /etc/init.d/
ln -s /usr/share/opentsdb/etc/systemd/system/opentsdb@.service /etc/systemd/system/
ln -s /usr/share/opentsdb/etc/opentsdb/* /etc/opentsdb/
ln -s /usr/share/opentsdb/bin/tsdb /usr/bin/
3、修改配置文件
vim /etc/opentsdb/opentsdb.conf
tsd.network.port = 4242 ##opentsdb監聽端口
tsd.http.staticroot = /usr/share/opentsdb/static/ ##tsdb頁面資源路徑
tsd.http.cachedir = /tmp/opentsdb ##緩存文件路徑
tsd.core.auto_create_metrics = true
tsd.core.plugin_path = /usr/share/opentsdb/plugins
tsd.core.tag.allow_specialchars = :!@#$%^&*()_+{}[]?><:"';/.,-=`~\|. ##數據中允許的特殊字符
tsd.core.auto_create_metrics = true ##允許創建metrics
tsd.storage.hbase.zk_quorum = 127.0.0.1:2181 ##安裝hbase的監聽端口
4、建表 ##注意!!不建表啟動會報錯,啟動不成功的!!!
cd /usr/share/opentsdb/tools/
env COMPRESSION=NONE ./create_table.sh
5、啟動
service opentsdb start
##正常啟動之后可以訪問http://ip:4242端口