This procedure describes how to use the Import to Model stage in a workflow to upload a model to a Neo4j Graph Database Server cluster.
The Neo4j Database Server cluster must be started and configured to work with Context Graph before you perform this procedure. To install a Neo4j Database Server cluster, see Installing a Cluster for Context Graph in the Spectrum Technology Platform
2023.1 Installation Guide.
- In Enterprise Designer, add the Import to Model stage to a workflow, and connect input and output ports to upstream and downstream stages.
- Configure stage options.
Option Description Entities tab Settings on this tab configure the entities that will be included in the imported model. For more information, see Entities tab. Relationships tab Settings on this tab configure relationships between source and target entities in the imported model. For more information, see Relationships tab. Options tab Specify an output directory on a local or shared drive. The Import to Model stage writes batch files into this directory that you run to import the model and data to the Neo4j database. For more information, see Options tab. - Run Import to Model job against the cluster to create the model metadata and import files.
- Install a stand-alone Neo4j Database Server on the cluster node where you ran the Import to Model job or on a different server.
-
Navigate to the path of the output folder that was defined in the Import to Model
stage.
If the stand-alone Neo4j Database Server was installed on a different server, copy the output folder to that server.
-
On the server that runs the Neo4j stand-alone instance, open the model folder and run
the appropriate script file.
Platform Run Windows modelname-timestamp_import.bat Linux modelname-timestamp_import.sh - When prompted, enter the path to the Neo4j instance /bin folder.
Note:If your data contains multiple line input fields, add the option --multiline-fields=true to the neo4j-admin import command in the modelname-timestamp_import.bat or or modelname-timestamp_import.sh file.
Example:
call %neopath%/neo4j-admin import --database Artists --multiline-fields=true --verbose
-
On the server that runs the Neo4j stand-alone instance, open the model folder and run
the appropriate dbinit script file.
Windows
SSL Certificate Run No None modelname-timestamp_dbinit.bat Yes Self-signed modelname-timestamp_dbinit_ssc.bat Yes Certificate authority modelname-timestamp_dbinit_s.bat Linux
SSL Certificate No None modelname-timestamp_dbinit.sh Yes Self-signed modelname-timestamp_dbinit_ssc.sh Yes Certificate authority modelname-timestamp_dbinit_s.sh -
When prompted, enter the user name and password for Neo4j.
Press Enter in each case if authentication is not set up for the Neo4j instance.
-
For the port number, enter the
Bolt connector
address.The default port setting for the Bolt connector address is7700
. This is defined on the Neo4j server in the Neo4j configuration settings file (neo4j.conf). - When prompted, enter the path to the /bin folder for the Neo4j instance.
-
When prompted, enter the user name and password for Neo4j.
-
On the server that runs the Neo4j stand-alone instance, configure the following
settings in the Neo4j.conf file:
dbms.backup.enabled=true dbms.backup.listen_address=0.0.0.0:6365
Note: Steps that follow are based on seeding a Neo4j cluster based on the Backup
and Restore commands. For other methods to seed a Neo4j cluster, see
Seed a cluster (Neo4j Operations Manual).
-
Run the
neo4j-admin database backup
command to create an online backup of the imported model on the stand-alone instance of Neo4j.The following command backs up the artists model database on a stand-alone instance of Neo4j:
neo4j-admin database backup artists --from=ipAddress/hostname:6365 --to-path=path-to-backup-folder - Confirm that the Neo4j Database Server cluster is started.
-
Use the model backup from the stand-alone Neo4j instance, and run the
neo4j-admin database restore
command to restore the model database on one of the core cluster nodes.The following command line restores the artists model database.
neo4j-admin database restore --from-path=path-to-backup-folder/artistsimport-2023-04-14T20-36-13.backup - Use the Neo4j Browser (http://localhost:7475/browser/) to connect to the cluster core node on which you ran the restore command.
- Select the system database and run SHOW SERVERS YIELD *.
- From the list of nodes, find the ServerId of the core node on which you ran the Restore command, and copy the ServerId.
-
From the system database run the CREATE DATABASE command to create
the model database.
The following example illustrates the Cypher
CREATE DATABASE artists options {existingData: 'use', existingDataSeedInstance: 'ServerId'};CREATE DATABASE
command to create the artists model database.The model database will replicate to the other core nodes in the cluster.Note: If the database is of considerable size, the execution of the command can take some time. You can reference the Neo4j logs to check the status. - Verify the model database is online on all members of the cluster.
After you complete this procedure, verify you can open and query a model using Context Graph Visualization.
Related information