opentsdb單機版安裝
環境要求:
作業系統 linux
Java 1.6以上
HBase 0.92以上
GnuPlot 4.2以上
編譯安裝還需要安裝Autotools、Make、Python、Git
並且連線外網
實驗環境:
Xubuntu16.04 x86_64
IP: 10.49.2.239
VirtualBox5.2.8 橋接模式
- 安裝單機zookeeper
tar zxf zookeeper-3.4.13.tar.gz -C /opt/ mv zookeeper-3.4.13 /opt/zookeeper
cp /opt/zookeeper/conf/ zoo_sample.cfg /opt/zookeeper/conf/ zoo.cfg vi conf/zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/tmp/zookeeper
clientPort=2181
啟動zookeeper
/opt/zookeeper/bin/zkServer.sh start
連線zookeeper
/opt/zookeeper/bin/zkCli.sh -server 10.49.2.239:2181
2. 安裝單機hbase
tar zxf hbase-2.1.0-bin.tar.gz –C /opt/
mv /opt/ hbase-2.1.0 /opt/ hbase
mkdir /opt/hbase/logs
mkdir /opt/hbase/data //
vi /opt/hbase/bin/hbase-env.sh 最後追加3行:
export JAVA_HOME=/opt/jdk
export PATH=${JAVA_HOME}/bin:$PATH
export HBASE_MANAGES_ZK=false
vi /opt/hbase/conf/hbase-site.xml 新增紅色部分的程式碼:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>hbase.rootdir</name>
<value>/opt/hbase/data/</value>
</property>
<property>
<name>hbase.master.info.port</name>
<value>16001</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value> <!-- false是單機模式,true是分散式模式。若為false,Hbase和Zookeeper會執行在同一個JVM裡面。-->
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>localhost:2181</value>
</property>
</configuration>
vi /opt/hbase/conf/regionservers 內容如下: localhost 注意regionservers 裡面寫的內容和上面的hbase.zookeeper.quorum裡面的hostname一樣。
啟動hbase:
/opt/hbase/bin/start-hbase.sh 即可啟動hbase
驗證:
ss –lnt | grep 16001 ps aux|grep hbase
補充,HDFS+hbase+3節點zk的 hbase-site.xml配置檔案寫法:
<configuration>
//設定將資料寫入hdfs的目錄
<property>
<name>hbase.rootdir</name>
<value>hdfs://master:9000/usr/local/hadoop-2.6.0/hbaseData</value>
</property>
//設定hbase模式為叢集模式
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
//設定hbase的master埠地址
<property>
<name>hbase.master</name>
<value>hdfs://master:60000</value>
</property>
//HBase Master web介面繫結的埠,預設為0.0.0.0
<property>
<name>hbase.master.info.port</name>
<value>60010</value>
</property>
//連線zookeeper的埠設定
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2183</value>
</property>
//設定zookeeper的連線地址(必須為基數個)
<property>
<name>hbase.zookeeper.quorum</name>
<value>master,slave1,slave2</value>
</property>
//Zookeeper的zoo.conf中的路徑配置,快照的儲存位置
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/usr/local/zookeeper-3.4.6/data</value>
</property>
//Zookeeper連線超時時間
<property>
<name>zookeeper.session.timeout</name>
<value>60000</value>
</property>
</configuration>
3. 安裝opentsdb
dpkg –i opentsdb-2.3.1_all.deb vi /etc/opentsdb/opentsdb.conf 內容如下:
tsd.network.port = 4242
tsd.network.bind = 0.0.0.0
tsd.network.worker_threads = 8
tsd.http.staticroot = /usr/share/opentsdb/static/
tsd.http.cachedir = /tmp/opentsdb
tsd.core.auto_create_metrics = true
tsd.core.plugin_path = /usr/share/opentsdb/plugins
tsd.storage.hbase.zk_quorum = localhost:2181
啟動之前,需要到hbase上面去建立表:
cd /usr/share/opentsdb/tools
env COMPRESSION=NONE HBASE_HOME=/opt/hbase ./create_table.sh
啟動及驗證: nohup /usr/share/opentsdb/bin/tsdb tsd --config=/etc/opentsdb/opentsdb.conf >/dev/null 2>&1 &
ss -lnt | grep 4242 ps aux|grep opentsdb訪問瀏覽器的http://10.49.2.239:4242
4. 安裝grafana
dpkg –i grafana_5.2.2_amd64.deb
cp /usr/share/grafana/conf/defaults.ini /usr/share/grafana/conf/custom.ini
vi /usr/share/grafana/conf/custom.ini 預設http埠如下:
http_port = 3000
啟動及驗證:
nohup /usr/sbin/grafana-server -homepath="/usr/share/grafana" web >/dev/null 2>&1 &
grafana預設賬號/密碼 admin/admin