Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Many TIME_WAIT errors for connecting to mongodb4 #215

Open
jhhe66 opened this issue Jun 2, 2020 · 0 comments
Open

Many TIME_WAIT errors for connecting to mongodb4 #215

jhhe66 opened this issue Jun 2, 2020 · 0 comments
Assignees

Comments

@jhhe66
Copy link

jhhe66 commented Jun 2, 2020

配置了emqx_auth_mongo,但是报了很多time_wait.

配置文件如下:

##--------------------------------------------------------------------
## MongoDB Auth/ACL Plugin
##--------------------------------------------------------------------

## MongoDB Topology Type.
##
## Value: single | unknown | sharded | rs
auth.mongo.type = rs

## The set name if type is rs.
##
## Value: String
auth.mongo.rs_set_name = devauth_mongo_set

## MongoDB server list.
##
## Value: String
##
## Examples: 127.0.0.1:27017,127.0.0.2:27017...
auth.mongo.server = ip01:15306,ip01:15307

## MongoDB pool size
##
## Value: Number
auth.mongo.pool = 8

## MongoDB login user.
##
## Value: String
auth.mongo.login = devauth_mongo

## MongoDB password.
##
## Value: String
auth.mongo.password = ***

## MongoDB AuthSource
##
## Value: String
## Default: mqtt
auth.mongo.auth_source = admin

## MongoDB database
##
## Value: String
auth.mongo.database = DeviceAuth_db

## MongoDB query timeout
##
## Value: Duration
## auth.mongo.query_timeout = 5s

## Whether to enable SSL connection.
##
## Value: true | false
## auth.mongo.ssl = false

## SSL keyfile.
##
## Value: File
## auth.mongo.ssl_opts.keyfile =

## SSL certfile.
##
## Value: File
## auth.mongo.ssl_opts.certfile =

## SSL cacertfile.
##
## Value: File
## auth.mongo.ssl_opts.cacertfile =

## MongoDB write mode.
##
## Value: unsafe | safe
## auth.mongo.w_mode =

## Mongo read mode.
##
## Value: master | slave_ok
## auth.mongo.r_mode =

## MongoDB topology options.
auth.mongo.topology.pool_size = 1
auth.mongo.topology.max_overflow = 0
## auth.mongo.topology.overflow_ttl = 1000
## auth.mongo.topology.overflow_check_period = 1000
## auth.mongo.topology.local_threshold_ms = 1000
## auth.mongo.topology.connect_timeout_ms = 20000
## auth.mongo.topology.socket_timeout_ms = 100
## auth.mongo.topology.server_selection_timeout_ms = 30000
## auth.mongo.topology.wait_queue_timeout_ms = 1000
## auth.mongo.topology.heartbeat_frequency_ms = 10000
## auth.mongo.topology.min_heartbeat_frequency_ms = 1000

## Authentication query.
auth.mongo.auth_query.collection = device_auth_col

## Password mainly fields
##
## Value:  password | password,salt
auth.mongo.auth_query.password_field = password

## Password hash.
##
## Value: plain | md5 | sha | sha256 | bcrypt
auth.mongo.auth_query.password_hash = plain

## sha256 with salt suffix
## auth.mongo.auth_query.password_hash = sha256,salt

## sha256 with salt prefix
## auth.mongo.auth_query.password_hash = salt,sha256

## bcrypt with salt prefix
## auth.mongo.auth_query.password_hash = salt,bcrypt

## pbkdf2 with macfun iterations dklen
## macfun: md4, md5, ripemd160, sha, sha224, sha256, sha384, sha512
## auth.mongo.auth_query.password_hash = pbkdf2,sha256,1000,20


## Authentication Selector.
##
## Variables:
##  - %u: username
##  - %c: clientid
##  - %C: common name of client TLS cert
##  - %d: subject of client TLS cert
##
## auth.mongo.auth_query.selector = {Field}={Placeholder}
auth.mongo.auth_query.selector = username=%u

## Enable superuser query.
auth.mongo.super_query = on

auth.mongo.super_query.collection = device_auth_col

auth.mongo.super_query.super_field = is_superuser

#auth.mongo.super_query.selector = username=%u, clientid=%c
auth.mongo.super_query.selector = username=%u

## Enable ACL query.
auth.mongo.acl_query = on

auth.mongo.acl_query.collection = device_auth_col

## ACL Selector.
##
## Multiple selectors could be combined with '$or'
##   when query acl from mongo.
##
## e.g.
##
## With following 2 selectors configured:
##
## auth.mongo.acl_query.selector.1 = username=%u
## auth.mongo.acl_query.selector.2 = username=$all
##
## And if a client connected using username 'ilyas',
##   then the following mongo command will be used to
##   retrieve acl entries:
##
## db.mqtt_acl.find({$or: [{username: "ilyas"},  {username: "$all"}]});
##
## Variables:
##  - %u: username
##  - %c: clientid
##
## Examples:
##
## auth.mongo.acl_query.selector.1 = username=%u,clientid=%c
## auth.mongo.acl_query.selector.2 = username=$all
## auth.mongo.acl_query.selector.3 = clientid=$all

auth.mongo.acl_query.selector = username=%u
@HJianBo HJianBo changed the title emqx-auth-mongo连接mongodb4报大量的TIME_WAIT Many TIME_WAIT errors for connecting to mongodb4 Jun 3, 2020
@HJianBo HJianBo self-assigned this Jun 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants