Comments (14)
@ioolkos Ah I see, still running nodes will now accept requests, got it now ;)
Ok testing now.
I scaled replicaset like this
kubectl scale statefulset mfx-adapter-mqtt --replicas=5 --namespace mfx
from vernemq.
Yeah, this is because of the enabled consistency features. From VerneMQs perspective it looks like either the Node is down, or a network problem separates your two nodes. By default VerneMQ trades availability for consistency. Which means that VerneMQ will stop serving requests (CONNECT, PUBLISH, SUBSCRIBE) and therefore favors consistency, e.g. uniqueness of client-ids among all cluster nodes.
But, you can CHANGE this behaviour, by trading consistency for availability!
What are you giving up if you trade consistency for availability:
Define trade_consistency = on
in vernemq.conf
this will allow that your currently registered clients can still publish/consume messages (however they can't subscribe to new topics), but new clients CAN'T register because VerneMQ 'tries' to ensure uniqueness of the client-ids in the cluster.
Define allow_multiple_sessions = on
in vernemq.conf
this will allow multiple clients connecting to the cluster using the same client-id. Therefore they share the same subscriptions.
Depending on your use case, combined with proper authentication/authorization, trading consistency might be a good thing. It is definitely useful for a high-availability cluster setup.
Please check https://vernemq.com/docs/clustering.html, to make sure you understand the consequences.
from vernemq.
thinks ,I try it
from vernemq.
run ok ! thinks
from vernemq.
Hey @dergraf
Im also facing same issue while hosting two vernemq nodes as two docker containers in an ec2.
each node is responding to other's ping request, so I guess they are connected.
I have added the logs in the image below.
from vernemq.
@vedavidhbudimuri this happens when your cluster is partitioned. Check the cluster state using vmq-admin cluster show
.
from vernemq.
@larshesel vmq-admin cluster show
shows that two of the nodes true and rest of other nodes to be false, is the issue because of that?
Initially, I tried with 6 nodes and later scaled down to two nodes.
from vernemq.
Yes, that's the problem. You have to explicitly tell VerneMQ that the nodes are gone, otherwise VerneMQ has no idea that this isn't a netsplit situation. See http://vernemq.com/docs/clustering/ and http://vernemq.com/docs/clustering/netsplits.html.
from vernemq.
Oops, I missed this. Thank you @larshesel
from vernemq.
@larshesel @dergraf Is this mean that I can't' get k8s pod auto-scaling without consequences? Or even manual scale down without manually removing nodes from the cluster?
I just faced with the exact same problem, scale down from 5 to 3 instances and get
can't register client due to reason not_ready
I see 3 nodes running and 2 nodes running false with vmq-admin cluster show
Exactly the same case as described.
Manual scaling and add/remove nodes from a cluster is not realistic in production or with the high load in most use cases (especially when throughput is not consistent). Just curious do you guys have any advice here?
Is there a way to set allow_multiple_sessions
and trade_consistency
via env var in docker image ?
Thanks!
from vernemq.
@nmarcetic thanks...
-
If you want to be able to allow registers in a netsplit you have to allow for it: https://docs.vernemq.com/clustering/netsplits Set the
allow_register_during_netsplit = on
in VerneMQ config, and also see about the other allow values there.
The config values you mention (allow_multiple_sessions and trade_consistency) are obsolete, don't use them. -
The idea is not that you manually make the nodes leave. The pod termination should automatically make the node leave, I think. Don't know what you did and why it didn't work. Maybe related: vernemq/docker-vernemq#193
-
A VerneMQ cluster is stateful and membership is part of state. Verne doesn't just forget a node, because it was killed. That's why there's the
leave
command to tell the cluster. See point 2.
from vernemq.
@ioolkos Thanks for a prompt response.
I see now, I will try right now with DOCKER_VERNEMQ_ALLOW_REGISTER_DURING_NETSPLIT=on
.
from vernemq.
@ioolkos Looks same 😞
Running replica=5
+-----------------------------------------------------------------+-------+
| Node |Running|
+-----------------------------------------------------------------+-------+
|VerneMQ@mfx-adapter-mqtt-0.mfx-adapter-mqtt.mfx.svc.cluster.local| true |
|VerneMQ@mfx-adapter-mqtt-1.mfx-adapter-mqtt.mfx.svc.cluster.local| true |
|VerneMQ@mfx-adapter-mqtt-2.mfx-adapter-mqtt.mfx.svc.cluster.local| true |
|VerneMQ@mfx-adapter-mqtt-3.mfx-adapter-mqtt.mfx.svc.cluster.local| true |
|VerneMQ@mfx-adapter-mqtt-4.mfx-adapter-mqtt.mfx.svc.cluster.local| true |
+-----------------------------------------------------------------+-------+
Scaling down to replica=3
+-----------------------------------------------------------------+-------+
| Node |Running|
+-----------------------------------------------------------------+-------+
|VerneMQ@mfx-adapter-mqtt-0.mfx-adapter-mqtt.mfx.svc.cluster.local| true |
|VerneMQ@mfx-adapter-mqtt-1.mfx-adapter-mqtt.mfx.svc.cluster.local| true |
|VerneMQ@mfx-adapter-mqtt-2.mfx-adapter-mqtt.mfx.svc.cluster.local| true |
|VerneMQ@mfx-adapter-mqtt-3.mfx-adapter-mqtt.mfx.svc.cluster.local| false |
|VerneMQ@mfx-adapter-mqtt-4.mfx-adapter-mqtt.mfx.svc.cluster.local| false |
+-----------------------------------------------------------------+-------+
All pods have DOCKER_VERNEMQ_ALLOW_REGISTER_DURING_NETSPLIT: on
set as an env variable, as described.
It works only when I scale down to 0 then scale up to N , then I see a "clean" cluster with all running true nodes.
What I am missing?
from vernemq.
Looks like you're mixing up two things: you now have a netsplitted cluster, but other than before you still can register clients! this is what you configured for with ALLOW_REGISTER. Normally, you could restart those 2 missing nodes, and then the netsplit will heal.
Your other completely unrelated issue is that you want to make those 2 nodes leave in Kubernetes. I do not know why this doesn't work as expected in your case. How do you actually scale down?
from vernemq.
Related Issues (20)
- [Bug]: Unexpected behaviour of vmq-admin session disconnect --cleanup (bug or feature?) HOT 4
- Environment variables for erlang configuration HOT 3
- Multiple connections using same client_id and username HOT 9
- Changes in mysql.lua file to not match client_id from myql HOT 3
- Using username in a TLS context is inappropriate HOT 3
- Need help with ECONNRESET using mqtt.js and VerneMQ HOT 5
- Add api Key using environment variables HOT 10
- [Bug]: Caching for auth_on_xxx_m5 hooks is not working HOT 8
- max_request_line_length config has no effect for HTTP sessions
- [Question]: Does VerneMQ support RocksDB in 1.13.0? HOT 12
- [Bug]: Issues with the correct CPU quota detection on k8s v1.26 HOT 12
- [Bug]: Outgoing QoS upgrades not affecting storage of offline messages HOT 5
- [Bug]: vmq_http_pub plugins apis not restricted by api key and bounded to default http listener HOT 7
- Enhancement: MQTT TLS listeners with multiple TLS versions.
- [Bug]: Loss of retained QoS 1 messages across cluster nodes HOT 1
- [Bug]: <title>HIGH CPU for VerneMQ (beam.smp) HOT 3
- Support Alternative TCP listener with proxy protocol enabled by default HOT 6
- VerneMQ HTTPs support HOT 12
- [Bug]: Websockets upgrade request: HTTP 431: Request Header Fields Too Large with big cookies HOT 11
- [Bug]: CRASH REPORT Process with 0 neighbours crashed with reason: bad argument in vmq_cluster_com:process_bytes/3 line 171 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vernemq.