cockroach nodelocal upload uploads a file to the external IO directory on a node’s (the gateway node, by default) local file system.
This command takes in a source file to upload and a destination filename. It will then use a SQL connection to upload the file to the node’s local file system, at externalIODir/destination/filename.
The source file is only uploaded to one node, not all of the nodes.
CockroachDB now supports uploading files to a using a SQL connection. We recommend using
userfile instead of nodelocal, as it is user-scoped and more secure.Required privileges
Only members of theadmin role can run cockroach nodelocal upload. By default, the root user belongs to the admin role.
Considerations
The flag on the node you’re uploading to cannot be set todisabled.
Synopsis
Upload a file:Flags
| Flag | Description |
|---|---|
--certs-dir | The path to the containing the CA and client certificates and client key. Env Variable: COCKROACH_CERTS_DIRDefault: ${HOME}/.cockroach-certs/ |
--echo-sql | Reveal the SQL statements sent implicitly by the command-line utility. |
--host | The server host and port number to connect to. This can be the address of any node in the cluster. Env Variable: COCKROACH_HOSTDefault: localhost:26257 |
--insecure | Use an insecure connection. Env Variable: COCKROACH_INSECUREDefault: false |
--url | A to use instead of the other arguments. Env Variable: COCKROACH_URLDefault: no URL |
--user-u | The that will own the client session. Env Variable: COCKROACH_USERDefault: root |
Examples
Upload a file
To upload a file to the default node (i.e., the gateway node):Upload a file to a specific node
To upload a file to a specific node (e.g., node 2), use the--host flag:
--url flag:

