mirror of https://gitee.com/bigwinds/arangodb
87 lines
3.2 KiB
Plaintext
87 lines
3.2 KiB
Plaintext
Exporting Data from an ArangoDB database
|
|
======================================
|
|
|
|
To export data from an ArangoDB server instance, you will need to invoke _arangoexport_.
|
|
_arangoexport_ can be invoked by executing
|
|
the following command:
|
|
|
|
unix> arangoexport --collection test --output-directory "dump"
|
|
|
|
This exports the collections *test* into the directory *dump* as one big json array. Every entry
|
|
in this array is one document from the collection without a specific order. To export more than
|
|
one collection at a time specify multiple *--collection* options.
|
|
|
|
The default output directory is *export*.
|
|
|
|
_arangoexport_ will by default connect to the *_system* database using the default
|
|
endpoint. If you want to connect to a different database or a different endpoint,
|
|
or use authentication, you can use the following command-line options:
|
|
|
|
* *--server.database <string>*: name of the database to connect to
|
|
* *--server.endpoint <string>*: endpoint to connect to
|
|
* *--server.username <string>*: username
|
|
* *--server.password <string>*: password to use (omit this and you'll be prompted for the
|
|
password)
|
|
* *--server.authentication <bool>*: whether or not to use authentication
|
|
|
|
Here's an example of dumping data from a non-standard endpoint, using a dedicated
|
|
[database name](../Appendix/Glossary.md#database-name):
|
|
|
|
unix> arangoexport --server.endpoint tcp://192.168.173.13:8531 --server.username backup --server.database mydb --collection test --output-directory "my-export"
|
|
|
|
When finished, _arangoexport_ will print out a summary line with some aggregate
|
|
statistics about what it did, e.g.:
|
|
|
|
Processed 2 collection(s), wrote 9031763 Byte(s), 78 HTTP request(s)
|
|
|
|
|
|
Export JSON
|
|
-----------
|
|
|
|
unix> arangoexport --type json --collection test
|
|
|
|
This exports the collection *test* into the output directory *export* as one json array.
|
|
|
|
Export JSONL
|
|
------------
|
|
|
|
unix> arangoexport --type jsonl --collection test
|
|
|
|
This exports the collection *test* into the output directory *export* as jsonl. One line is one document as a json.
|
|
|
|
Export XGMML
|
|
------------
|
|
## XGMML specific options
|
|
|
|
*--xgmml-label-attribute* specify the name of the attribute that will become the label in the xgmml file.
|
|
|
|
*--xgmml-label-only* set to true will only export the label without any attributes in edges or nodes.
|
|
|
|
|
|
## export with collection defined
|
|
|
|
unix> arangoexport --type xgmml --graph-name mygraph --collection vertex --collection edge
|
|
|
|
This exports the a unnamed graph with vertex collection *vertex* and edge collection *edge* into the xgmml file *mygraph.xgmml*.
|
|
|
|
|
|
## export with graph defined
|
|
|
|
unix> arangoexport --type xgmml --graph-name mygraph
|
|
|
|
This exports the named graph mygraph into the xgmml file *mygraph.xgmml*.
|
|
|
|
|
|
## export XGMML without attributes
|
|
|
|
unix> arangoexport --type xgmml --graph-name mygraph --xgmml-label-only true
|
|
|
|
This exports the named graph mygraph into the xgmml file *mygraph.xgmml* without the *<att>*
|
|
|
|
|
|
## export XGMML with a specific label
|
|
|
|
unix> arangoexport --type xgmml --graph-name mygraph --xgmml-label-attribute name
|
|
|
|
This exports the named graph mygraph into the xgmml file *mygraph.xgmml* with a label from documents attribute *name* instead of the default attribute *label*
|