---
title: "Switch Operations to a Different Node"
url: "https://docs.ravendb.net/6.2/client-api/operations/how-to/switch-operations-to-a-different-node"
version: "6.2"
language: "php"
---

# Switch Operations to a Different Node

> Client language: PHP. Also available for [C#](https://docs.ravendb.net/6.2/client-api/operations/how-to/switch-operations-to-a-different-node.md), [Node.js](https://docs.ravendb.net/6.2/client-api/operations/how-to/switch-operations-to-a-different-node.nodejs.md).
>
> RavenDB publishes an official agent skill for coding assistants at https://docs.ravendb.net/skills/ravendb/SKILL.md (also installable with `npx skills add ravendb/skills`). The skill describes itself as: "Read this before writing any RavenDB query, client call or /databases/ request. Covers server setup, document modelling, the Node.js, .NET and Python clients, RQL, indexes, vector search and AI agents. Code written from recall tends to run and return the wrong rows, because RQL resembles SQL and the clients take field names as plain strings."

> **Note**
>
> - By default, when working with multiple nodes,  
>   all client requests will access the server node that is defined by the client configuration.  
>   (Learn more in: [Load balancing client requests](https://docs.ravendb.net/6.2/client-api/configuration/load-balance/overview.md)).
>
> - However, **server maintenance operations** can be executed on a specific node by using the `forNode` method.  
>   (An exception is thrown if that node is not available).
>
> - In this page:
>   - [Server-maintenance operations - ForNode](#server-maintenance-operations---fornode)

## Server maintenance operations - ForNode

- For reference, all server maintenance operations are listed [here](https://docs.ravendb.net/6.2/client-api/operations/what-are-operations.php.md#server-maintenance-operations).

```php
// Default node access can be defined on the store
$documentStore = new DocumentStore(
  ["ServerURL_1", "ServerURL_2", "..."],
  "DefaultDB"
);

$conventions = new DocumentConventions();

// For example:
// With ReadBalanceBehavior set to: 'FastestNode':
// Client READ requests will address the fastest node
// Client WRITE requests will address the preferred node
$conventions->setReadBalanceBehavior(ReadBalanceBehavior::fastestNode());
$documentStore->setConventions($conventions);

$documentStore->initialize();

try {
  // Use 'ForNode' to override the default node configuration
  // The Maintenance.Server operation will be executed on the specified node
  $dbNames = $documentStore->maintenance()->server()->forNode("C")
      ->send(new GetDatabaseNamesOperation(0, 25));
} finally {
  $documentStore->close();
}
```

**Syntax**:

```php
public function forNode(string $nodeTag): ServerOperationExecutor
```

| Parameters | Type | Description |
| - | - | - |
| **$nodeTag** | `string` | The tag of the node to operate on |

| Return Value | |
| - | - |
| `ServerOperationExecutor` | New instance of Server Operation Executor that is scoped to the requested node |

## See also

- [What are Operations](https://docs.ravendb.net/6.2/client-api/operations/what-are-operations.php.md)
