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