Sharing my experiences in Oracle + Linux + Perl + Java + Networking + High-Availability + Clusters
Thursday, March 22, 2012
Tuesday, September 20, 2011
Generating RSA SecurID Software Token for iPhone Devices/Windows Mobile/Android
So if your company decided to discontinue the RSA Hardtoken and moved on with SoftTokens; that requires installation and configuration of the softtoken on a PC. Although it's a onetime configuration, the issue occurs if you are outside at a friends/relatives place where in you had a need to login remotely, same installation+configuration will need to be done at your guest PC before you can generate a soft token and login!
But if you have an iPhone/Android or Windows Mobile, you can install the RSA app and with just few steps you can generate token code off your phone.
Here are the steps in nutshell, you can find detailed steps from RSA website.
1. Search and install the "RSA" app in your phone.
2. Click here to download the TokenConverter from RSA website.
3. Extract the contents to a directory.
4. Copy the .sdtid file that you recieved from your RSA support/company to this directory. Along with the
.sdtid file the directory will contain a sdti2tsf.dll and TokenConverter.exe
5. Open up a cmd (command shell), cd to this directory and run the below command.
TokenConverter user2-passwordtoken_file.sdtid -p password_for_the_token -mobile -o token.txt
6. Copy the contents from the token.txt file and copy to your gmail/yahoo/hotmail account(configured on your phone).
The CTF string would like something like below
com.rsa.securid.iphone://ctf?ctfData=20000206816472066313601117043277446107647716463
2456201026172115044046062716712650
After pasting it to the browser, select the string and click on hyper link and send yourself an e-mail
7. Login to your e-mail from your phone, click on this hyper link and it will prompt of the same password for token.
And you are good to go.
Hope this helps. Raj
Tuesday, September 6, 2011
Helpful Linux Commands/Linux tips-tricks
-- To list file with line number
nl <filename>
-- Saves man pages to text
man cat | col -b > less.txt
nl <filename>
-- Saves man pages to text
man cat | col -b > less.txt
-- Mounting as a loop device
mount -o loop -t iso9660 /FC2-i386-DVD.iso /iso
-- To split a large file into multiple files
split --bytes 1m bigfile 1_
split --bytes 1m bigfile 1_
-- List of open files opened by raj under /dev/hda1
lsof -u raj -a /dev/hda1
-- Find who owns the port number
fuser -v -n tcp 992345
-- List of users accessing the /mnt file, -k option to kill all using the FS
fuser -v /mnt/*
fuser -v /mnt/*
-- File/File System status
stat afile
-- Trace System calls
strace -aef cat afile
strace -aef cat afile
top -b -d 5 -n 3 >> top.out
b=batch, d=delay in seconds , n=number of iterations
-- To read headers of binary files (ELF)
readelf --file-header /bin/ls
-- Provides file system statistics
stat <filename>
netstat -tanup
-- List listening interfaces
netstat -l
netstat -l
-- Shread and remove a file
shred -n 50 -zuv afile
n=shred the file "n" times, -z will zero out the file in the last pass (extra protection), u=truncate it every time, v=verbose.
-- Create a function Calculator - calc 3+45/10
function calc { echo "{$1}" | bc -l ; }
-- Command line calculator
echo "10/2*10" | bc -l
echo "10/2*10" | bc -l
-- Search man pages for string
man -k string
-- Merge pdf files into one
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=Merged.pdf -dBATCH img*.pdf
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=Merged.pdf -dBATCH img*.pdf
-- Create pdf file from man page
man -t cat | ps2pdf - > cat.pdf
-- Colors the string while grepping
grep --color string filename
-- Copy files between Servers using netcat (Alternate option to consider if ftp is disabled )
On Server (in my case host graphics) run
tar -cvjf - dummy.dat | netcat -l -p 3333
On the Client ( in my case it was silicon) run
netcat graphics 3333 | pv -b | tar -xjvf -On the server listening port 3333 is created and dummy.dat is tar'd. When netcat is ran with no default options, it basically connects to the server/port specified.
-- Rsync files between servers
silicon~> rsync -avrz . --include "init*.ora" --rsh='ssh' graphics:/usr/oracle/admin
Above syncs all init.ora files from silicon to graphics a=archive,v=verbose,r=recursive,z=compress
-- List all network services running on the system
netstat -tanup
-- Test FTP Speed. Use dd to create a large file, but instead of sending it to the disk send it to null device. Here
/dev/zero is the input and output of the dd is /dev/null.
put "|dd if=/dev/zero bs=1024 count=1000000" /dev/null
-- Find all files with group owner is "oracle" and change it to "dba" group.
find . -group oracle -exec chgrp dba '{}' \ ;
--Show files greater than a specific size
find ./ -size +100M -type f -print0 | xargs -0 ls -Ssh1 --color
-- Send e-mail attachments with mutt
mutt -a file.txt -s "A Text File" raj.anju@gmail.com < /tmp/junk
-- Kill multiple processes in one shot
ps -ef|grep dbconsole | awk ' { print $2} ' | xargs kill -9
-- Copy directory & files under remotely.
scp -r RMANREPO/ oracle@eccas1004:/usr/oracle/admin/RMANREPO/
-- Improve ftp speed with jumbo frames.
Note: Read more on the Jumbo frames, as its applicable only on certain situations. On a 10/100 data the max mtu can only be upto 1500, but for a GigaBit Ethernet connection it can go upto 9000. The best throughput I got while doing an XO (Cross-Over) connection between two systems is when the mtu was 6000.
ifconfig eth0 mtu 6000
For a permanent change you have to edit the below file to include MTU 6000
/etc/sysconfig/network-script/ifcfg-eth0
java.sql.SQLException: Internal - Unexpected value
Below is an error that we got while trying to run a JDBC Java Program from a Mainframe zOS client against Oracle 11g Database. SR was logged and finally oracle concluded it as a bug - 12851493 (Refer Metalink/Oracle Support site for more details). While hunting for some leads about this error, couldn't find any helpful sites, so thought to post it here and I hope it will be of help to someone.
Problem
java.sql.SQLException: Internal - Unexpected value
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:199)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:263)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:271)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:445)
at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOsesskey(T4CTTIoauthenticate.java:347)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:364)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:508)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:203)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:510)
at java.sql.DriverManager.getConnection(DriverManager.java:322)
at java.sql.DriverManager.getConnection(DriverManager.java:358)
at TestJDBC.main(TestJDBC.java:11)
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:199)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:263)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:271)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:445)
at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOsesskey(T4CTTIoauthenticate.java:347)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:364)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:508)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:203)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:510)
at java.sql.DriverManager.getConnection(DriverManager.java:322)
at java.sql.DriverManager.getConnection(DriverManager.java:358)
at TestJDBC.main(TestJDBC.java:11)
Workaround ( Suggested by Oracle Support)
Is to use the file.encoding=UTF-8 in the JVM startup or the program itself.
java -Dfile.encoding=UTF-8 TestJDBC
Environment Details
=== JDBC / JDK Driver Environment ===
Version:
java -version
java version "1.6.0"
Java(TM) SE Runtime Environment (build pmz3160sr9fp1-20110303_01(SR9 FP1))
IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 z/OS s390-31 jvmmz3160sr9-20110203_74623 (JIT enabled, AOT enabled)
J9VM - 20110203_074623
JIT - r9_20101028_17488ifx3
GC - 20101027_AA)
JCL - 20110203_01
java version "1.6.0"
Java(TM) SE Runtime Environment (build pmz3160sr9fp1-20110303_01(SR9 FP1))
IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 z/OS s390-31 jvmmz3160sr9-20110203_74623 (JIT enabled, AOT enabled)
J9VM - 20110203_074623
JIT - r9_20101028_17488ifx3
GC - 20101027_AA)
JCL - 20110203_01
Client Operating System
uname -a
OS/390 SYG1 22.00 03 2817
OS/390 SYG1 22.00 03 2817
Database Operating System
Linux eccdb675 2.6.16.60-0.39.3-smp #1 SMP Mon May 11 11:46:34 UTC 2009 x86_64 x86_64 x86_64 GNU/Linux
Database Version
11.2.0.2
Friday, September 2, 2011
Bugs-Errors-Problems-Workarounds-Solutions-Scripts
Some of the information compiled below includes some errors/bugs that I encountered at work and on home projects and solution/work arounds or fixes you may call and few scripts and commands that I gathered from different sources over the course of my career. Hopefully this will serve as a good reference point. Thanks.
Friday, July 8, 2011
Configuring DRBD with OCFS2 on Suse Linux 11.4 - Dual Primary Mode
Configuring DRBD with OCFS2 on Suse Linux 11.4 - Dual Primary Mode
I started with the single primary mode configuration, as I explained in my previous article. This way, I get the DRBD configuration right and tested out before moving to oracle cluster configuration (OCFS2 + DRBD). First thing is to get OCFS2 and O2CB installed, so go to software.opensuse.org and search for ocfs2. You will need to install the ocfs2* and *o2cb* rpm packages.
-- Download and Install the Software
silicon:/home/raj/downloads/ocfs2 # wget http://software.opensuse.org/search/download?base=openSUSE%3A11.4&file=openSUSE%3A%2F11.4%2Fstandard%2Fx86_64%2Focfs2console-1.6.3-5.3.x86_64.rpm
silicon:/home/raj/downloads/ocfs2 # wget http://software.opensuse.org/search/download?base=openSUSE%3A11.4&file=openSUSE%3A%2F11.4%2Fstandard%2Fx86_64%2Focfs2-tools-o2cb-1.6.3-5.3.x86_64.rpm
silicon:/home/raj/downloads/ocfs2 # wget http://software.opensuse.org/search/download?base=openSUSE%3A11.4&file=openSUSE%3A%2F11.4%2Fstandard%2Fx86_64%2Focfs2-tools-1.6.3-5.3.x86_64.rpm
silicon:/home/raj/downloads/ocfs2 # zypper in ocfs2console-1.6.3-5.3.x86_64.rpm
silicon:/home/raj/downloads/ocfs2 # zypper in ocfs2-tools-o2cb-1.6.3-5.3.x86_64.rpm
--Create a directory called ocfs2 under /etc/
silicon:/home/raj/downloads/ocfs2 # mkdir -p /etc/ocfs2/
--Edit cluster.conf file with below entries. You can choose any randpom ports that are not in use. Refering back to my previous article (DRBD - Single Primary Mode) , silicon (192.168.5.100) is my primary host and graphics (192.168.5.101) is my secondary one.
silicon:/etc/ocfs2 # cat cluster.conf
node:
ip_port = 7777
ip_address = 192.168.5.100
number = 0
name = silicon
cluster = ocfs2
node:
ip_port = 7777
ip_address = 192.168.5.101
number = 1
name = graphics
cluster = ocfs2
cluster:
node_count = 2
name = ocfs2
-- Configure the o2cb service.
Remember to give the cluster name as "ocfs2" on the prompt, or the name you have given in the cluster.conf file.
silicon:/etc/drbd.d # /etc/init.d/o2cb configure
Configuring the O2CB driver.
This will configure the on-boot properties of the O2CB driver.
The following questions will determine whether the driver is loaded on
boot. The current values will be shown in brackets ('[]'). Hitting
<ENTER> without typing an answer will keep that current value. Ctrl-C
will abort.
Load O2CB driver on boot (y/n) [y]:
Cluster stack backing O2CB [o2cb]:
Cluster to start on boot (Enter "none" to clear) []: ocfs2
Specify heartbeat dead threshold (>=7) [31]:
Specify network idle timeout in ms (>=5000) [30000]:
Specify network keepalive delay in ms (>=1000) [2000]:
Specify network reconnect delay in ms (>=2000) [2000]:
Writing O2CB configuration: OK
Setting cluster stack "o2cb": OK
Starting O2CB cluster ocfs2: OK
-- Add below to resource.res
…
resource data01 {
on silicon {
device /dev/drbd01;
disk /dev/vgPQ1/lvPQ1_dfs06;
address 192.168.5.100:7790;
meta-disk internal;
}
on graphics {
device /dev/drbd01;
disk /dev/vgPQ1/lvPQ1_dfs06;
address 192.168.5.101:7790;
meta-disk internal;
}
}
…
-- scp the cluster.conf and resource.res to the 2nd node - graphics.
silicon:/etc/ocfs2 # scp cluster.conf graphics:/etc/ocfs2/
cluster.conf 100% 269 0.3KB/s 00:00
silicon:/etc/drbd.d # scp resource.res graphics:/etc/drbd.d/
resource.res 100% 795 0.8KB/s 00:00
-- Create a LVM Partition. You can use the device partitions instead of LVM's.
silicon:/etc/drbd.d # lvcreate -L 10G -n lvPQ1_dfs06 vgPQ1
Logical volume "lvPQ1_dfs06" created
-- Create metadata, sync and attach.
silicon:/etc/drbd.d # drbdadm create-md data01
Writing meta data...
initializing activity log
NOT initialized bitmap
New drbd meta data block successfully created.
Success
-- Check the status.
Note: "data00" is what I configured for single-primary-mode. "data01" is the one we currently should pay attention to - the dual-primay-mode.
Note: "data00" is what I configured for single-primary-mode. "data01" is the one we currently should pay attention to - the dual-primay-mode.
silicon:/etc/drbd.d # drbd-overview.pl
0:data00 Connected Primary/Secondary UpToDate/UpToDate C r-----
1:data01
silicon:/etc/drbd.d # drbdadm syncer data01
silicon:/etc/drbd.d # drbdadm attach data01
-- Check the status after connect
silicon:/etc/drbd.d # drbd-overview.pl
0:data00 Connected Primary/Secondary UpToDate/UpToDate C r-----
1:data01 StandAlone Secondary/Unknown Inconsistent/DUnknown r----s
-- Repeat same steps on the 2nd node - graphics.
graphics:/etc/drbd.d # drbdadm create-md data01
Writing meta data...
initializing activity log
NOT initialized bitmap
New drbd meta data block successfully created.
Success
graphics:/etc/drbd.d # drbdadm syncer data01
graphics:/etc/drbd.d # drbdadm attach data01
graphics:/etc/drbd.d # drbd-overview.pl
0:data00 Connected Secondary/Primary UpToDate/UpToDate C r-----
1:data01 StandAlone Secondary/Unknown Inconsistent/DUnknown r----s
-- Connect the device on Primary - silicon.
silicon:/etc/drbd.d # drbdadm connect data01
Monitor the progress. Pay attention to the changes that occurs on the "cs" (Connection Status), "ds" (Disk Status), "ns" Netowrk Status.
silicon:/etc/drbd.d # cat /proc/drbd
version: 8.3.9 (api:88/proto:86-95)
srcversion: A67EB2D25C5AFBFF3D8B788
0: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r-----
ns:76 nr:0 dw:116132 dr:2189 al:36 bm:15 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
1: cs:WFConnection ro:Secondary/Unknown ds:Inconsistent/DUnknown C r----s
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:10485404
-- Connect the device on Secondary - graphics.
graphics:/etc/drbd.d # drbdadm connect data01
graphics:/etc/drbd.d # cat /proc/drbd
version: 8.3.9 (api:88/proto:86-95)
srcversion: A67EB2D25C5AFBFF3D8B788
0: cs:Connected ro:Secondary/Primary ds:UpToDate/UpToDate C r-----
ns:0 nr:76 dw:116304 dr:1485 al:4 bm:7 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
1: cs:Connected ro:Secondary/Secondary ds:Inconsistent/Inconsistent C r-----
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:10485404
-- Run the below on one of the nodes.
silicon:/etc/drbd.d # drbdadm -- --overwrite-data-of-peer primary data01
silicon:/etc/drbd.d # cat /proc/drbd
version: 8.3.9 (api:88/proto:86-95)
srcversion: A67EB2D25C5AFBFF3D8B788
0: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r-----
ns:76 nr:0 dw:116132 dr:2189 al:36 bm:15 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
1: cs:SyncSource ro:Primary/Secondary ds:UpToDate/Inconsistent C r-----
ns:3072 nr:0 dw:0 dr:3744 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:10482332
[>....................] sync'ed: 0.1% (10236/10236)M
finish: 1:49:11 speed: 1,536 (1,536) K/sec
graphics:/etc/drbd.d # cat /proc/drbd
version: 8.3.9 (api:88/proto:86-95)
srcversion: A67EB2D25C5AFBFF3D8B788
0: cs:Connected ro:Secondary/Primary ds:UpToDate/UpToDate C r-----
ns:0 nr:76 dw:116304 dr:1485 al:4 bm:7 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
1: cs:SyncTarget ro:Secondary/Primary ds:Inconsistent/UpToDate C r-----
ns:0 nr:261760 dw:261760 dr:0 al:0 bm:15 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:10223644
[>....................] sync'ed: 2.5% (9984/10236)M
finish: 2:06:27 speed: 1,324 (1,280) want: 250 K/sec
You can see the progress of the sync by running cat /proc/drbd. Once the sync is complete, you can see the change of status in "ds" for both primary and secondary nodes. It will show up as "UpToDate/UpToDate".
graphics:/etc/drbd.d # cat /proc/drbd Thu Jun 30 07:16:01 2011
version: 8.3.9 (api:88/proto:86-95)
srcversion: A67EB2D25C5AFBFF3D8B788
0: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r-----
ns:76 nr:0 dw:116132 dr:2189 al:36 bm:15 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
1: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r-----
ns:10618904 nr:0 dw:134792 dr:10486946 al:120 bm:640 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
-- Once the sync is done, create the file system on the drbd device. /dev/drbd01
silicon:/etc/drbd.d # mkfs -t ocfs2 -N 2 -L ocfs2_drbd01 /dev/drbd01
mkfs.ocfs2 1.6.3
Cluster stack: classic o2cb
Label: ocfs2_drbd01
Features: sparse backup-super unwritten inline-data strict-journal-super xattr
Block size: 4096 (12 bits)
Cluster size: 4096 (12 bits)
Volume size: 10737053696 (2621351 clusters) (2621351 blocks)
Cluster groups: 82 (tail covers 8615 clusters, rest cover 32256 clusters)
Extent allocator size: 8388608 (2 groups)
Journal size: 67108864
Node slots: 2
Creating bitmaps: done
Initializing superblock: done
Writing system files: done
Writing superblock: done
Writing backup superblock: 2 block(s)
Formatting Journals: done
Growing extent allocator: done
Formatting slot map: done
Formatting quota files: done
Writing lost+found: done
mkfs.ocfs2 successful
-- Add the "startup" and "net" portions to the resource file on both the nodes (silicon & graphics).
startup {
become-primary-on both;
}
net {
allow-two-primaries;
after-sb-0pri discard-zero-changes;
after-sb-1pri discard-secondary;
after-sb-2pri disconnect;
}
become-primary-on both;
}
net {
allow-two-primaries;
after-sb-0pri discard-zero-changes;
after-sb-1pri discard-secondary;
after-sb-2pri disconnect;
}
resource data01 {
on silicon {
device /dev/drbd01;
disk /dev/vgPQ1/lvPQ1_dfs06;
address 192.168.5.100:7790;
meta-disk internal;
}
on graphics {
device /dev/drbd01;
disk /dev/vgPQ1/lvPQ1_dfs06;
address 192.168.5.101:7790;
meta-disk internal;
}
}
-- Bounce nodes on both primary and secondary.
silicon:/etc/drbd.d # drbdadm down data01
silicon:/etc/drbd.d # drbdadm up data01
silicon:/etc/drbd.d # cat /proc/drbd
version: 8.3.9 (api:88/proto:86-95)
srcversion: A67EB2D25C5AFBFF3D8B788
0: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r-----
ns:0 nr:0 dw:0 dr:672 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
1: cs:SyncTarget ro:Secondary/Secondary ds:Inconsistent/UpToDate C r-----
ns:0 nr:2832 dw:2832 dr:0 al:0 bm:17 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:872
[===================>] sync'ed:100.0% (872/3704)K
finish: 0:00:00 speed: 1,416 (1,416) want: 250 K/sec
-- Make the first node primary.
silicon:/etc/drbd.d # drbdadm primary data01
silicon:/etc/drbd.d # cat /proc/drbd
version: 8.3.9 (api:88/proto:86-95)
srcversion: A67EB2D25C5AFBFF3D8B788
0: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r-----
ns:0 nr:0 dw:0 dr:672 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
1: cs:Connected ro:Primary/Primary ds:UpToDate/UpToDate C r-----
ns:0 nr:3704 dw:3704 dr:672 al:0 bm:81 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
-- Bounce the secondary node.
graphics:/etc/drbd.d # drbdadm down data01
graphics:/etc/drbd.d # drbdadm up data01
graphics:/etc/drbd.d # cat /proc/drbd
version: 8.3.9 (api:88/proto:86-95)
srcversion: A67EB2D25C5AFBFF3D8B788
0: cs:Connected ro:Secondary/Primary ds:UpToDate/UpToDate C r-----
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
1: cs:Connected ro:Secondary/Secondary ds:UpToDate/UpToDate C r-----
ns:3704 nr:0 dw:0 dr:3704 al:0 bm:81 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
-- Convert the 2nd node to primary.
graphics:/etc/drbd.d # drbdadm primary data01
graphics:/etc/drbd.d # cat /proc/drbd
version: 8.3.9 (api:88/proto:86-95)
srcversion: A67EB2D25C5AFBFF3D8B788
0: cs:Connected ro:Secondary/Primary ds:UpToDate/UpToDate C r-----
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
1: cs:Connected ro:Primary/Primary ds:UpToDate/UpToDate C r-----
ns:3704 nr:0 dw:0 dr:4376 al:0 bm:81 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
-- Mount the device to a directory on both nodes.
silicon:/etc/drbd.d # mount /dev/drbd01 /u06 -t ocfs2
graphics:/etc/drbd.d # mount /dev/drbd01 /u06 -t ocfs2
-- Touch a test file, you can see the file appearing on the secondary node. You can run a "tail -f afile" command on one of the nodes on a different ssh/telnet session and redirect some data to this file on the other node where in you can monitor a live transfer of the data.
silicon:/u06 # touch afile
graphics:/u06 # ls -ltr
total 388
drwxr-xr-x 2 root root 3896 Jun 30 22:32 lost+found
-rw-r--r-- 1 root root 394065 Jun 30 2011 afile
Run the tail -f afile first and do the redirect on the other node. As this is dual primary mode you can swap these commands between both nodes.
graphics:/u06 # tail -f afile
silicon:/u06 # cat /var/log/messages > afile
If you get the configuration right, you will be able to see output right away as and when you redirect the output to this file on the silicon.
Below are some additional commands with which you can admin the o2cb service.
- "
/etc/init.d/o2cb offline
" - Takes the clusters offline. - "
/etc/init.d/o2cb online
" - Brings the clusters online. - "
/etc/init.d/o2cb load
" - Loads all OCFS2 modules. - "
/etc/init.d/o2cb unload
" - Unloads all OCFS2 modules.
References:
OCFS2 Documentation - http://oss.oracle.com/projects/ocfs2/dist/documentation/v1.2/ocfs2_users_guide.pdf
Here's one of the issues I ran into - a likely split-brain scenario where I couldn't get both nodes to talk. I ran drbdadm up data01 and here's the output I got.
silicon:~ # cat /proc/drbd
version: 8.3.9 (api:88/proto:86-95)
srcversion: A67EB2D25C5AFBFF3D8B788
0: cs:Connected ro:Secondary/Secondary ds:UpToDate/UpToDate C r-----
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
1: cs:WFConnection ro:Secondary/Unknown ds:UpToDate/Outdated C r----s
ns:0 nr:0 dw:0 dr:1680 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:4194140
Same on the secondary node too..
graphics:~ # cat /proc/drbd
version: 8.3.9 (api:88/proto:86-95)
srcversion: A67EB2D25C5AFBFF3D8B788
0: cs:Connected ro:Secondary/Secondary ds:UpToDate/UpToDate C r-----
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
1: cs:StandAlone ro:Primary/Unknown ds:UpToDate/Outdated r----s
ns:0 nr:0 dw:0 dr:672 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:4194140
silicon:~ # drbdadm secondary data01
silicon:~ # drbdadm disconnect data01
silicon:~ # drbdadm -- --discard-my-data connect data01
silicon:~ # cat /proc/drbd
version: 8.3.9 (api:88/proto:86-95)
srcversion: A67EB2D25C5AFBFF3D8B788
0: cs:Connected ro:Secondary/Secondary ds:UpToDate/UpToDate C r-----
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
1: cs:WFConnection ro:Secondary/Unknown ds:UpToDate/Outdated C r----s
ns:0 nr:0 dw:0 dr:1680 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:4194140
silicon:~ # cat /proc/drbd
version: 8.3.9 (api:88/proto:86-95)
srcversion: A67EB2D25C5AFBFF3D8B788
0: cs:Connected ro:Secondary/Secondary ds:UpToDate/UpToDate C r-----
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
1: cs:WFConnection ro:Secondary/Unknown ds:UpToDate/Outdated C r----s
ns:0 nr:0 dw:0 dr:1680 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:4194140
Once done, I ran the connect on the 2nd node, i.e secondary.
graphics:~ # drbdadm connect data01
graphics:~ # cat /proc/drbd
version: 8.3.9 (api:88/proto:86-95)
srcversion: A67EB2D25C5AFBFF3D8B788
0: cs:Connected ro:Secondary/Secondary ds:UpToDate/UpToDate C r-----
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
1: cs:SyncSource ro:Primary/Secondary ds:UpToDate/Inconsistent C r-----
ns:2176 nr:0 dw:0 dr:3856 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:4191964
[>....................] sync'ed: 0.1% (4191964/4194140)K
finish: 0:29:06 speed: 2,176 (2,176) K/sec
silicon:~ # cat /proc/drbd
version: 8.3.9 (api:88/proto:86-95)
srcversion: A67EB2D25C5AFBFF3D8B788
0: cs:Connected ro:Secondary/Secondary ds:UpToDate/UpToDate C r-----
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
1: cs:SyncTarget ro:Secondary/Primary ds:Inconsistent/UpToDate C r-----
ns:0 nr:8320 dw:8320 dr:1680 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:4185820
[>....................] sync'ed: 0.3% (4185820/4194140)K
finish: 0:49:49 speed: 1,384 (1,384) want: 250 K/sec
silicon:~ # drbdadm primary data01
silicon:~ # cat /proc/drbd
version: 8.3.9 (api:88/proto:86-95)
srcversion: A67EB2D25C5AFBFF3D8B788
0: cs:Connected ro:Secondary/Secondary ds:UpToDate/UpToDate C r-----
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
1: cs:Connected ro:Primary/Primary ds:UpToDate/UpToDate C r-----
ns:0 nr:4194140 dw:4194140 dr:2352 al:0 bm:256 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
silicon:/u06 # service o2cb status
Driver for "configfs": Loaded
Filesystem "configfs": Mounted
Stack glue driver: Loaded
Stack plugin "o2cb": Loaded
Driver for "ocfs2_dlmfs": Loaded
Filesystem "ocfs2_dlmfs": Mounted
Checking O2CB cluster ocfs2: Online
Heartbeat dead threshold = 31
Network idle timeout: 30000
Network keepalive delay: 2000
Network reconnect delay: 2000
Checking O2CB heartbeat: Not active
Driver for "configfs": Loaded
Filesystem "configfs": Mounted
Stack glue driver: Loaded
Stack plugin "o2cb": Loaded
Driver for "ocfs2_dlmfs": Loaded
Filesystem "ocfs2_dlmfs": Mounted
Checking O2CB cluster ocfs2: Online
Heartbeat dead threshold = 31
Network idle timeout: 30000
Network keepalive delay: 2000
Network reconnect delay: 2000
Checking O2CB heartbeat: Not active
silicon:/u06 # mounted.ocfs2 -f
Device FS Nodes
/dev/mapper/vgPQ1-lvPQ1_dfs06 ocfs2 Not mounted
/dev/drbd1 ocfs2 Not mounted
silicon:/u06 # mount /dev/drbd01 /u06 -t ocfs2
silicon:/u06 # mounted.ocfs2 -f
Device FS Nodes
/dev/mapper/vgPQ1-lvPQ1_dfs06 ocfs2 silicon
/dev/drbd1 ocfs2 silicon
graphics:/u06 # cat /proc/drbd
version: 8.3.9 (api:88/proto:86-95)
srcversion: A67EB2D25C5AFBFF3D8B788
0: cs:Connected ro:Secondary/Secondary ds:UpToDate/UpToDate C r-----
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
1: cs:Connected ro:Primary/Primary ds:UpToDate/UpToDate C r-----
ns:4194140 nr:0 dw:0 dr:4195852 al:0 bm:256 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
graphics:/u06 # mounted.ocfs2 -f
Device FS Nodes
/dev/mapper/vgPQ1-lvPQ1_dfs06 ocfs2 Not mounted
/dev/drbd1 ocfs2 Not mounted
graphics:/u06 # mount /dev/drbd01 /u06 -t ocfs2
graphics:/u06 # mounted.ocfs2 -f
Device FS Nodes
/dev/mapper/vgPQ1-lvPQ1_dfs06 ocfs2 silicon, graphics
/dev/drbd1 ocfs2 silicon, graphics
silicon:/u06 # service o2cb status
Driver for "configfs": Loaded
Filesystem "configfs": Mounted
Stack glue driver: Loaded
Stack plugin "o2cb": Loaded
Driver for "ocfs2_dlmfs": Loaded
Filesystem "ocfs2_dlmfs": Mounted
Checking O2CB cluster ocfs2: Online
Heartbeat dead threshold = 31
Network idle timeout: 30000
Network keepalive delay: 2000
Network reconnect delay: 2000
Checking O2CB heartbeat: Active
graphics:/u06 # service o2cb status
Driver for "configfs": Loaded
Filesystem "configfs": Mounted
Stack glue driver: Loaded
Stack plugin "o2cb": Loaded
Driver for "ocfs2_dlmfs": Loaded
Filesystem "ocfs2_dlmfs": Mounted
Checking O2CB cluster ocfs2: Online
Heartbeat dead threshold = 31
Network idle timeout: 30000
Network keepalive delay: 2000
Network reconnect delay: 2000
Checking O2CB heartbeat: Active
graphics:/u06 # touch file_created_at_graphics
graphics:/u06 # ls -ltr
total 0
drwxr-xr-x 2 root root 3896 Jun 30 22:32 lost+found
drwxr-xr-x 6 oracle oinstall 3896 Jul 17 18:07 oracle
-rw-r--r-- 1 root root 0 Aug 21 23:07 file_created_at_graphics
silicon:/u06 # ls -ltr
total 0
drwxr-xr-x 2 root root 3896 Jun 30 22:32 lost+found
drwxr-xr-x 6 oracle dba 3896 Jul 17 18:07 oracle
-rw-r--r-- 1 root root 0 Aug 21 23:07 file_created_at_graphics
Hope this helps.
Raj...
Subscribe to:
Posts (Atom)