Introduction:
Insights has introduced a unique feature called Neo4j Scaling which helps to create read only replica database of your master neo4j. It will capture and persist all the Change Data Capture (CDC) events from the master neo4j in real time with least possible delay. The replica database will be used for dash boarding which will considerably reduce load on main write server. This feature helps to scale the master neo4j database within few clicks.
Prerequisites:
Insights >= v10.5
Insights supports Neo4j (4.4.4) database for this functionality.
Install neo4j streams plugin in all database servers (i.e. master & replicas)
Configure & set up Kafka server.
Only Admin can access this functionality.
Steps to set up Kafka:
Step 1: Download Kafka.
Step 2: Start the zookeeper.
bin/zookeeper-server-start.sh config/zookeeper.properties
Step 3: Start the Kafka.
bin/kafka-server-start.sh config/server.properties
Step 4: To monitor Kafka, download the Kafka-UI image from docker hub.
docker run -it -p 8080:8080 -e DYNAMIC_CONFIG_ENABLED=true --net=host provectuslabs/kafka-ui
For more info click here.
Steps to install neo4j streams plugin:
Step 1: Download the neo4j streams plugin.
Step 2: Create a streams.conf file inside $NEO4J_HOME/conf and add the below properties.
In Neo4j - CREATE INDEX on :DATA(uuid);
Keep the Master & Replica neo4j credentials same.
For more info click here.
App Server: On which Insights App is running.
Master Server: On which master Neo4j is running.
Replica Server: New server to scale master Neo4j.
Steps to set up SSH:
Steps to configure Replica Daemon Agent:
Download replicadaemon.zip from here present inside replicadaemon folder.
Similar to Agent Daemon, create a Replica Daemon directory inside /opt/Insights/insightsagents/ & unzip replicadaemon.zip there. Ex - /opt/Insights/insightsagents/replicadaemon
Provide executable and write permissions to that folder using chmod 755 replicadaemon
Copy InSightsReplicaDaemon.sh file & put it inside cd /etc/init.d/ using cp InSightsReplicaDaemon.sh /etc/init.d/InSightsReplicaDaemonAgent
Provide executable permission to InSightsReplicaDaemonAgent
To start replica daemon, execute the below command - sudo service InSightsReplicaDaemonAgent start
Steps to configure Neo4j Scaling:
Make sure Replica server is set up & neo4j is up & running on it.
Make sure Replica Daemon agent should be running.
Stop Neo4j on Master server & Insights Engine on App server.
Step 1: Navigate to Neo4j Scaling screen click on the configure button to configure source & replica details as shown below.
Step 2: After configuring source & replica details, click on the save button to save the configuration. Wait for few minutes & refresh the front screen, replica details will get displayed.
Step 3: To see the status logs, click on the details button. It will display resync status logs as shown below.
Step 4: Once you get “Replica resynced successfully” message in resync status logs.
Restart the Neo4j on Master server & Insights Engine on App server.
Step 5: To remove a replica, select that replica & click on the delete button. You can view the delete status log inside the additional details screen as shown below.
Make sure Replica server is set up & neo4j is up & running on it.
Stop Neo4j on Master server & Insights Engine on App server.
Step 6: To resync all replicas, click on the resync button. It will resync all replicas.