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

infra to build js-cluster for tests #151

Merged
merged 6 commits into from
Apr 28, 2021
Merged

infra to build js-cluster for tests #151

merged 6 commits into from
Apr 28, 2021

Conversation

aricart
Copy link
Member

@aricart aricart commented Apr 23, 2021

No description provided.

@aricart aricart requested a review from kozlovic April 23, 2021 20:21
cluster.forEach((s) => {
console.log(
`launched server [${s.process.pid}] at ${s.hostname}:${s.port} - monitor ${s.monitoring}`,
`nats-server -c ${s.configFile} [${s.process.pid}] at nats://${s.hostname}:${s.port} cluster://${s.hostname}:${s.cluster} http://127.0.0.1:${s.monitoring}`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With JS, for clustering to work well, the routes need to be explicit because the replicas and quorum size is based on that. Meaning that a server should have

cluster {
   port: xxx
   routes [
       "nats://thisserver:routeport",
       "nats://2ndserver:routeport",
       "nats://3rdserver:routeport",
   ]
}

So I am not sure if having a server just with cluster port running is enough.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are:
All the cluster ports are captured here:

https://github.com/nats-io/nats.deno/pull/151/files#diff-13f7841d0f019c3a5a1be00d61f041840c0254418db41c57810cefbc11354763R290

And then after all captured, self-routes are removed (I know they don't have to be)

https://github.com/nats-io/nats.deno/pull/151/files#diff-13f7841d0f019c3a5a1be00d61f041840c0254418db41c57810cefbc11354763R305

And finally, all the servers are restarted with their JS cluster configurations.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A full config looks like this:

port: 4222
cluster {
  name: MOYI2Y0O2HYD057TSX017D
  listen: "127.0.0.1:49922"
  routes [
    nats://127.0.0.1:49928
   ]
 }
ports_file_dir: /var/folders/1y/_rk6yz81341g5q8k1vr5nqmw0000gq/T
host: "127.0.0.1"
http: "127.0.0.1:49921"
jetstream {
  max_file_store: 1048576
  max_memory_store: 1048576
  store_dir: /tmp/jetstream/MOYI2Y0O2HYD057TSX01ED
 }
server_name: MOYI2Y0O2HYD057TSX01AV

@aricart aricart requested a review from kozlovic April 28, 2021 14:28
Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aricart aricart merged commit 8d7402a into main Apr 28, 2021
@aricart aricart deleted the js-cluster branch April 28, 2021 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants