Wednesday, October 19, 2011

Oracle NoSQL Database - KVLite

Oracle NoSQL Database now available for downloads !!!, You can download and play it. Oracle NoSQL Database is a distributed key-value database. You can read more at this. However, You can download Oracle NoSQL Database and learn from Document.
$ file kv-1.1.100.tar.gz
kv-1.1.100.tar.gz: gzip compressed data, was "kv-1.1.100.tar", from Unix, last modified: Fri Oct 14 02:39:16 2011

$ tar zxf kv-1.1.100.tar.gz
$ cd kv-1.1.100
$ ls
bin doc examples lib LICENSE.txt README.txt

$ java -jar lib/kvclient-1.1.100.jar
11gR2.1.1.100
What is KVLite? It is a single-node, single Replication Group store. It usually runs in a single process and is used to develop and test client applications. It's for test.

A. How to start it? (use run-kvlite.sh script)
$ ./bin/run-kvlite.sh
Store "kvstore" started.
store name (default) =kvstore

KVLite (default values):
- The store name is kvstore.
- The hostname is 127.0.0.1.
- The registry port is 5000.
$ grep REGPORT\= bin/run-kvlite.sh
export REGPORT=5000
$ netstat -ltpn | grep 5000
tcp 0 0 :::5000 :::* LISTEN 2473/java
- The directory where Oracle NoSQL Database data is placed (known as KVROOT) is ./kvroot.
$ grep KVROOT\= bin/run-kvlite.sh
export KVROOT=./kvroot

$ ls kvroot
config.xml kvstore security.policy snaboot_0.log snaboot_0.log.lck
- Logging is not turned on.
- The administration process is not turned on.

B. How to stop it?
use ^C from within the shell where KVLite is running.

C. How to test it? (java version >= 6)
$ javac -g -cp lib/kvclient-1.1.100.jar:examples examples/hello/*.java
$ java -cp lib/kvclient-1.1.100.jar:examples hello.HelloBigDataWorld
Hello Big Data World!
I played it from "Getting Started Guides", then just play more:
$ ./bin/run-kvlite.sh -help
Usage: run-kvlite.sh [-help]
[-logging]
[-store storeName]
[-port port]
[-host hostname]
[-root rootDir]
[-admin adminPort]
-logging enables console logging
-store defaults to kvstore
-port defaults to 5000
-host defaults to localhost
-root defaults to ./kvroot and is created on demand
$ ./bin/run-kvlite.sh -admin 5001 -logging -root TEST

*** other screen ***
$ ls TEST
config.xml kvstore security.policy snaboot_0.log snaboot_0.log.lck
D. How to connect interactive mode? (when I use "-admin 5001" at KVLite, I will be able to connect interactive mode at port 5000 and open browser at port 5001 )
$ ./bin/kvctl runadmin -port 5000 -host localhost
kv-> show admins
admin1: Storage Node sn1, HTTP port 5001
kv-> show store
kvstore
Open Browser connect to http://ip:5001

If you review run-kvlite.sh script, you will see "java $LOGGING -cp $LIBDIR/kvstore-1.1.100.jar oracle.kv.util.kvlite.KVLite -root $KVROOT -store $KVSTORE -host $HOSTNAME -port $REGPORT $ADMINPORT".

OK... just fun with it, Oracle NoSQL Database.

No comments: