Closed dimaqq closed 4 years ago
Yep, neither of those Mongo-QL-replicating products is supported.
As for mongodb+srv://
, it's not supported as of now, but we'll support it of course. Right now I'd suggest using what's called "legacy" connection string in Atlas, it's a plain mongodb://
one.
Regarding ReplicaSetNoPrimary
, my guess would be that you don't pass replica set name (you use _HOST
env var as opposed to URI, therefore no rs=XXX
) and some tricky code in MongoDB driver doesn't handle that well. Could you try legacy URI and let us know?
Re: ReplicaSetNoPrimary
it's also documented that this is the error that Mongo Atlas returns when there are too many requests for a given "instance". Since I was trying the free tier, it's possible that was the case, though that was not reflected in the metrics.
I'll poke it some more, however I've realised that all free and cheap tiers of Mongo Atlas are very limited. π The smallest sane "instance" type is M10 at $0.10 per hour, which is pretty steep. π’
In case someone else lands here, this environment variable does not appear documented, here's an example for passing MongoDB Atlas NodeJS 2.2.12 or later
style connection URL to 20.04 containers, docker-compose environment
format:
- COUNTLY_CONFIG__MONGODB=mongodb://countly:${MONGODB_PASSWORD}@your-cluster-shard-00-00-gtup4.mongodb.net:27017,your-cluster-shard-00-01-gtup4.mongodb.net:27017,your-cluster-shard-00-02-gtup4.mongodb.net:27017/test?ssl=true&replicaSet=your-cluster-prv-shard-0&authSource=admin&retryWrites=true&w=majority
Now I'm not getting ReplicaSetNoPrimary
any more, so farπ€, but I am getting MongoServerSelectionError: Authentication failed.
from time to time.
Ah, sorry I think I misread the error, the auth failed also includes this bit:
reason: TopologyDescription { type: 'ReplicaSetNoPrimary',
So I guess it's the same error, whether combining 3 hosts via _MONGODB_HOST or passing a _MONGODB url with 3 embedded hostnames.
Not sure what you meant by COUNTLY_CONFIG__MONGODB
not being documented - it is documented.
But thanks for the ReplicaSetNoPrimary
being too much requests hint, noted. For the reference, it's listed as one of the reasons on this page.
Try setting COUNTLY_CONFIG_API_MONGODB_MAX_POOL_SIZE
to something less than default 500. Start from 10, for example.
re: documentation, it could be better :) the variable is mentioned at https://support.count.ly/hc/en-us/articles/900000594266-Docker-Kubernetes-Enterprise-Edition
other locations, like docker-compose.yml
list individual components, like _HOST/USERNAME/PASSWORD
instead.
I am running with max pool size 10 now and so far it's mostly fine. Then again there's no traffic as the app is pre-beta so π€·
Ok, main Docker documentation link is this one https://support.count.ly/hc/en-us/articles/360037814511-Docker-Kubernetes#configuration It almost exclusively uses __MONGODB
variables
MongoDB DNS seed list connection string support added here: https://github.com/Countly/countly-server/commit/98dc071ea2083e609975259bdc320bc052a3ea1f
I've been trialling countly server, v 20.04 from docker-hub, using docker-compose.
Obv., it worked like a charm with a local mongodb container, but I'd want to move this to the cloud. I've tried Azure Cosmos DB with Mongo API, but that doesn't support capped collections π I think AWS DocumentDB-thingy has the same limitation.
So, now I'm trying MongoDB (Cloud) Atlas, and it gives me a connection string with
mongo+srv://
scheme. As far as I understand, that's not currently supported bycountly-server
, is it?Would it be a good idea to support this scheme?
So, I've looked up actual hostnames (3 in total, 1 primary, 2 secondary), and set up:
COUNTLY_CONFIG__MONGODB_HOST=foo-00.bar,foo-01.bar,foo-02.bar
This worked at first, but currently doesn't with
"reason":{"type":"ReplicaSetNoPrimary",
I think what has happened is that a different host (among the 3) became mongo primary and neither api nor frontend can handle that.