Go实操-Kafka+Influxdb+Grafana实现系统监控

Posted nurruden

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Go实操-Kafka+Influxdb+Grafana实现系统监控相关的知识,希望对你有一定的参考价值。

1. 安装Influxdb:https://blog.csdn.net/v6543210/article/details/84134403,

wget https://dl.influxdata.com/influxdb/releases/influxdb_1.6.4_amd64.deb
 
sudo dpkg -i influxdb_1.6.4_amd64.deb

  

2. 安装grafana.http://docs.grafana.org/installation/debian/.

wget https://dl.grafana.com/oss/release/grafana_5.4.2_amd64.deb
sudo apt-get install -y adduser libfontconfig
sudo dpkg -i grafana_5.4.2_amd64.deb

3. 安装Go.

1.下载golang安装包,请自行下载

2.设置安装目录

export GO_INSTALL_DIR=$HOME

3.解压go安装包

tar -xvzf go1.11.4.linux-amd64.tar.gz -C $GO_INSTALL_DIR

4.设置环境变量,可以将环境变量追加到~/.bashrc后面,这样就不用每次都设置环境变量了

export GO_INSTALL_DIR=$HOME
export GOROOT=$GO_INSTALL_DIR/go
export GOPATH=$HOME/mygo
export PATH=$GOPATH/bin:$PATH:$GO_INSTALL_DIR/go/bin

5. 检查go安装是否成功:

[email protected]:~/Downloads$ go version
go version go1.11.4 linux/amd64

6. 创建src目录

mkdir -p $GOPATH/src

4. 安装JDK https://www.cnblogs.com/expiator/p/9987351.html

  1. 下载jdk https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

  2. 创建java目录

  

sudo mkdir -p /usr/local/java

  3. 解压文件到java目录

sudo tar zvxf jdk-8u191-linux-x64.tar.gz -C /usr/local/java

  4. 配置环境变量 在 /etc/profile后追加

  

export JAVA_HOME=/usr/local/java/jdk1.8.0_191
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

  5. 使/etc/profile生效  :source /etc/profile

  6. 测试jdk安装是否成功 java -version

5. 安装zookeeper https://www.cnblogs.com/expiator/p/9853378.html

  1.  cd /usr/local && wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.13/zookeeper-3.4.13.tar.gz 

  2.  解压  sudo tar -zxvf zookeeper-3.4.13.tar.gz

  3. 进入conf目录 cd zookeeper-3.4.13/conf

  4. 将zoo_sample.cfg复制为zoo.cfg  cp zoo_sample.cfg zoo.cfg

       5.在zoo.cfg中加入下面两行:

  

dataDir=/tmp/zookeeper/data
dataLogDir=/tmp/zookeeper/log

  6. 创建data,log目录

  

[email protected]:/usr/local/zookeeper-3.4.13/conf$ sudo mkdir -p /tmp/zookeeper/data
[email protected]:/usr/local/zookeeper-3.4.13/conf$ sudo mkdir -p /tmp/zookeeper/log

  7. 配置环境变量

  

export PATH=$PATH:$ZOOKEEPER_INSTALL/bin

  8. 启动ZK,此处需要root用户来启动 sudo -i

  

[email protected]:/usr/local/zookeeper-3.4.13/bin$ sudo ./zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper-3.4.13/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

  9.启动ZK client  sudo ./zkCli.sh

6. 安装kafka http://www.cnblogs.com/expiator/p/9990171.html

  1.  下载 wget http://apache.01link.hk/kafka/2.0.0/kafka_2.11-2.0.0.tgz

  2.  解压

  

mkdir /usr/local/kafka
tar -xzfz kafka_2.11-2.0.0.tgz -C /usr/local/kafka

  3. 启动zookeeper

bin/zookeeper-server-start.sh  config/zookeeper.properties 

  4.启动kafka

bin/kafka-server-start.sh config/server.properties

  

以上是关于Go实操-Kafka+Influxdb+Grafana实现系统监控的主要内容,如果未能解决你的问题,请参考以下文章

kafka监控实战(jmxtrans+InfluxDb+Grafana)

Go操作influxDB

How Hulu Uses InfluxDB and Kafka to Scale to Over 1 Million Metrics a Second

[Go] 时序数据库influxdb的安装

influxDB

实操docker搭建kafka集群及与PHP的整合