Wednesday 15 July 2015

jBase5 Virtualized!

jBase5 Virtualized!

Goal: To prove that jBase5 online backup restored to Delphix can be run as virtualized database.
Result: Done! Restored files are working just fine.

Delphix Express ingested jBase database.

Nuts & Bolts

Testbed Components  
  • Delphix Express 4.2.3.1
  • jBase 5.2.13
  • CentOS release 6.6 (Final) - VM
Database Host Configuration
  • jbaseadm user created
  • jBase installed in /opt/jbase5/5.2.13 from jbaseadm user
  • /home/jbase5 - database files folder
jBase Configuration
  • System dictionary created in /home/jbase5 { CREATE-FILE DICT SYSTEM 11 }
  • Account created in /home/jbase5/PLAY { CREATE-FILE DICT MD 29 }
  • Account added to System file { JED SYSTEM PLAY }
001 D
002 /home/jbase5/PLAY
    03 - 19 lines are null
020 ESYSTEM_START
021 jbase
022 /home/jbase5/PLAY
    23 - 27 lines are null
028 /home/jbase5/PLAY/MD]D
    29 - 36 lines are null
037 ESYSTEM_END
  • Some test files taken from /opt/jbase5/5.2/samples/SQL and moved to PLAY account folder
  • Environment variables configured

Scala Test Program

I have decided to test if database is working fine using simple Scala program. Program is connecting to jBase instance using JDBC interface and selecting some data from MYCUSTS database file.

Test Program Source

#!/bin/sh
exec scala -Dorg.slf4j.simpleLogger.logFile=../logs/jbase_jdbc_test_$(date "+%Y.%m.%d-%H.%M.%S").log -Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat="yyyy-MM-dd HH:mm:ss.S" -classpath "/opt/jbase5/5.2.13/java/lib/jbasejdbc.jar:../lib/slf4j-api-1.7.12.jar:../lib/slf4j-simple-1.7.12.jar:../lib/scala-logging_2.11-3.1.0.jar" "$0" "$@"
!#

println("jbase5 jdbc test")
println("Args: ")
args.foreach(println)
println("--")

import java.sql.{Connection, DriverManager, ResultSet, Date};
import java.util.{Calendar, Properties};
import com.typesafe.scalalogging.{Logger};
import org.slf4j.{LoggerFactory};

val logger = Logger(LoggerFactory.getLogger("jbase5_jdbc_test"))
val conn_str = "jdbc:jbase:thin:@localhost:20002/PLAY"
Class.forName("com.jbase.jdbc.driver.JBaseJDBCDriver")
val conn = DriverManager.getConnection(conn_str)
try {
  val queryBv = "select * from MYCUSTS";
  val statement = conn.prepareStatement(queryBv);
  val rs = statement.executeQuery();
  val rsMetaData = rs.getMetaData();
  println("Qry: "+queryBv)
  println("Number of columns: " + rsMetaData.getColumnCount());

  for (i <- 1 to rsMetaData.getColumnCount()) println("Col"+i+": "+rsMetaData.getColumnName(i))

  var i = 0
  while(rs.next() && i<5) {
    println(rs.getString(1) + ", " + rs.getString(2) + ", " + rs.getString(3) + ", " + rs.getString(4) + ", " + rs.getString(5) + ", " + rs.getString(6) + ", " + rs.getString(7) + ", " + rs.getString(8) + ", " + rs.getString(9));
        i +=1
  }
}
finally {
    conn.close
}

Virtualization Test Plan

  1. Execute jBase background processes.
  2. Execute test program to see if we get data selected.
  3. Execute jbackup on /home/jbase5 folder
  4. Stop jBase background processes.
  5. Move original /home/jbase5 to backup location.
  6. Provision from Delphix empty vFiles folder and mount it in /home/jbase5
  7. Restore backup executing jrestore. After restore we have our jBase files inside Delphix Engine.
  8. Start jBase backgroud processes.
  9. Execute test program to see if we get data selected. If we get out test output we are successful!

Test Steps - Details

  • Execute jBase background processes.
$ jbase_agent -p 20002 -F -A account &
# cd /opt/jbase5/5.2
# . jbase_env.sh
# jlogadmin -a On
# jRLA -ib
Execute test program to see if we get data selected.
# sh jbase_jdbc_test.sh
jbase5 jdbc test
Args:

--
Qry: select * from MYCUSTS
Number of columns: 15
Col1: RECID
Col2: FIRSTNAME
Col3: LASTNAME
Col4: ADDR1
Col5: ADDR2
Col6: CITY
Col7: STATE
Col8: ZIP
Col9: HOMETEL
Col10: WORKTEL
Col11: EMAIL
Col12: HARDWARE
Col13: OS
Col14: SYSTEMTYPE
Col15: NUMUSERS
0000041, ALAN, COOPER, 10260 SW GREENBURG RD, #1020, SEATTLE, WA, 24358, (124) 555-1337
0000041, ALAN, COOPER, 10260 SW GREENBURG RD, #1020, SEATTLE, WA, 24358, (124) 555-1337
0000041, ALAN, COOPER, 10260 SW GREENBURG RD, #1020, SEATTLE, WA, 24358, (124) 555-1337
0000041, ALAN, COOPER, 10260 SW GREENBURG RD, #1020, SEATTLE, WA, 24358, (124) 555-1337
0000041, ALAN, COOPER, 10260 SW GREENBURG RD, #1020, SEATTLE, WA, 24358, (124) 555-1337
Execute jbackup on /home/jbase5 folder
# find /home/jbase5 -print | sort | jbackup -W -v > /tmp/jbase5_w.bak
Stop jBase background processes.

Move original /home/jbase5 to backup location.
# mv /home/jbase5 /home/jbase5_sav
Provision from Delphix empty vFiles folder and mount it in /home/jbase5


Restore backup executing jrestore. After restore we have our jBase files inside Delphix Engine.

cat /tmp/jbase5_w.bak | jrestore -v
Start jBase backgroud processes.
$ jbase_agent -p 20002 -F -A account &
# cd /opt/jbase5/5.2
# . jbase_env.sh
# jlogadmin -a On
# jRLA -ib
Execute test program to see if we get data selected.
# sh jbase_jdbc_test.sh
jbase5 jdbc test
Args:

--
Qry: select * from MYCUSTS
Number of columns: 15
Col1: RECID
Col2: FIRSTNAME
Col3: LASTNAME
Col4: ADDR1
Col5: ADDR2
Col6: CITY
Col7: STATE
Col8: ZIP
Col9: HOMETEL
Col10: WORKTEL
Col11: EMAIL
Col12: HARDWARE
Col13: OS
Col14: SYSTEMTYPE
Col15: NUMUSERS
0000041, ALAN, COOPER, 10260 SW GREENBURG RD, #1020, SEATTLE, WA, 24358, (124) 555-1337
0000041, ALAN, COOPER, 10260 SW GREENBURG RD, #1020, SEATTLE, WA, 24358, (124) 555-1337
0000041, ALAN, COOPER, 10260 SW GREENBURG RD, #1020, SEATTLE, WA, 24358, (124) 555-1337
0000041, ALAN, COOPER, 10260 SW GREENBURG RD, #1020, SEATTLE, WA, 24358, (124) 555-1337
0000041, ALAN, COOPER, 10260 SW GREENBURG RD, #1020, SEATTLE, WA, 24358, (124) 555-1337
Working!!!

Starting from this point we can make snapshots of our virtualized jBase files and use all Delphix vFiles functionality to enjoy DaaS.

Conclusion

  • Virtualizing jBase files seems to be straightforward and works very well.
  • We can enjoy jBase DaaS with Delphix Engine.