Posted in Graph Database

Cassandra Problems and VertexProgram Usage

VertexProgram in Tinkerpop 3

Submit a VertexProgram to a graph’s GraphComputer:
ComputerResult is a full copy of the original graph, or a view over the original raph. It alswo gets access to Memory (runtime, number of iterations, results of MapReduce jobs,etc).

(Found the example from Tinkerpop 3 doc)

gremlin> graph = TinkerFactory.createModern()
==>tinkergraph[vertices:6 edges:6]
gremlin> result = graph.compute().program(
==>result[tinkergraph[vertices:6 edges:0],memory[size:0]]
gremlin> result.memory().runtime
gremlin> g=result.graph().traversal(standard())
==>graphtraversalsource[tinkergraph[vertices:6 edges:0], standard]
gremlin> g.V().valueMap('name',PageRankVertexProgram.PAGE_RANK)
==>[gremlin.pageRankVertexProgram.pageRank:[0.15000000000000002], name:[marko]]
==>[gremlin.pageRankVertexProgram.pageRank:[0.19250000000000003], name:[vadas]]
==>[gremlin.pageRankVertexProgram.pageRank:[0.4018125], name:[lop]]
==>[gremlin.pageRankVertexProgram.pageRank:[0.19250000000000003], name:[josh]]
==>[gremlin.pageRankVertexProgram.pageRank:[0.23181250000000003], name:[ripple]]
==>[gremlin.pageRankVertexProgram.pageRank:[0.15000000000000002], name:[peter]]

Interacts with Java
(Well, this part seems useless >_< , you can scroll down, since it’s nearly the same with above)
1. Loading Data into a TinkerGraph

 InputStream in = new FileInputStream(“dataset/test.json&amp;amp;amp;amp;quot;); GraphSONReader reader =; reader.readGraph(in, g);

2. Use GraphComputer

 ComputerResult result = graph.compute().program(;

3. GraphTraversalSource

//GraphTraversalSource gts=result.graph().traversal();


{gremlin.pageRankVertexProgram.pageRank=[1.0822970208320357], name=[CANDYMAN]}
{gremlin.pageRankVertexProgram.pageRank=[1.9359906635483166], name=[HES GONE]}
{gremlin.pageRankVertexProgram.pageRank=[0.15000000000000002], name=[LAZY RIVER ROAD]}
{gremlin.pageRankVertexProgram.pageRank=[0.1902841984781851], name=[Keith_Godchaux]}
{gremlin.pageRankVertexProgram.pageRank=[0.5669931483069848], name=[BIRDSONG]}

When starting..

&amp;gt;&amp;gt;bin/ start
jps command not found. Put the JDK's jps binary on the command path.

So, here comes the prob:
What is jps command?

Java Virtual Machine Process Status Tool, provided by JDK which shows active PID java process. A powerful tool on linux/unix.
jps is on JAVA_HOME/bin/jps, you can also put JAVA_HOME/bin/ into the Path.


&amp;gt;&amp;gt; jps
23991 Jps
23789 BossMain
23651 Resin

This might because your JDK doesn’t contain the jps, I will suggest you to update your JDK. When you install your JDK, and use “tar -zxvf ..” you will see jps is included in the bin directory.

Cassandra problems:
I moved to a remote computer today, then I was facing some problems, but thanks to google.

1. Initial heap size set to a larger value than the maximum heap size.
Add an option in .bashrc (used for a local environment variable):

export _JAVA_OPTIONS=“-Xms2048M -Xmx4096M”

2. Cassandra Unable to create thrift socket to localhost/
Use >> bin/cassandra -f

3. Cassandra commit log FSWriteError. (Permission denied) or no such file: .xx.log
I checked the cassandra.yaml file, and found the commit log file location: commitlog_directory: db/cassandra/commitlog. Then I changed to another directory, and problem solved.
Did not find any ways to delete commit logs. I did not use “sudo” to start. Changing to another directory works but do not know the cause of this problem.

4. Other problems or error with port.
Change rpc_port: 9160 to a new one. (In conf/cassandra/cassandra.yaml file)



Keep calm and update blog.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s