influxDB高可用方案实践

2022-02-09 00:00:00 专区 订阅 配置 可以通过 转发

##一、gateway



##二、influxdb-relay

    influxdb的高可用层初由influxdata创建提出,但之后不再维护。其架构图如下:其中负载设备(load Balancer)可以通过nginx对于读请求直接转发到inflxudb,对于写请求转发到relay。可以通过IP地址转发,也可以通过域名来转发.

```

https://github.com/influxdata/influxdb-relay

配置

[[http]]

name ="example-http"

bind-addr ="127.0.0.1:9096"

# Array of InfluxDB instances to use as backends for Relay.

output = [

# name: name of the backend, used for display purposes only.

# location: full URL of the /write endpoint of the backend

# timeout: Go-parseable time duration. Fail writes if incomplete in this time.

{ name="local1", location="http://127.0.0.1:8086/write", timeout="10s"},

{ name="local2", location="http://127.0.0.1:7086/write", timeout="10s"},

]

[[udp]]

# Name of the UDP server, used for display purposes only.

name ="example-udp"

# UDP address to bind to.

bind-addr ="127.0.0.1:9096"

# Socket buffer size for incoming connections.

read-buffer = 0# default

# Precision to use for timestamps

precision ="n"# Can be n, u, ms, s, m, h

# Array of InfluxDB instances to use as backends for Relay.

output = [

# name: name of the backend, used for display purposes only.

# location: host and port of backend.

# mtu: maximum output payload size

{ name="local1", location="127.0.0.1:8089", mtu=512 },

{ name="local2", location="127.0.0.1:7089", mtu=1024 },

]

```

运行  >> nohup ./influxdb-relay -config relay.toml &

测试 >> curl -i -XPOST 'http://localhost:9096/write?db=testDB' --data-binary 'cpu_load_short,host=server01,region=us-west value=0.67'

配置方式一:单机双写

        relay只配置[[http]]选项的场景: bind-addr是强绑定(只能通过指定的IP访问,localhost对应127.0.0.1)

      设置的端口防火墙是否打开。

配置方式二:双机双写

      relay只配置[[http]]选项的场景: bind-addr是强绑定(只能通过指定的IP访问,localhost对应127.0.0.1)

      设置的端口防火墙是否打开。且两主机间要可以通信。relay主机可以远行在两个主机上,也可以独立远行。



##三、influxdb-proxy

相关文章