cockroach nodelocal upload command 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
The source file is only uploaded to one node, not all of the nodes.
CockroachDB now supports uploading files to a user-scoped file storage using a SQL connection. We recommend using
userfile instead of
nodelocal, as it is user-scoped and more secure.
Only members of the
admin role can run
cockroach nodelocal upload. By default, the
root user belongs to the
--external-io flag on the node you're uploading to cannot be set to
Upload a file:
$ cockroach nodelocal upload <location/of/file> <destination/of/file> [flags]
$ cockroach nodelocal upload --help
||The path to the certificate directory containing the CA and client certificates and client key.
||Reveal the SQL statements sent implicitly by the command-line utility.|
||The server host and port number to connect to. This can be the address of any node in the cluster.
||Use an insecure connection.
||A connection URL to use instead of the other arguments.
Default: no URL
||The SQL user that will own the client session.
Upload a file
To upload a file to the default node (i.e., the gateway node):
$ cockroach nodelocal upload ./grants.csv test/grants.csv --certs-dir=certs
successfully uploaded to nodelocal://1/test/grants.csv
Upload a file to a specific node
To upload a file to a specific node (e.g., node 2), use the
$ cockroach nodelocal upload ./grants.csv grants.csv --host=localhost:26259 --insecure
successfully uploaded to nodelocal://2/grants.csv
Or, use the
$ cockroach nodelocal upload ./grants.csv grants.csv --url=postgresql://root@localhost:26258?sslmode=disable --insecure
successfully uploaded to nodelocal://3/grants.csv