---
title: 编译验证
description: "前提条件：InfluxDB已经安装并初始化成功。InfluxDB安装及初始化请参考《InfluxDB 2.0.3 移植指南(https://www.hikunpeng.com/document/detail/zh/kunpengdbs/ecosystemEnable/InfluxDB/openmind_influxdb203_02_0001.html)》。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengdbs/ecosystemEnable/Kapacitor/openmind_kapacitor15_03_0022.html
sourcePath: /source/zh/kunpengdbs/ecosystemEnable/Kapacitor/openmind_kapacitor15_03_0022.html
indexId: 10d93ac99c92b005f765fabf61d4c761c31280a921607bd3e6ece653cadb068381
---
# 编译验证

#### 配置InfluxDB

前提条件：InfluxDB已经安装并初始化成功。InfluxDB安装及初始化请参考《InfluxDB 2.0.3 移植指南(https://www.hikunpeng.com/document/detail/zh/kunpengdbs/ecosystemEnable/InfluxDB/openmind_influxdb203_02_0001.html)》。

1. 进入Influxdb编译目录。
  1 cd /opt/db/influxdb

2. 在InfluxDB中创建一个名为kapasts的Bucket。-r 9h表示数据的保留时间为9小时。
  1 ./influx bucket create -n kapasts -r 9h

  查看bucket。 1 ./influx bucket list 删除bucket。 1 ./influx bucket delete --name kapasts

3. 创建用于Kapacitor连接的用户。ID请根据实际情况修改。
  1 ./influx v1 auth create --username kapa --password 123456 --write-bucket ID --read-bucket ID

4. 创建用户kapacitor连接的DBRP。ID请根据实际情况修改。
  1 ./influx v1 dbrp create --bucket-id ID --db kapadb --rp rpv2 --default

  查看DBRP。 1 ./influx v1 dbrp list 删除DBRP。 1 ./influx v1 dbrp delete --id ID


#### 配置kapacitor

前提条件：Kapacitor已经安装成功但未启动。

1. 进入kapacitor编译目录。
  1 cd /opt/tool/code/src/github.com/influxdata/kapacitor

2. 编译安装没有默认的配置文件，通过以下命令生成初始配置文件。
  1 2 mkdir /etc/kapacitor/ ./kapacitord config > /etc/kapacitor/kapacitor.conf

3. 修改kapacitor配置文件，修改后内容详见以下截图。其中urls为influxdb服务的IP地址和端口，username、password为influx v1 auth create命令中的用户名和密码，disable-subscriptions修改为true，subscriptions-mode为cluster。

```
vi /etc/kapacitor/kapacitor.conf
```


  1 2 disable-subscriptions = true subscriptions-mode = cluster

4. 关闭Kapacitor服务。PID请根据实际情况修改。
  1 2 ps -ef | grep kapacitord kill -9 PID

5. 启动kapacitor服务。
  1 nohup ./kapacitord &


#### 验证kapacitor基本功能

1. 进入kapacitor编译目录。
  1 cd /opt/tool/code/src/github.com/influxdata/kapacitor

2. 查询数据库状态。
  1 2 ./kapacitor stats general ./kapacitor stats ingress

3. 查询数据库信息。
  1 ./kapacitor list tasks
