问题
I am having difficulty doing a simple use case with Orientdb and teleporter
Stack:
OS: Windows 10 / Java: v8 / Orientdb: 2.2 beta2 / Teleporter: 1.0.0 / Database: MS SQL Express 2014
Setup:
- Installed, MS SQL Express 2014 with instance name SQL2014
- Created new db Graphdb with two tables, Country w/ PK Country ID and Province w/ PK Province ID and FK Country ID
- Installed, and start Orient db 2.2 beta 2
Created new oteleporter_graphdb.bat
oteleporter.bat -jdriver sqlserver -jurl jdbc:sqlserver://:54963;instance:SQL2014;databaseName:graphdb -juser sa -jpasswd -ourl plocal:$ORIENTDB_HOME/databases/graphdb -s naive -nr java -v 2
Test Case:
- Run oteleporter_graph.bat as-is
This test case read the db and created warnings for table’s part of sql metadata but Country & Province were not part of it.
Modify oteleporter_graph.bat to include both Country and Province table
oteleporter.bat -jdriver sqlserver -jurl jdbc:sqlserver://:54963;instance:SQL2014;databaseName:graphdb -juser sa -jpasswd -ourl plocal:$ORIENTDB_HOME/databases/graphdb -s naive -nr java -v 2 –include Country,Province
This test aborted!
Modify oteleporter_graph.bat to include only Country table.
oteleporter.bat -jdriver sqlserver -jurl jdbc:sqlserver://:54963;instance:SQL2014;databaseName:graphdb -juser sa -jpasswd -ourl plocal:$ORIENTDB_HOME/databases/graphdb -s naive -nr java -v 2 –include Country
This test case ran without any error but didn’t read any table from the database nor output anything out.
Questions:
- Am I missing any configuration steps?
- Test case #2, how to define multiple tables? Other questions:
- Possible to add filter to the tables?
- Instead of tables, views can be included? how would teleporter will identify the PKs / FKs?
Thanks in advance
回答1:
I'll try to answer your questions in order.
- To install and run Teleporter you have to:
- extract
orientdb-teleporter-1.0.0.jar
in yourORIENTDB_HOME/plugins
path. - extract the
oteleporter.bat
andoteleporter.sh
scripts in yourORIENTDB_HOME/bin
path and launch them from that location with the expected arguments.
- extract
- You can define filters on multiple tables simply by using the syntax you used:
-include <tableName1>,<tableName2>,...,<tableNameX>
but if you are running Teleporter on Windows probably you need to add quotes to the last argument, so try with:–include "Country,Province"
- Filters are possible with a "table-granularity", so you can filter-in or filter-out entire tables but not elements contained in them (e.g. columns). In the next versions probably will be possible manage the schema filtering with a finer granularity.
- Teleporter includes only materialized views (persistent in your database) in the migration and in this first version identifies PKs and FKs starting from the metadata present in the schema of your database. Thus if you don't define a FK between two tables you won't have edges between the correspondent vertices. In the next version of Teleporter will be possible the relationships defining through an input JSON.
If you have any doubt you can refer to official page, documentation and blog posts here:
http://orientdb.com/orientdb-labs/teleporter/ (Official Teleporter Page)
https://github.com/orientechnologies/orientdb-labs/blob/master/Teleporter-Index.md (Official Documentaion)
http://orientdb.com/orientdb-teleporter-making-migrations-easier/ (Blog Post: OrientDB Teleporter - Making Migrations Easier (Part 1) )
http://orientdb.com/orientdb-teleporter-making-migrations-easier-part-2/ (Blog Post: OrientDB Teleporter - Making Migrations Easier (Part 2) )
回答2:
I'm trying your case with these steps:
Copying
orientdb-teleporter-1.0.0.jar
into you/plugins
folder;Copying
oteleporter.bat
into you/bin
folder;Creating a new
graphdb
in MySQL with this structure:mysql> select * from province; +------------+--------------+-----------+ | provinceId | provinceName | countryId | +------------+--------------+-----------+ | 1 | Milano | 1 | | 2 | Parigi | 2 | +------------+--------------+-----------+ mysql> select * from country; +-----------+-------------+ | countryId | countryName | +-----------+-------------+ | 1 | Italia | | 2 | Francia | +-----------+-------------+
From the terminal, go to your
/bin
folder and run this command:oteleporter.bat -jdriver mysql -jurl jdbc:mysql://localhost:3306/graphdb -juser root -jpasswd MyPassword -ourl plocal:C:/path/to/graphdb -s naive -nr java -v 2
Run the
server.bat
;Go to Orient Studio:
Now you can see the tables correctly created in OrientDB.
Hope it helps
来源:https://stackoverflow.com/questions/36941543/orientdb-and-teleporter-issues