Changing the history shard count of a Temporal cluster

A self-hosted Temporal cluster cannot change its history shard count in place, so fixing an undersized cluster means building a new Temporal Service and moving workflows to it. This page explains the path and what drives its effort.

On this page

Changing the history shard count of a Temporal cluster starts with a new cluster

If your self-hosted Temporal cluster was built with too few history shards, the count cannot be changed in place. The fix is to stand up a new Temporal Service with a shard count you have sized for the next several years, then move workflows from the old service to the new one. Nothing about the existing cluster's configuration can be edited to get there, so plan the work as a build and a migration rather than a tuning exercise.

The numHistoryShards setting is fixed once the Temporal Service first starts. Later changes to the value in the service configuration are ignored, as the Temporal Service configuration reference explains. Temporal's production checklist draws the practical conclusion: adding shards requires a rebuild and a migration to a new Temporal Service. Confirm the current value in your deployed configuration and in the persistence store before you assume the setting you edited is the one in effect, because a changed file on disk does not alter a running cluster's shard layout.

Effort depends on four things: the number of namespaces, the volume of open workflows that must be drained or moved, the size of your worker fleet, and the footprint of your persistence and visibility databases. No duration or price is given here, because none is supplied for this work. Ask any partner, including DeployOpen, for a written scope that names each of those inputs and the data you will need to measure them. The rest of this page covers how to choose the new count and how to move workflows safely.

Which path fits your cluster

If the cluster has never carried real workflows, the cheapest fix is usually to stop, delete the persistence and visibility stores, and create a new Temporal Service with a shard count you have sized deliberately. Because the numHistoryShards setting is fixed once the Service first starts, a fresh build is the only route to a different value, and no workflow history needs to move. The work is mostly rebuilding deployment automation and re-running your test suite against the new cluster.

  • Confirm no real data exists: check that no team or integration has written production executions, schedules or visibility records you would need to keep.
  • Rebuild from configuration: keep Helm values, dynamic config and namespace definitions in version control so the new Service matches the old one except for the shard count.
  • Re-run application tests: replay your workers and client code against the rebuilt cluster before anyone depends on it.
  • Record the chosen count: document why the value was picked so the next sizing review starts from evidence.

Before choosing this path, confirm with your team that the cluster is genuinely disposable and that the shard decision can be made again on current load estimates.

What carries over to the new cluster and what does not

This table compares each element of the existing self-hosted cluster with its equivalent on the new Temporal Service built with the corrected shard count. Read it as a checklist: items marked as rebuilt or reconfigured need work before cutover, and items that do not transfer need a plan for running workflows.

ElementOn the new clusterWhat you do
Namespaces and retentionMust be created again on the new Temporal Service with their retention settings set explicitlyExport namespace definitions from the old cluster and recreate each one with the same retention period
Workflow code and task queuesUnchanged code, but task queue names must match what the new workers pollKeep queue names identical so workers need no code change beyond the frontend address
Worker deploymentsWorkers do not follow the cluster; they must be pointed at the new frontendUpdate the frontend address and certificates, then start new workers before draining old ones
Persistence storeA new, separate database is required; the old history store is not reusedProvision an empty database for the new Temporal Service and run its schema setup first
Visibility storeMust be configured again and indexed for the new clusterSet up visibility on the new cluster and confirm searches return expected results before cutover
TLS and authorizationNot inherited; the default noopAuthorizer allows all requests unless one is configuredReissue certificates, reapply mTLS, ClaimMapper and Authorizer settings, and test access before go-live
Dynamic configNot copied automatically; the new cluster starts with its own valuesReview each override from the old cluster and apply only those still needed
Running workflow executionsOpen executions do not transfer by copying the old history storeLet open executions finish on the old cluster or plan a controlled migration, and confirm the numHistoryShards value is decided before first start on the new cluster

Sizing the new cluster right the second time

A new cluster is only worth building once the shard count is decided with the workload in view. The cards below list the inputs to settle before the first start, since the count cannot be changed afterward without another rebuild and migration.

Peak throughput for workflows and activities

Measure the peak rate of workflow starts, activity executions, signals and timer firings, not the daily average. Shard count sets how history work is divided, so a peak that the chosen count cannot spread across the history service becomes a bottleneck that is expensive to correct later. Ask your team for historical peak figures per namespace, and ask the vendor or your platform engineers how the planned count maps to that peak in your own load tests.

Production checklist

Number of namespaces and their profiles

List every namespace the cluster will host and note which ones are high volume, which are bursty and which are small internal tools. Namespaces share the same shards, so a single busy namespace affects the others. Ask each product team for expected workflow counts and growth, and decide whether heavy namespaces need their own cluster before the shard count is fixed.

Retention period and open execution volume

Retention determines how many closed workflow histories sit in persistence, while open executions drive the active load on history shards. Estimate the number of open workflows at peak, not only total executions per day. Ask the business owners how long completed histories must remain queryable, and confirm the retention setting you plan to use against your storage budget.

Persistence store capacity for the planned count

The persistence store holds the history and shard records, so its connection limits, IOPS and storage growth must support the planned shard count and expected retention. Confirm with your database team which engine and version you will run, since Temporal documents specific supported versions for Cassandra, PostgreSQL and MySQL. Ask whether the store can absorb peak write rates from the planned shards.

Persistence docs

Growth horizon for the cluster

Decide how many years of volume the cluster should absorb without a rebuild, and write that horizon down with the business forecast behind it. Because the shard count is fixed at first start, planning only for today's load repeats the problem. Ask product owners for three-year volume estimates and ask your platform team to state the point at which a new cluster would become necessary.

Visibility backend choice

Visibility queries run against a separate store, and the choice affects how many executions you can search and how the cluster scales with them. Temporal recommends Elasticsearch or OpenSearch for anything beyond a few workflow executions. Confirm the visibility store and its version with your search team before the first start, so that the new cluster does not repeat a visibility migration on top of the shard rebuild.

Visibility docs

How the move runs: build, pilot, parallel run and cutover

This sequence moves live workflows from a shard-constrained Temporal Service to a correctly sized replacement without losing executions, and each step ends with a check that tells the team whether it can proceed.

  1. Inventory namespaces and open workflows

    The platform team lists every namespace on the existing cluster, the workers and clients that connect to each one, and the count of open and recently closed workflow executions in each. They also record the persistence and visibility backends in use, the Temporal Server version, and which namespaces carry business-critical or regulated work. The output is a written inventory that the cutover plan references. It is done when every namespace has an owner, a worker list and a migration order agreed by the application teams.

  2. Size and build the new cluster

    The team chooses the numHistoryShards value for the new Temporal Service before it starts for the first time, because the setting cannot be changed after first start and later changes are ignored. Sizing should account for expected growth in open workflows and throughput, and the team should confirm the figure with Temporal's documentation and their own load estimates before building. The new cluster is deployed with Docker Compose, Go binaries or the Helm chart, using a chart version of 0.73.1 or later for server images 1.30 and later. It is done when the new service starts cleanly and reports the shard count it was built with.

  3. Verify persistence and visibility backends

    Before any workflow runs on the new cluster, the team confirms that the persistence database is one of the supported versions for the chosen server release and that the advanced visibility store is supported with that server. They check that the new cluster is not reachable from the public internet, that authorization is configured rather than left on the default noopAuthorizer, and that mTLS and namespace roles are set according to the security design. The check passes when test workflows can be started, queried in visibility and completed on the new cluster.

  4. Deploy workers against the new service on non-production namespaces

    The application team points a non-production copy of its workers and clients at the new cluster and runs its test suite, including replay of representative workflow histories against the workflow code. This shows whether the same worker code behaves correctly against the new service before any production traffic moves. The output is a pass record for each non-production namespace, with any workflow code issues fixed and retested. Teams should confirm their SDK version is compatible with the chosen server release.

  5. Pilot with a low-risk namespace

    The team moves one low-risk production namespace first, with its workers redeployed against the new service and new workflow starts directed there. They watch execution failure rates, task latency, visibility queries and worker logs for an agreed observation window set by the business owner. The pilot is complete when the namespace runs cleanly and the rollback path, which is pointing workers back to the old service, has been tested. Any issue found here is fixed before the next namespace moves.

  6. Run both clusters in parallel

    Both clusters run during the transition. New workflow starts are directed to the new cluster while executions already open on the old cluster continue there until they complete. Workers stay connected to the old service for the namespaces that still have open work, so each namespace is served by one cluster for any given execution. The team tracks the open execution count on the old cluster falling toward zero and confirms that no new starts are going to it. The step is complete when the old cluster holds no executions the business still needs to finish.

  7. Cut over workers and clients

    Once a namespace has no open work on the old cluster, the team switches the remaining workers, clients and scheduled starters to the new service and removes the old endpoints from their configuration. They confirm through monitoring and visibility that no traffic still reaches the old cluster for that namespace. The output is a signed-off cutover record per namespace, listing the time each switch took effect and the owner who confirmed it.

  8. Decommission the old cluster after retention windows close

    The old cluster is kept read-only until the workflow history retention windows for its closed executions have passed, so that any lookup or audit need is still covered. The team then backs up what the business requires, shuts down the old services and removes its persistence and visibility data according to the retention and data handling policy. Confirm the retention periods with the owners of each namespace before the old cluster is removed, since they set the earliest safe date.

Parallel run and cutover between two Temporal Services

The diagram starts with clients and workers connected to the old Temporal Service and its persistence store, which keeps running existing executions. A new Temporal Service is built alongside it with its own persistence and visibility stores and a deliberately chosen history shard count. A routing decision sends new workflow starts to the new service while the old one drains its open executions. Check that workers poll both services during the overlap and that the old service is decommissioned only after its last execution has closed.

Parallel run: new starts move to the new service while the old one drains.

What drives the effort and cost of the rebuild

This table compares the drivers that size a shard-count rebuild, separating one-time build and migration work from costs that recur while two clusters run. Use it to see which inputs your quote depends on, and to decide where your own team or a partner should take on the work. Each driver is a question to answer in your environment before a written scope exists.

DriverWhy it changes effort or costOne-time or recurring
Namespaces and retention settingsEach namespace must be inventoried, recreated or replicated on the new cluster, and each retention period sets how long old history must stay readable during the move.One-time
Open and closed workflow volumeOpen executions must be drained or carried over, and closed history volume sets the size of any export, copy or retention decision.One-time
Workflow types and worker codebasesEvery client, worker and service that points at the old frontend address must be repointed and retested against the new cluster.One-time
Versioning and determinism of in-flight workflowsWorkflows already running on old code must keep replaying correctly, which can require versioning changes or a longer wait before cutover.One-time
Persistence and visibility backend choiceThe new cluster needs its own database and visibility store, and the choice determines schema setup, upgrade steps and capacity planning.One-time to set up, recurring to operate
TLS and authorization setupCertificates, mTLS settings, the authorizer and the claim mapper must be designed and configured again on the new cluster before any traffic moves.One-time
Testing depthLoad, failover, replay and restore tests on the new cluster set how much confidence is available before cutover and how many defects are found late.One-time
Parallel-run windowRunning both clusters keeps two sets of servers, databases and monitoring active until the old cluster is retired, which is the largest recurring cost of the move.Recurring while both run
Ongoing operations and on-callThe new cluster adds services, databases and alerts that someone must patch, monitor and staff, and the sizing choice affects how often scaling work happens.Recurring

What usually goes wrong during a shard migration

Shard migrations rarely fail on the server itself. They fail on decisions made around it: how the new cluster is sized, what stays exposed, how running workflows are handled, and when the old cluster is retired. Each card below names one of these risks and the check that prevents it.

Sizing from growth, not current load

Teams often size the new cluster for projected growth and skip the measurement of what the old cluster handles today. The shard count is fixed at first start, so a figure chosen too low or too high stays in place for the life of the cluster. Measure the current workflow start rate, open workflow count, and history size per shard on the old cluster, then agree the new count with the performance and scaling plan before the rebuild begins.

Production checklist

Leaving the old cluster exposed

The old cluster may still be reachable from networks it should not reach, and a self-hosted cluster with no Authorizer configured runs the default noopAuthorizer, which allows every API request. During a migration, both clusters run side by side, which doubles the surface to protect. Confirm that Temporal services sit on hosts without public internet reachability, restrict frontend access to trusted networks, and configure mTLS and an Authorizer on both clusters before any workflow moves.

Security docs

Mishandling in-flight workflows

Workflows that started on the old cluster may still be running when code changes for the new cluster are deployed. If workflow code changed in a way that breaks replay, those executions fail with non-determinism errors. Inventory open workflows by type and code version, decide whether each one drains on the old cluster or restarts on the new one, and use versioning patches for any workflow that must continue across a code change.

Testing visibility queries too late

Visibility queries that power dashboards, search and operator tools may behave differently on the new cluster if its visibility store, indexes or search attributes are not configured the same way. Teams often find this after cutover, when support staff cannot locate workflows. Build a list of the queries your tools run, execute each against the new cluster with migrated data, and confirm the results match what the old cluster returns.

Forgetting dynamic config and worker settings

Dynamic configuration, namespace settings, rate limits and worker connection details live outside the server's static configuration, so they are easy to omit from the new cluster. Workers pointed at the old frontend address will also stop receiving tasks after cutover if their configuration was not updated. Export dynamic config and namespace definitions from the old cluster, review each setting for the new cluster, and update every worker's target address and TLS settings in one tracked change.

Decommissioning before windows close

Retiring the old cluster too early can remove workflow histories that still need to be read, and it can strand workflows that were not fully drained. Completed workflows remain subject to the namespace retention period, so the old cluster should stay available until that period and the agreed drain window have passed. Set the decommission date from those two values, keep the old cluster read-only during the final window, and record the signoff that confirms nothing still depends on it.

Questions teams ask before changing shard count

Can we change the history shard count without downtime?

No, not in place. The numHistoryShards setting cannot be changed after the Temporal Service first starts, and later changes to it are ignored, according to the Temporal Service configuration reference. Temporal's production checklist says more shards require a rebuild and a migration to a new Temporal Service. So the realistic path is to stand up a second cluster with the higher count, move workflows to it, and retire the original. Whether your existing workflows can be drained with acceptable interruption depends on how long they run and how your workers and clients route traffic, which you should confirm with your own architecture review and with Temporal.

How much does a shard count rebuild cost, and what drives it?

No public figure for a rebuild is supplied here, so treat any number you see with caution. Costs fall into four groups: the new infrastructure (services, databases, and visibility store running in parallel during the move), engineering time to change client and worker routing, testing and cutover work, and ongoing operation of two clusters until the old one is retired. Infrastructure is recurring while both clusters run, so the overlap period matters as much as the build itself. The main cost drivers are the number of namespaces, the volume of open and recent workflows, how many services call Temporal, and how much cross-team coordination is needed. Ask any partner for a quote built from a written scope that lists these items separately.

How long does it take to move to a new cluster?

The supplied sources do not give a duration for this work, so plan from your own inventory rather than a general rule. The timeline is usually set by the slowest step: provisioning the new cluster, validating persistence and visibility, moving workers and clients, and waiting for in-flight workflows to finish on the old cluster. Long-running workflows extend the overlap period, and that is the part most likely to surprise teams. Ask for a plan that names the workflow types, their maximum run times, and the cutover order, and confirm the approach with Temporal before committing to a date.

What must our team provide for a shard count change?

Your team supplies the knowledge and access that an outside partner cannot infer. This includes an inventory of namespaces, workflow and activity types, task queues, worker deployments and their SDK versions, the current persistence and visibility backends, and the Temporal Server version. You also need access to the infrastructure you control, including the database, Kubernetes or host environment, network paths, and secrets. Finally, name owners who can approve cutover windows and confirm business impact for each workflow family. Missing inventory is the most common reason a move slips, so collect it before any build work starts.

Can our own team change the shard count, or should we hire a partner?

Your team can do this if it already runs self-hosted Temporal, has clear ownership of the database and Kubernetes or host layer, and can test workflow behavior during cutover. The work is less about a single command and more about careful sequencing: building the new service, moving workers and clients, handling workflows that are still running, and keeping a rollback path. Teams without recent operating experience often benefit from a fixed-scope engagement with written deliverables and a rehearsal plan. DeployOpen plans, implements, and documents self-hosted platforms in infrastructure you control, so the choice depends on the skills and capacity you already have.

Should we move to Temporal Cloud instead of rebuilding?

It is a fair question to answer before rebuilding, because a rebuild is also a migration. Temporal Cloud is a managed service sold by Temporal Technologies, and its pay-as-you-go pricing is published on the Temporal pricing page, with rates per million actions and per GB-hour of storage, plus support tiers quoted by sales. Self-hosted Temporal is MIT licensed, so you keep control of the infrastructure, but you carry the operating burden. Compare the total cost of each path, including staff time, data residency needs, and any compliance requirements that limit where data can run. Confirm the actual numbers with Temporal, since your action volume and storage will drive the result.

How do we avoid undersizing the shard count again?

Size the new cluster for growth you can document, not for today's load alone. Start by measuring current workflow throughput, the number of open executions, peak concurrency, and expected growth over the period you plan to run the cluster. Because the count cannot change later, record the reasoning in a design decision so future teams understand the trade-off. Then rehearse the move on a non-production copy, load test representative traffic, and watch persistence and history service metrics before cutover. Confirm the chosen value and its basis with Temporal's sizing guidance and your own load tests before you deploy.

When a partner helps and when your team can run it alone

Your platform team can carry most of the inventory and cutover mechanics. Listing every namespace, its workflow types, open executions, schedules, and the workers and task queues that poll them is routine work for engineers who already run the cluster. The same applies to repointing workers to the new frontend address, writing the runbook for draining and switching traffic, and keeping a record of which namespaces have moved. These tasks depend on knowing your own applications, so an internal team usually does them best. If your team has run Temporal in production and has a tested restore path for its persistence store, the move is a manageable project for that team.

Outside help is most useful where a wrong answer is expensive to undo. The new shard count is fixed at first start, so sizing it against realistic growth, including the number of workflow executions, history size per execution and expected throughput, deserves a second opinion before the cluster exists. Persistence and visibility design belongs in the same review, since the database and visibility store chosen for the new service determine its operating cost and failure modes. Security hardening is another area to bring in early: the self-hosted security documentation says that with no Authorizer configured, the default noopAuthorizer allows every API request, so the new service needs mTLS, a ClaimMapper, an Authorizer and network restriction decided before any production namespace is attached. A parallel-run test, where workflows execute on both clusters against the same workload, is worth an independent design and sign-off.

When you request a quote, ask for the written scope to separate these three groups explicitly: the work your team keeps, the sizing and design review, and the hardening and parallel-run testing with its acceptance criteria. Confirm with your own engineers which Temporal Server version and Helm chart version your current cluster runs, since the upgrade path and chart compatibility affect the new build. Fixed-scope engagements agree deliverables and timelines in writing before work starts, so you can see exactly what a partner will and will not own in your infrastructure.

How DeployOpen scopes and delivers a Temporal cluster migration

DeployOpen treats a shard count problem as a migration project, not a configuration change. We scope a new Temporal Service with a deliberate shard count, build it in infrastructure you control, and plan how workflows move across with testing, cutover and rollback defined before work starts.

How we scope

  • Inventory the current cluster's shard count, persistence store, visibility store and Temporal Server version before any design work begins.
  • Agree in writing which namespaces, workflow volumes and task queues move, and which stay on the old cluster.
  • Define the target shard count and sizing assumptions with your team, then document what the fixed-scope agreement covers and excludes.

How we build

  • Deploy the new Temporal Service in your environment with the chosen persistence, visibility and network controls, running on hosts not reachable from the public internet.
  • Configure authorization, mTLS and namespace roles before any production traffic is routed to the new cluster.
  • Test workflow migration on non-production namespaces, including worker deployment, replay behavior and rollback steps, and record the results.

How we hand over

  • Deliver runbooks for the cutover sequence, rollback conditions and verification checks, written for your operators to run.
  • Document the shard count decision, sizing inputs and the reasoning behind them so future capacity reviews start from a clear baseline.
  • Walk your platform and security teams through the architecture, access model and operational dashboards before the old cluster is retired.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers after the migration is complete.
  • Plan Temporal Server upgrades one minor version at a time, with schema changes applied before server upgrades when release notes require them.
  • Review capacity and shard sizing as workload grows, so a future migration is a planned decision rather than an emergency.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.