Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
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)
# Install netcat
sudo yum install -y nc
su – [user_name]
cd /home/[user_name]/.ssh
# IF THE USER DOESN'T HAVE PUBLIC_KEY (id_rsa.pub). CREATE IT USING BELOW keygen COMMAND ELSE IGNORE.
ssh-keygen -t rsa
cd .ssh/
# CREATE AN App_Server_key FILE & PASTE THE PUBLIC_KEY (id_rsa.pub)
App_Server_key >> authorized_keys
App_Server_key file is critical & can be used further in below steps.
# Install netcat
sudo yum install -y nc
# CREATE A REPLICA_USER
sudo useradd replica_user
# CREATE A REPLICA_GROUP
sudo groupadd replica_group
usermod -aG replica_group replica_user
su – replica_user
cd/home/[replica_user]
# TO CREATE REPLICA_USER PUBLIC_KEY (id_rsa.pub)
ssh-keygen -t rsa
cd .ssh/
# CREATE A Replica1_Server_key FILE & PASTE PUBLIC_KEY (id_rsa.pub)
cat [App_Server_Key] >> authorized_keys (Copy App Server key)
chmod 600 authorized_keys
exit
Replica1_Server_key file is critical & can be used further in below steps.
# PROVIDING ONLY SPECIFIC PERMISSIONS TO SPECIFIC DIRECTORY & FILE.
sudo chgrp -R replica_group /opt/NEO4J_HOME/neo4j-Insights/data
chmod -R g+rw /opt/NEO4J_HOME/neo4j-Insights/data
sudo chgrp replica_group /opt/NEO4J_HOME/neo4j-Insights/conf/streams.conf
chmod g+rw /opt/NEO4J_HOME/neo4j-Insights/conf/streams.conf
visudo
Cmnd_Alias CUSTOM_SERVICES = /sbin/service Neo4j stop, /sbin/service Neo4j start, /sbin/service Neo4j status
replica_user ALL=NOPASSWD:CUSTOM_SERVICES
Be cautious while doing below steps. This may lead to login issue.
Don’t forget to add master_user (user which you use to login) in AllowUsers.
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 Replicaserver 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 theconfigurebuttonto 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.
Sample Testcase to test replica:
Testcase 1: Try to configure the replica database in Grafana as a datasource.
In url - http://<ReplicaServerIP>:7474/db/data/transaction/commit?includeStats=true