Neo4j

From GeilThings

Jump to: navigation, search
Neo4j
General
Version 1.9.RC2
Function Database
SQL NoSQL
Port 7474
Scripts
Start service neo4j-service start
Stop service neo4j-service stop


Contents

General

  • Provider: Neo Technology

Installing Neo4j

RAWNEWVERSION=`curl -d "action=ask&query=[[Neo4j]]|%3FStable&format=json" http://www.geilthings.com/api.php` 
NEWVERSION=`echo "$RAWNEWVERSION" | grep -Po '^.*?\K(?<=Stable\":\[\").*?(?=\")'`  
echo $NEWVERSION
 
cd /opt
wget http://dist.neo4j.org/neo4j-community-${NEWVERSION}-unix.tar.gz
tar zxvf neo4j-community-${NEWVERSION}-unix.tar.gz
cd /opt/neo4j-community-${NEWVERSION}
bin/neo4j install
ln -s /opt/neo4j-community-${NEWVERSION} /opt/neo4j

Running Neo4j

# Get version.
curl http://localhost:7474/db/data/
# Answer:
{
  "cypher" : "http://localhost:7474/db/data/cypher",
  "relationship_index" : "http://localhost:7474/db/data/index/relationship",
  "node" : "http://localhost:7474/db/data/node",
  "relationship_types" : "http://localhost:7474/db/data/relationship/types",
  "neo4j_version" : "1.8.M04-1-g892e348",
  "batch" : "http://localhost:7474/db/data/batch",
  "extensions_info" : "http://localhost:7474/db/data/ext",
  "node_index" : "http://localhost:7474/db/data/index/node",
  "reference_node" : "http://localhost:7474/db/data/node/0",
  "extensions" : {
    "CypherPlugin" : {
      "execute_query" : "http://localhost:7474/db/data/ext/CypherPlugin/graphdb/execute_query"
    },
    "GremlinPlugin" : {
      "execute_script" : "http://localhost:7474/db/data/ext/GremlinPlugin/graphdb/execute_script"
    }
  }
}

Upgrading Neo4j

RAWOLDVERSIONSCRIPT=`curl -s http://localhost:7474/db/data/`
OLDVERSION=`echo "$RAWOLDVERSIONSCRIPT" | grep -Po '^.*?\K(?<=neo4j_version\".:.\").*?(?=\")'`
echo $OLDVERSION
 
RAWNEWVERSION=`curl -sd "action=ask&query=[[Neo4j]]|%3FStable&format=json" http://www.geilthings.com/api.php` 
WEBNEWVERSION=`echo "$RAWNEWVERSION" | grep -Po '^.*?\K(?<=Stable\":\[\").*?(?=\")'`  
echo $WEBNEWVERSION
# Since 1.9-M01, their website version is major.minor-milestone, 
# but the name of the file to download contains major.minor.milestone.
# Substitute the "-" with a ".".
NEWVERSION=`echo $WEBNEWVERSION | awk '{gsub ( "[-]","." ) ; print $0 }'`
echo $NEWVERSION
 
cd /opt
wget http://dist.neo4j.org/neo4j-community-${NEWVERSION}-unix.tar.gz
tar zxvf neo4j-community-${NEWVERSION}-unix.tar.gz
 
cd /opt/neo4j-community-${NEWVERSION}
service neo4j-service stop
# Check.
ps aux | grep neo4j
 
cd /opt
/opt/neo4j/bin/neo4j remove
 
rm -f /opt/neo4j
ln -s /opt/neo4j-community-${NEWVERSION} /opt/neo4j
 
/opt/neo4j/bin/neo4j install
 
service neo4j-service start
 
# Message:
# WARNING: Max 1024 open files allowed, minimum of 40 000 recommended. See the Neo4j manual.
# Starting Neo4j Server...process [17105]... waiting for server to be ready...... OK.
# Go to http://localhost:7474/webadmin/ for administration interface.
 
# Check daemon is running.
ps aux | grep neo4j
 
# Check version.
RAWVERSIONSCRIPT=`curl -s http://localhost:7474/db/data/`
DIRTYVERSIONSCRIPT=`echo "$RAWVERSIONSCRIPT" | grep -Po '^.*?\K(?<=neo4j_version\".:.\").*?(?=\")'`
echo $DIRTYVERSIONSCRIPT

Issues

Neo4j 1.9.M05, 1.9.RC1, fail to start

  • After installing Neo4j 1.9.M05 or 1.9.RC1 community edition, attemp to restart the server fails:


service neo4j-service start
su: user neo4jwrapper.user.created=false does not exist
bin/utils: line 335: [: -lt: unary operator expected
Starting Neo4j Server...su: user neo4jwrapper.user.created=false does not exist
cat: /opt/neo4j/data/neo4j-service.pid: No such file or directory
process []... waiting for server to be ready. Failed to start within 120 seconds.
Neo4j Server may have failed to start, please check the logs.
rm: cannot remove `/opt/neo4j/data/neo4j-service.pid': No such file or directory


Solution: Modify the last line from the file conf/neo4j-wrapper.conf from

wrapper.user=neo4jwrapper.user.created=false


to

wrapper.user=neo4j
wrapper.user.created=false

Programming Neo4j

Versions

Software name Version number Version date
Neo4j 1.9.M05
1.9.M04
1.9.M03
1.9.M02
1.9.RC1
1.9.RC2
6 March 2013
19 January 2013
1 January 2013
14 December 2012
27 April 2013
18 May 2013

Obsolete

Neo4j 1.8.M04-M06: "install" command DOES NOT WORK in CentOS;

Installation fails with ... bin/neo4j: line 365: update-rc.d: command not found

update-rc.d is a Debian / Ubuntu command, see http://www.cyberciti.biz/faq/rhel5-update-rcd-command/

Workaround: See https://gist.github.com/2920262 and https://gist.github.com/2920283 (modify the files bin/neo4j and bin/utils so neo4j can be installed, run, and removed as a service). After modifying the files:

cd /opt/neo4j-community-${NEWVERSION}
bin/neo4j install centos

Comments

blog comments powered by Disqus