Saturday, October 23, 2021

Configuring Neo4j 4.x server on Windows


Configuring Neo4j 4.x server on Windows:

This is an update from a previous article based on Neo4j v3.x

Yes, there are plenty of tutorials for setting up Neo4j already, but I wanted to focus on a few settings that makes it easier to use it with data integration.

This tutorial will focus on Neo4j server for windows.  It is NOT very complicated, and you'll be up and running in no time flat:

What you need to before you begin
System Requirements:

  • Virtually all modern desktop/server OS are supported
  • JAVA (OpenJDK/OracleJDK/ZuluJDK) 11
  • Neo4j Server or Desktop Edition.For these instructions I used the community edition which you can download from https://neo4j.com/download-center/#community

  1. Extract the archive into the folder you want to be your installation folder
  2. Use an editor to modify /conf/neo4j.conf
    Setting
    Action
    Description
    #dbms.directories.import=import
    Comment out
    allows custom imports on-demand
    apoc.import.file.enabled=true
    dbms.security.procedures.allowlist=apoc.coll.*,apoc.load.*,gds.*,apoc.*
    dbms.security.procedures.unrestricted=apoc.schema.*
    add
    Allow APOC file imports
    and apoc procedures
    #dbms.memory.heap.initial_size=5g
    #dbms.memory.heap.max_size=5g
    #dbms.memory.pagecache.size=7g
    customize memory
    Memory configuration will depend on how large your graphDB will become.  Here's a good primer:
     
    https://neo4j.com/docs/operations-manual/current/tools/neo4j-admin-memrec/
    dbms.connectors.default_listen_address=0.0.0.0
    uncomment
    Allows non-local connections

  3. Example Configuration for Plugins*:
    Plugin
    Description
    Download URL
    Notes
    Don't ask, just install it.  No really!  You want this.
    Install binary .jar into /plugins folder:

    You need to MATCH the APOC version with the Neo4j version!
    MSSQL JDBC
    Add this if you need to connect to MS SQL
    Extract mssql-jdbc-9.x.x.jre11.jar into /plugins folder
    Excel (multiple file formats)
    If you need support to import from these formats download the dependencies
    https://repo1.maven.org/maven2/org/apache/poi/poi/5.0.0/poi-5.0.0-javadoc.jar
    https://repo1.maven.org/maven2/org/apache/poi/poi-ooxml/5.0.0/poi-ooxml-5.0.0.jar
    https://repo1.maven.org/maven2/org/apache/poi/poi-ooxml-schemas/4.1.2/poi-ooxml-schemas-4.1.2.jar
    https://repo1.maven.org/maven2/org/apache/xmlbeans/xmlbeans/5.0.2/xmlbeans-5.0.2.jar
    https://repo1.maven.org/maven2/com/github/virtuald/curvesapi/1.06/curvesapi-1.06.jar
    Place these .jar files into the /plugins folder
    Advantage Database JDBC
    To connect to Advantage (sybase) SQL  via JDBC
    This is to support the CRM I use (RangerMSP)

  4. *For most of my installations I ONLY install the APOC plugin.  This is because I typically use an ETL tool like Pentaho Data Integration for ingesting data from other sources (Excel, JDBC, etc), rather than natively from a Neo4j cypher query.  This makes it easier to manage security, tasks and jobs  rather than hard-coding right into a CYPHER statement.

  5. Configure Windows Service
    Neo4j should be configured to run as a Windows service. Launch a command shell, and install the service from within the /bin folder

    neo4j install-service

    If you are upgrading from an older version, you will need to first unregister the service for the old version:
    neo4j uninstall-service
      
  6. Set Initial Password
    neo4j-admin set-initial-password mysupersecretpassword

  7. Start the service
    sc start neo4j
    (or use the service control panel)

  8. Verify your installation.  Browse to http://127.0.0.1:7474
    username: neo4j
    password: <same as you supplied on step 5>


    That's it!  You should be ready to go with a neo4j server that's ready to connect to SQL Server, import from CSV/XLS files, and you will have the APOC library plugins at your disposal!

No comments:

Post a Comment

Have a comment? Would love to hear it!