liutec/neo4jtransfer
Composer 安装命令:
composer require liutec/neo4jtransfer
包简介
Neo4j Transfer
README 文档
README
Directly transfer nodes and relations between Neo4j servers or backup/restore entire databases to/from files.
Building
This tool may be built as a stand-alone phar file by using the following commands:
git clone https://github.com/liutec/neo4jtransfer.git
cd neo4jtransfer
composer install
./bin/build
./neo4jtransfer.phar help
Commands and arguments
The following commands are available:
The dump command
Dump all nodes and relations from a Neo4j database into a cypher file.
Dump command example
The following command will dump all nodes and relations from neo4j1-prod into a file. (eg. dump-neo4j1-prod-20160615-233212.cypher)
./neo4jtransfer.phar dump --output=default --source-host=neo4j1-prod
Dump command arguments
| Argument | Default value | Description |
|---|---|---|
--source-host |
localhost |
Neo4j source server hostname. |
--source-port |
7474 |
Neo4j source server port. |
--source-user |
neo4j |
Neo4j source server username. |
--source-password |
neo4j |
Neo4j source server password. |
--output |
STDOUT |
Cypher output filename. If unspecified, will use STDOUT. Set to default to use dump-[source-host]-[yyyyMMdd]-[hhmmss].cypher |
--read-batch-size |
300 |
The number of nodes and relations to read at once. |
--node-batch-size |
100 |
The number of nodes to write as part of a single cypher query or batch. |
--relation-batch-size |
150 |
The number of relations to write as part of a single cypher query or batch. |
--ignore-relation-properties |
none |
Comma separated values of properties to be ignored for relations. . (eg. creationDate,modificationDate) |
--preserve-ids |
none |
Comma separated list of label attributes to treat as Node IDs. (eg. Job.ownerId,Action.userId) |
--clean |
true |
Set to false not to clean target database before importing. By default all nodes and relations will be removed. |
--transactional |
false |
Set to true to wrap all cyphers in a transaction. Non-transactional by default. |
--import-label |
_ilb |
The name of the label set on imported nodes to create a temporary index with which to quicker identify nodes when transferring relations. This label and the index on it will be removed after the import. |
--import-id-key |
_iid |
The name of the key used to hold the node IDs as imported. This attribute and the index on it will be removed after the import. |
The import command
Run cypher queries from a file.
Import command example
The following command will look for the latest dump corresponding to the neo4j1-prod host (eg. dump-neo4j1-prod-20160615-233212.cypher) and execute the cypher queries within onto the Neo4j database on localhost.
./neo4jtransfer.phar import --input=last:neo4j1-prod
Import command arguments
| Argument | Default value | Description |
|---|---|---|
--input |
STDIN |
Cypher input filename. If unspecified, will use STDIN. Set to last:[hostname] to use dump-[hostname]-[yyyyMMdd]-[hhmmss].cypher with the latest timestamp. |
--target-host |
localhost |
Neo4j target server hostname. |
--target-port |
7474 |
Neo4j target server port. |
--target-user |
neo4j |
Neo4j target server username. |
--target-password |
neo4j |
Neo4j target server password. |
The direct transfer command
Transfer nodes and relations from one Neo4j database into another without an intermediary dump file.
Direct transfer command example
The following command will transfer all nodes and relations from neo4j1-prod into app1-dev within a single transaction.
./neo4jtransfer.phar direct --source-host=neo4j1-prod --target-host=app1-dev --transactional
Direct transfer command arguments
| Argument | Default value | Description |
|---|---|---|
--source-host |
localhost |
Neo4j source server hostname. |
--source-port |
7474 |
Neo4j source server port. |
--source-user |
neo4j |
Neo4j source server username. |
--source-password |
neo4j |
Neo4j source server password. |
--target-host |
localhost |
Neo4j target server hostname. |
--target-port |
7474 |
Neo4j target server port. |
--target-user |
neo4j |
Neo4j target server username. |
--target-password |
neo4j |
Neo4j target server password. |
--read-batch-size |
300 |
The number of nodes and relations to read at once. |
--node-batch-size |
100 |
The number of nodes to write as part of a single cypher query or batch. |
--relation-batch-size |
150 |
The number of relations to write as part of a single cypher query or batch. |
--ignore-relation-properties |
none |
Comma separated values of properties to be ignored for relations. . (eg. creationDate,modificationDate) |
--preserve-ids |
none |
Comma separated list of label attributes to treat as Node IDs. (eg. Job.ownerId,Action.userId) |
--clean |
true |
Set to false not to clean target database before importing. By default all nodes and relations will be removed. |
--transactional |
false |
Set to true to wrap all cyphers in a transaction. Non-transactional by default. |
The transfer command
Transfer nodes and relations from one Neo4j database into another and save all cypher queries to a dump file.
Transfer command example
The following command will transfer all nodes and relations from neo4j1-prod into app1-dev within a single transaction and create a dump file for backup. (eg. dump-neo4j1-prod-20160615-233212.cypher)
./neo4jtransfer.phar transfer --output=default --source-host=neo4j1-prod --target-host=app1-dev
Transfer command arguments
| Argument | Default value | Description |
|---|---|---|
--source-host |
localhost |
Neo4j source server hostname. |
--source-port |
7474 |
Neo4j source server port. |
--source-user |
neo4j |
Neo4j source server username. |
--source-password |
neo4j |
Neo4j source server password. |
--output |
STDOUT |
Cypher output filename. If unspecified, will use STDOUT. Set to default to use dump-[source-host]-[yyyyMMdd]-[hhmmss].cypher |
--target-host |
localhost |
Neo4j target server hostname. |
--target-port |
7474 |
Neo4j target server port. |
--target-user |
neo4j |
Neo4j target server username. |
--target-password |
neo4j |
Neo4j target server password. |
--read-batch-size |
300 |
The number of nodes and relations to read at once. |
--node-batch-size |
100 |
The number of nodes to write as part of a single cypher query or batch. |
--relation-batch-size |
150 |
The number of relations to write as part of a single cypher query or batch. |
--ignore-relation-properties |
none |
Comma separated values of properties to be ignored for relations. . (eg. creationDate,modificationDate) |
--preserve-ids |
none |
Comma separated list of label attributes to treat as Node IDs. (eg. Job.ownerId,Action.userId) |
--clean |
true |
Set to false not to clean target database before importing. By default all nodes and relations will be removed. |
--transactional |
false |
Set to true to wrap all cyphers in a transaction. Non-transactional by default. |
liutec/neo4jtransfer 适用场景与选型建议
liutec/neo4jtransfer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 84 次下载、GitHub Stars 达 1, 最近一次更新时间为 2016 年 06 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「dump」 「neo4j」 「backup」 「transfer」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 liutec/neo4jtransfer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 liutec/neo4jtransfer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 liutec/neo4jtransfer 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This package will add the `dd` and `dump` helpers to your Phalcon application.
Symfony integration for Neo4j
A SDK for working with B2 cloud storage.
Simple Twig extension improving templates debugging
nice output for debug functions for PHP 5.3
A sleek PHP wrapper around rclone with Laravel-style fluent API syntax
统计信息
- 总下载量: 84
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-06-12