Mark Needham

Thoughts on Software Development

Neo4j Backup: java.lang.ClassCastException: org.jboss.netty.buffer.BigEndianHeapChannelBuffer cannot be cast to

with 5 comments

(as Gabriel points out in the comments the ability to do a ‘HA backup’ doesn’t exist in more recent versions of Neo4j. I’ll leave this post here for people still running on older versions who encounter the error.)

When using Neo4j’s online backup facility there are two ways of triggering it, either by using the ‘single://‘ or ‘ha://‘ syntax and these behave slightly differently.

If you’re using the ‘single://’ syntax and don’t specify a port then it will connect to ‘6362’ by default:

./neo4j-backup -from single:// -to /mnt/backup/neo4j-backup

If you’ve changed the backup port via the ‘online_backup_server’ property in conf/ you’ll need to set the port explicitly:

./neo4j-backup -from single:// -to /mnt/backup/neo4j-backup

If you’re using the ‘ha://’ syntax then the backup client joins the HA cluster, works out which machine is the master and then creates a backup from that machine.

In order for the backup client to join the cluster it connects to port ‘5001’ by default:

./neo4j-backup -from ha:// -to /mnt/backup/neo4j-backup

If you’ve changed the ‘ha.cluster_server’ property then you’ll need to set the port explicitly:

./neo4j-backup -from ha:// -to /mnt/backup/neo4j-backup

A mistake that I made when first using this utility was to use the ‘ha://’ syntax with the backup port. e.g.

./neo4j-backup -from ha:// -to /mnt/backup/neo4j-backup

If you do this you’ll end up with the following exception:

2014-01-19 19:24:30.842+0000 ERROR [o.n.c.c.NetworkSender]: Receive exception:
java.lang.ClassCastException: org.jboss.netty.buffer.BigEndianHeapChannelBuffer cannot be cast to
	at$NetworkMessageSender.messageReceived( ~[neo4j-cluster-2.0.0.jar:2.0.0]
	at ~[netty-3.6.3.Final.jar:na]
	at ~[netty-3.6.3.Final.jar:na]
	at ~[netty-3.6.3.Final.jar:na]
	at ~[netty-3.6.3.Final.jar:na]
	at ~[netty-3.6.3.Final.jar:na]
	at ~[netty-3.6.3.Final.jar:na]
	at ~[netty-3.6.3.Final.jar:na]
	at java.util.concurrent.ThreadPoolExecutor.runWorker( [na:1.7.0_45]
	at java.util.concurrent.ThreadPoolExecutor$ [na:1.7.0_45]
	at [na:1.7.0_45]

Let me know in the comments if any of this doesn’t make sense. There are lots of other examples to follow on neo4j-backup’s man page in the manual as well.

Be Sociable, Share!

Written by Mark Needham

January 19th, 2014 at 7:29 pm

Posted in neo4j

Tagged with

  • Pingback: Neo4j Backup: Store copy and consistency check at Mark Needham()

  • Gabriel Deak

    Hi there, we have found your post and have a question.
    You said ./neo4j-backup -from ha:// -to /mnt/backup/neo4j-backup will detect which cluster node is the master. Firstly, the neo4j documentation does not mention this method. Second, we have tested this and it seems the script does not detect the master, it just runs a backup oh itself. Third, you say port 5001 is used for this. We were not able to run the script until we configure the following: online_backup_enabled=true, online_backup_server=, this was part of the default config (default wad, so it seems it is actually using port 6362.

    Any idea on this?

  • Hi,

    Yeh the behaviour of the backup tool has changed since I wrote this post so you have to choose a specific machine to backup from as you suggested. The HA approach has been removed.


  • Gabriel Deak

    Thanks Mark. I guess your previous post should be amended in case somebody else tries to use the method mentioned. Is there a reason why the backup tool has been completely changed? It makes more sense to have this functionality, especially with a cluster being recommended.

  • @gabrieldeak:disqus it used to cause too many problems / confusion as the backup client would have to join the cluster and temporarily be a member for the duration of the backup. It was operationally simpler to remove the feature.