Oracle NoSQL

From GeilThings

Jump to: navigation, search
Oracle NoSQL
General
Version 2.0.26
Stable 2.1.8
Function Database
Provider Oracle
SQL NoSQL
Port 5000
Files
Config File /var/kvroot/config.xml
Log File /var/kvroot/*.log, /var/kvroot/<kvstorename>/log/*
Scripts
Start nohup java -jar /opt/kv/lib/kvstore.jar start -root /var/kvroot&
Cli kvstore.jar runadmin

Contents

General

Installation Oracle NoSQL

  • http://docs.oracle.com/cd/NOSQL/html/AdminGuide/install-config.html
  • This works for Oracle NoSQL 1.2.123 (after installing Java 1.6 or 1.7) under CentOS 5.7, 5.8, 6.2, 6.3, Solaris 11, Fedora 16, Debian 6.0.5, 6.0.6, OpenSUSE 12.1, Ubuntu 12.04, PC-BSD 9.0.
  • The Hostname needs to point to an IP address in /etc/hosts, otherwise while configuring the store the error could pop up:
    • Exception in thread "main" java.rmi.ConnectException: Connection refused to host: 80.156.86.78; nested exception is: java.net.ConnectException: Connection timed out
    • June 2012: The Deutsche Telekom provider in Germany redirect unknown hostnames to 62.157.140.133 and 80.156.86.78.


VERSION=1.2.123
KVROOT=/var/kvroot
KVHOME=/opt/kv-${VERSION}
 
MYHOSTNAME=$(hostname)
if grep -q $MYHOSTNAME /etc/hosts
then
    echo "Hostname exists in /etc/hosts. OK."
else
    echo "Hostname $MYHOSTNAME is missing in /etc/hosts."
    echo "You need a line pointing $MYHOSTNAME to an IP address in /etc/hosts for this script to work."
fi
 
# Create data directory if it does not exist.
if [ ! -d "${KVROOT}" ]
then
    mkdir -p ${KVROOT}
fi
 
cd /opt
# Download / Transfer the compressed file to /opt.
tar -zxvf  kv-ce-1.2.123.gz
cd /opt/kv-${VERSION}
 
# Create the "boot config" file.
java -jar ${KVHOME}/lib/kvstore-${VERSION}.jar makebootconfig -root ${KVROOT} -port 5000 -admin 5001 -host localhost -harange 5010,5020
# Two files will be created under KVROOT:
# config.xml
# security.policy
 
# Start the Oracle NoSQL Database Storage Node Agent (SNA) on each of the Oracle NoSQL Database nodes.
nohup java -jar ${KVHOME}/lib/kvstore-${VERSION}.jar start -root ${KVROOT}&
# The file nohup.out will be created under the directory from which nohup is run,
# in this case /opt/${KVHOME}.
# This file will contain the output of the java process.
 
# Verify.
ps aux | grep kv
## ... java -jar /opt/kv-1.2.123/lib/kvstore-1.2.123.jar start -root /var/kvroot
## ... /opt/jdk1.6.0_30/jre/bin/java -cp /opt/kv-1.2.123/lib/kvstore-1.2.123.jar 
##          -XX:+DisableExplicitGC -Xms96M -Xmx96M oracle.kv.impl.sna.ManagedService 
##          -root /var/kvroot -class Admin -service BootstrapAdmin.5000 -config config.xml
# or
jps -m
# Other java process will also appear here.
## ...
## ... kvstore-1.2.123.jar start -root /var/kvroot
## ... ManagedService -root /var/kvroot -class Admin -service BootstrapAdmin.5000 -config config.xml
## ...
 
# Ensure that the Oracle NoSQL Database client library can contact 
# the Oracle NoSQL Database Storage Node Agent (SNA).
java -jar ${KVHOME}/lib/kvstore-${VERSION}.jar ping -port 5000 -host localhost
## SNA at hostname: localhost, registry port: 5000 is not registered.
##         No further information is available
 
# Now configure the store.
java -jar ${KVHOME}/lib/kvstore-${VERSION}.jar runadmin -port 5000 -host localhost
 
# kv->configure mystore
# Not tried, since java starts anyway with a decent Xms of 96m:
# set policy "javaMiscParams=-server -d64 -XX:+UseCompressedOops -XX:+AlwaysPreTouch -Xms32m -Xmx32m -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:/tmp/gc-kv.log"
 
# A cache size of 16 MB (16777216) was accepted for version 1.2.123, starting with 2.0.22, the cache size must be at least 22 MB.
# It can be changed in the file /var/kvroot/mystore/sn1/config.xml
# Otherwise the error appears in the log file /var/kvroot/mystore/log/sn1_0.log:
# ... Exception creating service rg1-rn1:
# Cache size must be at least 22 MB, specified value is 16 MB: java.lang.IllegalArgumentException ...
# Ping (java -jar /opt/kv/lib/kvstore.jar ping -port 5000 -host localhost) would answer:
# ...Rep Node [rg1-rn1]      Status: UNREACHABLE
# instead of
# ...Rep Node [rg1-rn1]      Status: RUNNING,MASTER at sequence number: 41 haPort: 5011
 
# Set it to 32 MB:..
# kv->set policy "cacheSize=33554432"
# kv->plan -execute -name "Deploy YeysusOraNoSqlDC" deploy-datacenter "YeysusOraNoSqlDC"
# kv->plan -execute -name "Deploy node localhost" deploy-sn 1 localhost 5000 "LocalhostStorageNode"
# kv->plan -execute -name "Deploy admin" deploy-admin 1 5001
# kv->addpool mySNPool
# kv->joinpool mySNPool 1
# kv->plan -execute -name "Deploy the store" deploy-store mySNPool 1 1
# kv->show plans
# kv->show topology
# kv->quit
 
# Verify again:
java -jar ${KVHOME}/lib/kvstore-${VERSION}.jar ping -port 5000 -host localhost
## Pinging components of store mystore based upon topology sequence #5
## mystore comprises 1 partitions and 1 Storage Nodes
## Storage Node [sn1] on localhost:5000    Datacenter: YeysusOraNoSqlDC [dc1]    Status: RUNNING   Ver: 11gR2.1.2.123
##         Rep Node [rg1-rn1]      Status: RUNNING,MASTER at sequence number: 13 haPort: 5011
 
# All the parameters above will be stored in a config.xml file under
# /var/kvroot/mystore/sn1
 
# Stop the script if necessary using:
java -jar ${KVHOME}/lib/kvstore-${VERSION}.jar stop -root ${KVROOT}
 
# Links to facilitate administration.
rm -f /opt/kv
ln -s /opt/kv-${VERSION} /opt/kv
ln -s /opt/kv/lib/kvclient-${VERSION}.jar /opt/kv/lib/kvclient.jar
ln -s /opt/kv/lib/kvstore-${VERSION}.jar /opt/kv/lib/kvstore.jar
 
# Check version.
java -jar /opt/kv/lib/kvclient.jar

Configuration Oracle NoSQL

Backup

Upgrade Oracle NoSQL

APPNAME=oraclenosql
KVROOT=/var/kvroot
DATE=`date +%Y-%m-%d`
BACKUPROOT=/home/backup
 
RAWOLDVERSION=`java -jar /opt/kv/lib/kvclient.jar`
OLDVERSION=${RAWOLDVERSION:6}
echo ${OLDVERSION}
 
RAWNEWVERSION=`curl -sd "action=ask&query=[[Oracle NoSQL]]|%3FStable&format=json" http://www.geilthings.com/api.php` 
NEWVERSION=`echo "$RAWNEWVERSION" | grep -Po '^.*?\K(?<=Stable\":\[\").*?(?=\")'`  
echo $NEWVERSION
 
BACKUPDIR=${BACKUPROOT}/${APPNAME}/${APPNAME}_${OLDVERSION}_${DATE}
if [ ! -d "${BACKUPDIR}" ]
then
    mkdir -m 755 -p ${BACKUPDIR}
fi
 
# Stop the server before copying the data files.
java -jar /opt/kv/lib/kvstore.jar stop -root ${KVROOT}
 
# Backup all files.
cp -pr ${KVROOT}/* $BACKUPDIR/
 
cd /opt
# Get the file
wget http://download.oracle.com/otn-pub/otn_software/nosql-database/kv-ce-${NEWVERSION}.tar.gz
# File was downloaded once under the name 
# kv-ce-2.0.22.tar.gz\?AuthParam\=1353618513_5169aa70b804893878569c58c27e411d
# On a VirtualBox machine running under Debian, the file was downloaded with the correct name, kv-ce-2.0.22.tar.gz
# ???
mv kv-ce-${NEWVERSION}.* kv-ce-${NEWVERSION}.tar.gz
tar -zxvf kv-ce-${NEWVERSION}.tar.gz
cd kv-${NEWVERSION}
 
# Links to facilitate administration.
rm -f /opt/kv
ln -s /opt/kv-${NEWVERSION} /opt/kv
ln -s /opt/kv/lib/kvclient-${NEWVERSION}.jar /opt/kv/lib/kvclient.jar
ln -s /opt/kv/lib/kvstore-${NEWVERSION}.jar /opt/kv/lib/kvstore.jar
 
# Check version.
java -jar /opt/kv/lib/kvclient.jar
 
# Following the instructions from the Admin Guide,
# Chapter: Updating an Existing Oracle NoSQL Database Deployment
# http://docs.oracle.com/cd/NOSQL/html/AdminGuide/Oracle-NoSQLDB-Admin.pdf
# Simply restart
nohup java -jar /opt/kv/lib/kvstore.jar start -root ${KVROOT}&
 
# Verify.
java -jar /opt/kv/lib/kvstore.jar ping -port 5000 -host localhost

Programming Oracle NoSQL


Versions

Software name Version number Version date
Oracle NoSQL 2.0.22
2.0.23
2.0.26
22 November 2012
12 January 2013
31 January 2013

Comments

blog comments powered by Disqus


Author: Jesus del Valle