All Projects → chengshiwen → influx-proxy

chengshiwen / influx-proxy

Licence: MIT license
InfluxDB Proxy with High Availability and Consistent Hash

Programming Languages

go
31211 projects - #10 most used programming language
shell
77523 projects
Makefile
30231 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to influx-proxy

syncflux
SyncFlux is an Open Source InfluxDB Data synchronization and replication tool for migration purposes or HA clusters
Stars: ✭ 145 (-34.98%)
Mutual labels:  influxdb, high-availability
jobor
支持秒级分布式定时任务系统, A high performance distributed task scheduling system, Support multi protocol scheduling tasks
Stars: ✭ 52 (-76.68%)
Mutual labels:  high-availability
geostat
GeoStat, Python script for parsing Nginx and Apache logs files and getting GEO data from incoming IP's.
Stars: ✭ 50 (-77.58%)
Mutual labels:  influxdb
telemetry collector
build telemetry software stack for Cisco nx-os, support both telemetry dial-out and gNMI dial-in
Stars: ✭ 39 (-82.51%)
Mutual labels:  influxdb
continuous-analytics-examples
A collection of examples of continuous analytics.
Stars: ✭ 17 (-92.38%)
Mutual labels:  influxdb
influxdb-cxx
C++ client library for InfluxDB 1.x/2.x
Stars: ✭ 69 (-69.06%)
Mutual labels:  influxdb
ml-ops
Get your MLOps (Level 1) platform started and going fast.
Stars: ✭ 81 (-63.68%)
Mutual labels:  influxdb
bounded-disturbances
A k6/.NET red/green load testing workshop
Stars: ✭ 39 (-82.51%)
Mutual labels:  influxdb
dropwizard-influxdb-reporter
Dropwizard Integrations for InfluxDB.
Stars: ✭ 16 (-92.83%)
Mutual labels:  influxdb
pg-dock
pg-dock cluster managment
Stars: ✭ 19 (-91.48%)
Mutual labels:  high-availability
grafana-dashboards
List of Grafana Dashboards 📺
Stars: ✭ 120 (-46.19%)
Mutual labels:  influxdb
envsensor-observer-py
Python Bluetooth low energy observer example for OMRON Environment Sensor (2JCIE-BL01)
Stars: ✭ 31 (-86.1%)
Mutual labels:  influxdb
pg keeper
Simplified clustering module for PostgreSQL
Stars: ✭ 32 (-85.65%)
Mutual labels:  high-availability
influxdb-c
💙 C write client for InfluxDB.
Stars: ✭ 28 (-87.44%)
Mutual labels:  influxdb
influxdb-cxx
Fork of the unmaintained https://github.com/awegrzyn/influxdb-cxx project.
Stars: ✭ 47 (-78.92%)
Mutual labels:  influxdb
air-quality
Live dashboard for air quality in my home.
Stars: ✭ 70 (-68.61%)
Mutual labels:  influxdb
monitoring-rancher
🤠How to Set up Rancher Server Monitoring with TIG Stack?
Stars: ✭ 22 (-90.13%)
Mutual labels:  influxdb
uber-cli
Beeps when surge is gone
Stars: ✭ 29 (-87%)
Mutual labels:  influxdb
influxdb-ha
High-availability and horizontal scalability for InfluxDB
Stars: ✭ 45 (-79.82%)
Mutual labels:  influxdb
monitor system docs
No description or website provided.
Stars: ✭ 30 (-86.55%)
Mutual labels:  influxdb

InfluxDB Proxy

CN doc EN doc Go Report Card LICENSE Releases GitHub stars Docker pulls

This project adds a basic high availability and consistent hash layer to InfluxDB.

NOTE: influx-proxy must be built with Go 1.14+ with Go module support, don't implement udp.

NOTE: InfluxDB Cluster for replacing InfluxDB Enterprise is coming, which is better than InfluxDB Proxy.

Why

We used InfluxDB Relay before, but it doesn't support some demands. We use grafana for visualizing time series data, so we need add datasource for grafana. We need change the datasource config when influxdb is down. We need transfer data across idc, but Relay doesn't support gzip. It's inconvenient to analyse data with connecting different influxdb. Therefore, we made InfluxDB Proxy. More details please visit https://github.com/shell909090/influx-proxy.

Forked from the above InfluxDB Proxy, after many improvements and optimizations, InfluxDB Proxy v1 has released, which no longer depends on python and redis, and supports more features.

Since the InfluxDB Proxy v1 is limited by the only ONE database and the KEYMAPS configuration, we refactored InfluxDB Proxy v2 with high availability and consistent hash, which supports multiple databases and tools to rebalance, recovery, resync and cleanup.

Features

  • Support query and write.
  • Support some cluster influxql.
  • Filter some dangerous influxql.
  • Transparent for client, like cluster for client.
  • Cache data to file when write failed, then rewrite.
  • Support multiple databases to create and store.
  • Support database sharding with consistent hash.
  • Support tools to rebalance, recovery, resync and cleanup.
  • Load config file and no longer depend on python and redis.
  • Support both rp and precision parameter when writing data.
  • Support influxdb-java, influxdb shell and grafana.
  • Support prometheus remote read and write.
  • Support authentication and https.
  • Support authentication encryption.
  • Support health status query.
  • Support database whitelist.
  • Support version display.
  • Support gzip.

Requirements

  • Golang >= 1.14 with Go module support
  • InfluxDB 1.2 - 1.8 (For InfluxDB 2.x, please visit branch influxdb-v2)

Usage

Quickstart by Docker

Download docker-compose.yml and proxy.json from docker/quick

$ docker-compose up -d

An influx-proxy container (port: 7076) and 4 influxdb containers will start.

Quickstart

$ git clone https://github.com/chengshiwen/influx-proxy.git
$ cd influx-proxy
$ make
$ ./bin/influx-proxy -config proxy.json

Usage

$ ./bin/influx-proxy -h
Usage of ./bin/influx-proxy:
  -config string
        proxy config file with json/yaml/toml format (default "proxy.json")
  -version
        proxy version

Build Release

$ # build current platform
$ make build
$ # build linux amd64
$ make linux

Development

Before developing, you need to install and run Docker

$ ./script/setup.sh  # start 4 influxdb instances by docker
$ make run
$ ./script/write.sh  # write data
$ ./script/query.sh  # query data
$ ./script/remove.sh # remove 4 influxdb instances

Description

The architecture is fairly simple, one InfluxDB Proxy instance and two consistent hash circles with two InfluxDB instances respectively. The Proxy should point HTTP requests with db and measurement to the two circles and the four InfluxDB servers.

The setup should look like this:

        ┌──────────────────┐
        │ writes & queries │
        └──────────────────┘
                 │
                 ▼
        ┌──────────────────┐
        │                  │
        │  InfluxDB Proxy  │
        │   (only http)    │
        │                  │
        └──────────────────┘
                 │
                 ▼
        ┌──────────────────┐
        │  db,measurement  │
        │ consistent hash  │
        └──────────────────┘
          |              |
        ┌─┼──────────────┘
        │ └────────────────┐
        ▼                  ▼
     Circle 1          Circle 2
  ┌────────────┐    ┌────────────┐
  │            │    │            │
  │ InfluxDB 1 │    │ InfluxDB 3 │
  │ InfluxDB 2 │    │ InfluxDB 4 │
  │            │    │            │
  └────────────┘    └────────────┘

Proxy Configuration

The configuration file supports format json, yaml and toml, such as proxy.json, proxy.yaml and proxy.toml.

The configuration settings are as follows:

  • circles: circle list
    • name: circle name, required
    • backends: backend list belong to the circle, required
      • name: backend name, required
      • url: influxdb addr or other http backend which supports influxdb line protocol, required
      • username: influxdb username, with encryption if auth_encrypt is enabled, default is empty which means no auth
      • password: influxdb password, with encryption if auth_encrypt is enabled, default is empty which means no auth
      • auth_encrypt: whether to encrypt auth (username/password), default is false
      • write_only: whether to write only on the influxdb, default is false
  • listen_addr: proxy listen addr, default is :7076
  • db_list: database list permitted to access, default is []
  • data_dir: data dir to save .dat .rec, default is data
  • tlog_dir: transfer log dir to rebalance, recovery, resync or cleanup, default is log
  • hash_key: backend key for consistent hash, including "idx", "exi", "name" or "url", default is idx, once changed rebalance operation is necessary
  • flush_size: default is 10000, wait 10000 points write
  • flush_time: default is 1, wait 1 second write whether point count has bigger than flush_size config
  • check_interval: default is 1, check backend active every 1 second
  • rewrite_interval: default is 10, rewrite every 10 seconds
  • conn_pool_size: default is 20, create a connection pool which size is 20
  • write_timeout: default is 10, write timeout until 10 seconds
  • idle_timeout: default is 10, keep-alives wait time until 10 seconds
  • username: proxy username, with encryption if auth_encrypt is enabled, default is empty which means no auth
  • password: proxy password, with encryption if auth_encrypt is enabled, default is empty which means no auth
  • auth_encrypt: whether to encrypt auth (username/password), default is false
  • write_tracing: enable logging for the write, default is false
  • query_tracing: enable logging for the query, default is false
  • https_enabled: enable https, default is false
  • https_cert: the ssl certificate to use when https is enabled, default is empty
  • https_key: use a separate private key location, default is empty

Query Commands

Unsupported commands

The following commands are forbid.

  • GRANT
  • REVOKE
  • KILL
  • EXPLAIN
  • SELECT INTO
  • CONTINUOUS QUERY
  • Multiple queries delimited by semicolon ;
  • Multiple measurements delimited by comma ,
  • Regexp measurement

Supported commands

Only support match the following commands.

  • select from
  • show from
  • show measurements
  • show series
  • show field keys
  • show tag keys
  • show tag values
  • show stats
  • show databases
  • create database
  • drop database
  • show retention policies
  • create retention policy
  • alter retention policy
  • drop retention policy
  • delete from
  • drop series from
  • drop measurement
  • on clause (the db parameter takes precedence when the parameter is set in /query http endpoint)

HTTP Endpoints

HTTP Endpoints

Benchmark

There are three tools for benchmarking InfluxDB, which can also be applied to InfluxDB Proxy:

  • influx-stress is a stress tool for generating artificial load on InfluxDB.
  • influxdb-comparisons contains code for benchmarking InfluxDB against other databases and time series solutions.
  • tsbs (Time Series Benchmark Suite) is a tool for comparing and evaluating databases for time series data.

Tool

There is a tool for InfluxDB and InfluxDB Proxy:

  • influx-tool: high performance tool to rebalance, recovery, resync, cleanup and compact. most commands do not require InfluxDB to start

License

MIT.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].