Hi , lets say I have 4 node k8s cluster with temporal deployed using helm charts with single replica . (lets say all temporal pods are running on worker node -1 ) . Now I want to create temporal worker and workflows from worker-node 2 via go sdk . Is that possible or i need to have some temporal componenets running on worker node 2 as well? if so how to achieve that?
I interpreted your post to describe a particular deployment scenario in which you have multiple nodes on which you could potentially run a Temporal Worker. You already have a Worker running on the first of these nodes, so you’re asking:
- Could I execute a Workflow and run a Worker on the second node?
- If so, which part(s) of Temporal must be installed on the second node for this to work?
Is my understanding correct? If not, could you please clarify what you’re asking?
Yes right exactly what I am asking for
OK, thanks for the clarification.
Yes, you can execute a Workflow and run a Worker on the second (or any other) node. In fact, it’s a good idea to run multiple Workers with Temporal because this not only increases scalability, but also availability. If one Worker dies, then the work it was doing can continue on one of the other Workers.
All nodes running a Worker will require access to each Workflow or Activity that is registered with that Worker, as well as connectivity to the Temporal cluster (the Worker and frontend service of the Temporal cluster use gRPC to communicate over TCP port 7233).
On a related note, you may have learned from our tutorials that Workers run the Workflow and Activity code, but this only happens after the Workflow has been started. You can start a Workflow from the command line using
tctl, but it’s also common to do this from code in your own application (example in Go).
The node used to start the Workflow doesn’t require access to the Workflow or Activity code (unless you’re running a Worker on it), but it does need the Temporal SDK. To be more specific, it needs the Temporal SDK for whatever language you’re using to start the Workflow, since Temporal supports polyglot programming (example) and allows you to write your Workflow, Activity, and code used to start the Workflow in different languages.
Thanks for the detailed overview . There is one more requirement for which I am trying to evaluate temporal . I have certain workflows which are pretty much node specific . so lets say there is workflow which carries out certain kernel level operations at node2(lets say) , and currently that workflow is being executed by worker which is also running on node2 . As you said ,
If one Worker dies, then the work it was doing can continue on one of the other Workers.
So if this worker running on node2 dies due to some reasons ,and the workflow it was executing was pretty much node specific , so I dont want the rest of the activities in workflow to be executed by another worker . So if the worker dies wokflow should also fail . Can this scenario will be handled by temporal , may be by changing some default configs?
I’ll add to what Tihomir said by referencing the page in the documentation that addresses your use case. In addition to the two code samples he linked to, this page also links to a similar example with PHP.
Thanks for the response . Seems like worker session api allows to bind activities with particular worker . So workflow taskque will also be executed by the same worker in case of worker process failure?
Is there any way by which we can tie workflow with the worker?
That would be a bad idea because the worker’s failure would lead to the workflow getting stuck. So workflows are by design never linked to a single worker.
Temporal supports routing activities to specific workers. So all activities of a workflow can execute on a specific worker, but the workflow itself doesn’t need to be.
Thanks got it .