一、基础架构
二、相关配置
1、vmstorage配置
[Unit]
Description=Vmstorage Server
After=network.target
[Service]
Type=simple
User=root
Environment=VM_STORAGE_AUTH_USER=admin
Environment=VM_STORAGE_AUTH_PASSWORD=123456
WorkingDirectory=/usr/local/vmagent
ExecStart=/usr/local/vmagent/bin/vmstorage -loggerTimezone Asia/Shanghai -storageDataPath /usr/local/vmagent/data -httpAuth.username=admin -httpAuth.password=123456 -httpListenAddr :8482 -vminsertAddr :8400 -vmselectAddr :8401 -dedup.minScrapeInterval=2m -search.maxUniqueTimeseries=0 -memory.allowedPercent=80
Restart=on-failure
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
2、vmselect配置
[Unit]
Description=Vmselect Server
After=network.target
[Service]
Environment=VM_STORAGE_AUTH_USER=admin
Environment=VM_STORAGE_AUTH_PASSWORD=123456
Environment=VM_STORAGE_Node="http://admin:123456@10.131.122.48:8401"
Restart=on-failure
WorkingDirectory=/usr/local/vmagent
ExecStart=/usr/local/vmagent/bin/vmselect -httpListenAddr :8481 -httpAuth.username=secadmin -httpAuth.password=sec_1@3 -storageNode=10.10.1.8:8401 -vmstorageDialTimeout=300s -dedup.minScrapeInterval=2m -search.maxConcurrentRequests=32 -search.maxUniqueTimeseries=300000000
[Install]
WantedBy=multi-user.target
3、vminsert配置
[Unit]
Description=Vmsinsert Server
After=network.target
[Service]
Type=simple
User=root
Environment=VM_STORAGE_AUTH_USER=admin
Environment=VM_STORAGE_AUTH_PASSWORD=123456
WorkingDirectory=/usr/local/vmagent
ExecStart=/usr/local/vmagent/bin/vminsert -httpListenAddr :8480 -httpAuth.username=insadmin -httpAuth.password=insadmin -storageNode=10.10.1.8:8400 -vmstorageDialTimeout=300s -insert.maxQueueDuration=2m -loggerLevel=WARN
Restart=on-failure
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
4、Prometheus配置
global:
scrape_interval: 15s
evaluation_interval: 15s
remote_write:
- url: "http://10.10.1.8:8480/insert/0/prometheus/api/v1/write"
basic_auth:
username: insadmin
password: insadmin
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
5、grafana添加vmselect数据源
三、相关说明
参数:“-httpAuth.username”和“-httpAuth.password”
这两个参数是当访问对应组件配置的"-httpListenAddr"端口页面时生效,但是并不影响vminsert/vmselect到vmstorage写/读数据。