chengshiwen / influx-proxy

InfluxDB Proxy with High Availability and Consistent Hash
https://github.com/chengshiwen/influx-proxy/wiki
MIT License
354 stars 112 forks source link

一个集群为什么挂一个influxdb的进程,整个集群就不能用了? #9

Closed sclhaha closed 3 years ago

sclhaha commented 3 years ago
{
    "circles": [
        {
            "name": "circle-1",
            "backends": [
                {
                    "name": "influxdb-1-1",
                    "url": "http://10.205.10.26:8086",
                    "username": "root",
                    "password": "xxxxx"
                },
                {
                    "name": "influxdb-1-2",
                    "url": "http://10.205.10.26:8087",
                    "username": "root",
                    "password": "xxxxx"
                }
            ]
        },
        {
            "name": "circle-2",
            "backends": [
                {
                    "name": "influxdb-2-1",
                    "url": "http://10.205.10.27:8086",
                    "username": "root",
                    "password": "xxxx"
                },
                {
                    "name": "influxdb-2-2",
                    "url": "http://10.205.10.27:8087",
                    "username": "root",
                    "password": "xxxxx"
                }
            ]
        }
    ],
    "listen_addr": ":7076",
    "db_list": [],
    "data_dir": "/vdb/influx-proxy/data",
    "tlog_dir": "/vdb/influx-proxy/log",
    "hash_key": "idx",
    "flush_size": 10000,
    "flush_time": 1,
    "check_interval": 1,
    "rewrite_interval": 10,
    "conn_pool_size": 20,
    "write_timeout": 10,
    "idle_timeout": 10,
    "username": "root",
    "password": "111111",
    "write_tracing": false,
    "query_tracing": false,
    "https_enabled": false,
    "https_cert": "",
    "https_key": ""
}

我的配置文件是这样的,我停掉了 10.205.10.26:8086 这个进程,然后集群就不能用了,不能写数据了。理论上不是一个circle有一份完整的数据吗?我挂一个进程,整个集群应该是可以使用的吧?数据应该写入另一个circle的吧。麻烦问一下我哪里配置有问题吗?

chengshiwen commented 3 years ago

停掉了10.205.10.26:8086 这个进程,正常来讲并不影响另一个 circle,"不能写数据"的日志有吗?看看能不能提供详细的 proxy 日志?另外,我看配置了用户密码,在写数据/write接口时是否指定了-u和-p参数,或者使用已有框架库时指定了用户密码没?

    "username": "root",
    "password": "111111",

另外还有一个可能的原因是:influxdb要求database必须先创建后,才能写数据,否则会报404错误,将数据丢弃掉。目前influx-proxy保证所有influxdb的database的强一致性,如果有一个influxdb掉了,执行create database语句会返回失败,所以create database语句必须得在所有influxdb都活着的时候进行创建

sclhaha commented 3 years ago

我这边是第二种原因,感谢。