Install Neo4j VM#

Caution

Use of Neo4j is deprecated in 2.12.0, but is still required for EclecticIQ Intelligence Center 2.x to run.

For more information, see Release notes 2.12.0.

Note

Neo4j is not bundled with the EclecticIQ Platform VM image.

Install Neo4j before starting working with EclecticIQ Platform.

To install Neo4j manually, you need to log in to the platform OS, and then run the installation procedure from the terminal or the command line.

To successfully execute commands in the command line or in the terminal, you may require root-level access rights.

Before you install Neo4j#

  1. Check if Neo4j is installed:

    yum info neo4j
    
  2. Verify that no Neo4j-related services or processes are running.

    If Neo4j is not installed, eclecticiq-neo4jbatcher should either not be included in the returned list of services, or it should not be running if it is included:

    systemctl status neo4j
    

Set up yum.repos.d entry#

Set up the following yum.repos.d entry to add EclecticIQ-provided packages for Neo4j:

  1. Define a set of core variables to access the necessary assets and resources:

    eiq_repo_user=${your EclecticIQ user name to access the repository} # Contact EclecticIQ to request this information.
    eiq_repo_pass=${your EclecticIQ password to access the repository}  # Contact EclecticIQ to request this information.
    repos_protocol=https
    repos_root=downloads.eclecticiq.com
    repos_component=2.9
    platform_deps_path=platform-dependencies-centos-2.9
    platform_repo_path=platform-packages-centos
    key_path=public/GPG-KEY-eclecticiq
    
  2. Create a YUM configuration file with the repository information.

    In the file, replace the ${placeholder} placeholders with appropriate values, as defined in the core variables:

    # Create and populate a YUM repo file for the platform dependencies
    cat << EOF > /etc/yum.repos.d/platform-dependencies-centos.repo
    [platform-dependencies-centos]
    name=platform-dependencies-centos
    baseurl=${repos_protocol}://${repos_root}/${platform_deps_path}
    enabled=1
    priority=1
    username=${eiq_repo_user}
    password=${eiq_repo_pass}
    gpgkey=${repos_protocol}://${repos_root}/${key_path}
    EOF
    
  3. Update and set user name and password as needed, based on your system environment.

  4. Clean YUM package information for all configured sources:

    # Update package listing
    yum clean expire-cache
    

Install Neo4j#

  • Install Neo4j:

    # Install Neo4j
    yum -y --disablerepo=* --enablerepo="platform-dependencies-centos-2.9,base" install neo4j
    

Set up Neo4j#

Set the Neo4j environment variables#

  1. Set up a profile file for Neo4j where you define the following environment variables:

    echo -e 'export NEO4J_HOME=/usr/share/neo4j\nexport PATH=$PATH:$NEO4J_HOME/bin' > /etc/profile.d/neo4j.sh
    
  2. Reload the Neo4j profile to update it, so that it can pick up the newly defined environment variables:

    source /etc/profile.d/neo4j.sh
    
  3. Make sure these environment variables are accessible to the neo4j user, neo4j group profile.

    su -s /bin/bash neo4j -c 'echo $NEO4J_HOME; echo $PATH'
    
    # Output example
    /usr/share/neo4j /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr/share/neo4j
    

Set the data directory#

  • Set and export the data_dir variable to designate your desired common directory for data mount points.

    By default, the platform sets he common data directory to media:

    data_dir=/media
    

Configure Neo4j#

  • Set the Neo4j graph database location to your data directory:

    # Set Neo4j database location
    mkdir -p ${data_dir}/neo4j/
    chown -R neo4j:neo4j ${data_dir}/neo4j
    sed -ri 's|^(\s*dbms.directories.data\s*=).*|\1'${data_dir}/neo4j'|g' /etc/eclecticiq-neo4j/neo4j.conf
    

Disable Neo4j remote shell#

  • For security reasons, disable remote shell for Neo4j:

    # Disable Neo4j remote shell
    sed -i '/^\s*dbms.shell.enabled\s*=/d' /etc/eclecticiq-neo4j/neo4j.conf
    echo "dbms.shell.enabled=false" >> /etc/eclecticiq-neo4j/neo4j.conf
    

Enable the service#

  1. Enable the Neo4j service to automatically start at system boot:

    systemctl enable neo4j
    
  2. Start Neo4j:

    systemctl start neo4j
    
  3. Check if Neo4j is running:

    systemctl status neo4j
    

Configure Neo4j authentication#

  1. Set a Neo4j password for the neo4j:neo4j user and group:

    # Set Neo4j password
    curl -H "Content-Type: application/json" -X POST -d '{"password":"'${neo4j_pass}'"}' -u neo4j:neo4j http://localhost:7474/user/neo4j/password
    
  2. Update the platform configuration:

    # Configure Neo4j credentials in platform settings
    sed -ri 's/^\s*(NEO4J_USER\s*=\s*).*/\1'\'neo4j\''/g' /etc/eclecticiq/platform_settings.py
    sed -ri 's/^\s*(NEO4J_PASSWORD\s*=\s*).*/\1'\'${neo4j_pass}\''/g' /etc/eclecticiq/platform_settings.py
    

Create the Neo4j graph schema#

  1. Before creating the graph schema, stop systemd-managed graph ingestion and intelligence ingestion tasks.

    To stop systemd-managed platform services through the command line:

    systemctl stop eclecticiq-platform-backend-services
    
  2. Then, run the following command to create the graph schema and to apply the necessary graph database migrations to the Neo4j database:

    # Create the graph schema / Apply graph database migrations
    EIQ_PLATFORM_SETTINGS=/etc/eclecticiq/platform_settings.py /opt/eclecticiq-platform-backend/bin/eiq-platform graph upgrade
    

Reload systemd configurations#

At this point Neo4j is installed, and it should use the correct configuration files to work with the platform.

  1. After editing or updating systemd-managed unit configuration files, you must restart all systemd-managed platform services.

    It enables systemd to reload all configurations, and to apply any changes to make them effective.

    To restart systemd-managed platform services through the command line:

    systemctl restart eclecticiq-platform-backend-services
    
  2. Verify that the eclecticiq-neo4jbatcher is up and running:

    systemctl status neo4jbatcher.service
    

    The response should report that the service is loaded, active, and running

Test Neo4j in the UI VM#

As a final check, sign into the web-based UI to make sure that the graph is up and running, and that it is working correctly. you can add entities to graph.

  1. Check the system health.

    The status of the following processes should be green ✅:

    • graph-ingestion

    • intel-ingestion

    • eclecticiq-neo4jbatcher

    The status of the following service should be green ✅:

    • neo4j

  2. Add some entities to the graph to make sure that the graph loads them and displays them correctly.

  3. Create one or two new test entities using the entity editor, and then load them on the graph to make sure it works as expected.