Skip to content

Instantly share code, notes, and snippets.

@dawngerpony
Last active July 13, 2016 12:26
Show Gist options
  • Save dawngerpony/58d9cd44d4f033a7094ebdae67452585 to your computer and use it in GitHub Desktop.
Save dawngerpony/58d9cd44d4f033a7094ebdae67452585 to your computer and use it in GitHub Desktop.
Useful Neo4j CoCo commands
#!/bin/bash
while true; do
echo -n "RED: "; fleetctl ssh neo4j-red@1.service uptime
echo -n "BLUE: "; fleetctl ssh neo4j-blue@1.service uptime
sleep 15
done
neo4j-blue-sidekick@1.service 177bf386.../172.24.99.92 inactive dead
neo4j-blue@1.service 177bf386.../172.24.99.92 active running
neo4j-read-blue-sidekick@1.service 177bf386.../172.24.99.92 inactive dead
neo4j-read-red-sidekick@1.service 07c72444.../172.24.151.154 active exited
neo4j-red-sidekick@1.service 07c72444.../172.24.151.154 inactive dead
neo4j-red@1.service 07c72444.../172.24.151.154 active running
## measure resource usage on CoreOS box running Neo4j red.
fleetctl ssh neo4j-red@1.service top
## Check the status of all sidekick processes
fleetctl list-units | grep ^neo | grep sidekick | awk '{print $1;}' | xargs -I '{}' fleetctl status {}
## Stop all sidekick processes
fleetctl list-units | grep ^neo | grep sidekick | awk '{print $1;}' | xargs -I '{}' fleetctl stop {}
## Capture the load average of both neo4j boxes every 10 seconds ad infinitum
while true; do echo -n "RED: "; fleetctl ssh neo4j-red@1.service uptime; echo -n "BLUE: "; fleetctl ssh neo4j-blue@1.service uptime; sleep 10; done
## Moving the above script into its own file I can use tee to capture the output and send it to console as well for convenience.
./monitor-load.bash | tee load-average.out
## List all services that interact with Neo4j (read/writers and public API services, exclude sidekicks)
fleetctl list-units | egrep '(\-rw\-red|\-rw\-neo4j\-red|public\-[a-z]+\-api)' | grep -v sidekick
## Shut down all the above Neo4j-related services.
fleetctl list-units | egrep '(\-rw\-red|\-rw\-neo4j\-red|public\-[a-z]+\-api)' | grep -v sidekick | awk '{print $1;}' | xargs -I '{}' fleetctl stop {}
@dawngerpony
Copy link
Author

Listing public-api services:

$ fleetctl list-units | egrep '(public\-[a-z]+\-api)' | grep -v sidekick | awk '{print $1;}'
public-annotations-api@1.service
public-annotations-api@2.service
public-brands-api@1.service
public-brands-api@2.service
public-concordances-api@1.service
public-concordances-api@2.service
public-organisations-api@1.service
public-organisations-api@2.service
public-people-api@1.service
public-people-api@2.service
public-things-api@1.service
public-things-api@2.service

@dawngerpony
Copy link
Author

Starting public-api services:

fleetctl list-units | egrep '(public\-[a-z]+\-api)' | grep -v sidekick | awk '{print $1;}' | xargs -I '{}' fleetctl start {}

Checking status of rw/public-api services:

fleetctl list-units | egrep '(\-rw\-red|\-rw\-neo4j\-red|public\-[a-z]+\-api)' | grep -v sidekick | awk '{print $1;}' | xargs -I '{}' fleetctl status {} | egrep '( - |Active:)'

@dawngerpony
Copy link
Author

Starting all neo4j r/w services:

$ fleetctl list-units | egrep '(\-rw\-red|\-rw\-neo4j\-red)' | grep -v sidekick | awk '{print $1;}' | xargs -I '{}' fleetctl start {}
Unit brands-rw-neo4j-red@1.service launched on 177bf386.../172.24.99.92
Unit content-rw-neo4j-red@1.service launched on 5dfe683f.../172.24.78.235
Unit content-rw-neo4j-red@2.service launched on 5e5b2ea8.../172.24.135.151
Unit genres-rw-neo4j-red@1.service launched on 5e5b2ea8.../172.24.135.151
Unit industry-classifications-rw-neo4j-red@1.service launched on 177bf386.../172.24.99.92
Unit locations-rw-neo4j-red@1.service launched on 5e5b2ea8.../172.24.135.151
Unit locations-rw-neo4j-red@2.service launched on 177bf386.../172.24.99.92
Unit memberships-rw-neo4j-red@1.service launched on 973adfff.../172.24.2.162
Unit memberships-rw-neo4j-red@2.service launched on 5dfe683f.../172.24.78.235
Unit organisations-rw-neo4j-red@1.service launched on 973adfff.../172.24.2.162
Unit organisations-rw-neo4j-red@2.service launched on 177bf386.../172.24.99.92
Unit people-rw-neo4j-red@1.service launched on 5dfe683f.../172.24.78.235
Unit people-rw-neo4j-red@2.service launched on 973adfff.../172.24.2.162
Unit roles-rw-neo4j-red@1.service launched on 973adfff.../172.24.2.162
Unit roles-rw-neo4j-red@2.service launched on 177bf386.../172.24.99.92
Unit sections-rw-neo4j-red@1.service launched on 5e5b2ea8.../172.24.135.151
Unit sections-rw-neo4j-red@2.service launched on 973adfff.../172.24.2.162
Unit special-reports-rw-neo4j-red@1.service launched on 177bf386.../172.24.99.92
Unit special-reports-rw-neo4j-red@2.service launched on 5e5b2ea8.../172.24.135.151
Unit subjects-rw-neo4j-red@1.service launched on 973adfff.../172.24.2.162
Unit subjects-rw-neo4j-red@2.service launched on 5e5b2ea8.../172.24.135.151
Unit topics-rw-neo4j-red@1.service launched on 177bf386.../172.24.99.92
Unit topics-rw-neo4j-red@2.service launched on 5e5b2ea8.../172.24.135.151
Unit v1-annotations-rw-red@1.service launched on 973adfff.../172.24.2.162
Unit v1-annotations-rw-red@2.service launched on 177bf386.../172.24.99.92
Unit v2-annotations-rw-red@1.service launched on 5dfe683f.../172.24.78.235
Unit v2-annotations-rw-red@2.service launched on 973adfff.../172.24.2.162

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment