Tuesday Nov 03, 2009

One of the coolest features in Solaris in my opinion is the "zoned" property of the ZFS. 

What does it do?

ZFS datasets can be exported to non-global zones using the "add dataset" property in zonecfg command. Now the user in the non-global zone may set setuid/symbolic links which are o.k. inside the non-global zone but not acceptable in global zone.  So zfs sets the "zoned" property automatically once the dataset is delegated to the non-global zone.   It doesn't get cleared automatically once you remove the delegation.  It has to be manually removed. If the property is not set off, sharing and other operations don't succeed on the global zone!

bash-3.00# zonecfg -z sparse-zone
zonecfg:sparse-zone> add dataset
zonecfg:sparse-zone:dataset> set name=test/testfs
zonecfg:sparse-zone:dataset> end
zonecfg:sparse-zone> exit
bash-3.00# zoneadm -z sparse-zone reboot
bash-3.00# zlogin sparse-zone
[Connected to zone 'sparse-zone' pts/1]
Last login: Tue Nov  3 00:09:04 on pts/1
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
# bash
bash-3.00# zfs list
NAME          USED  AVAIL  REFER  MOUNTPOINT
test          122K  19.6G    23K  /test
test/testfs    22K  19.6G    22K  /global/test
bash-3.00# exit
exit
# exit

[Connection to zone 'sparse-zone' pts/1 closed]
bash-3.00# zonecfg -z sparse-zone
zonecfg:sparse-zone> remove dataset
zonecfg:sparse-zone> exit
bash-3.00# zoneadm -z sparse-zone reboot
bash-3.00# zlogin sparse-zone
[Connected to zone 'sparse-zone' pts/1]
Last login: Tue Nov  3 01:58:01 on pts/1
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
# bash
bash-3.00# zfs list
no datasets available
bash-3.00# exit
# ^D
[Connection to zone 'sparse-zone' pts/1 closed]
bash-3.00# zfs sharenfs=on test/testfs
cannot set property for 'test/testfs': 'sharenfs' cannot be set on dataset in a non-global zone
bash-3.00# zfs set zoned=off test/testfs
bash-3.00# zfs sharenfs=on test/testfs
bash-3.00# dfshares
RESOURCE                                  SERVER ACCESS    TRANSPORT
   xxxxx:/global/test                  xxxxx  -         -

Really 8-)

Tuesday Sep 08, 2009

A cheat sheet for installing DBD and DBI to run sql-bench for MySQL intended for novices since there is not much material on the net that is simple and works!

1. Download the latest DBI and DBD modules from the net.

2.  Make sure that the mysql access works:

 mysql -S /tmp/mysql.sock -ruoot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 240 to server version: 5.1.38-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

3.  Verify your PATH env variable - it should include Sun Studio Compiler path for cc.

 PATH=/usr/local/bin:/usr/bin:/usr/sbin:/usr/sfw/bin/:/usr/ccs/bin:<SS>/bin

4. Decompress the DBI tar bundle to a temp location say /tmp.

 5. Order of execution:

 a) perl Makefile.PL

 b) make

c) make test

d) make install

6. Now decompress DBD and execute:

a) perl Makefile.PL

b) make

c) make test

** I faced some errors which I chose to ignore.

d) make install

Some of problems I faced were:

**If I used 32 bit perl downloaded from freeware site, it was by default using gcc shipped in /usr/sfw/bin as the compiler and that resulted in :

bash-3.00# make
gcc -c  -I/usr/local/lib/perl5/site_perl/5.8.8/sun4-solaris/auto/DBI -I/usr/sfw/include/mysql -xstrconst -mt -DDBD_MYSQL_INSERT_ID_IS_GOOD -g  -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -I/opt/gnu/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O    -DVERSION=\"4.012\"  -DXS_VERSION=\"4.012\" -fPIC "-I/usr/local/lib/perl5/5.8.8/sun4-solaris/CORE"   dbdimp.c
gcc: language strconst not recognized
gcc: dbdimp.c: linker input file unused because linking not done
gcc -c  -I/usr/local/lib/perl5/site_perl/5.8.8/sun4-solaris/auto/DBI -I/usr/sfw/include/mysql -xstrconst -mt -DDBD_MYSQL_INSERT_ID_IS_GOOD -g  -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -I/opt/gnu/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O    -DVERSION=\"4.012\"  -DXS_VERSION=\"4.012\" -fPIC "-I/usr/local/lib/perl5/5.8.8/sun4-solaris/CORE"   mysql.c
gcc: language strconst not recognized
gcc: mysql.c: linker input file unused because linking not done
rm -f blib/arch/auto/DBD/mysql/mysql.so
LD_RUN_PATH="/usr/sfw/lib:/usr/lib" /usr/local/bin/perl myld gcc  -G -L/usr/local/lib -L/opt/gnu/lib dbdimp.o  mysql.o  -o blib/arch/auto/DBD/mysql/mysql.so    \
   -R/usr/sfw/lib -R/usr/sfw/lib/mysql -L/usr/sfw/lib -L/usr/sfw/lib/mysql -lmysqlclient -lz -lposix4 -lcrypt -lgen -lsocket -lnsl -lm          \

gcc: dbdimp.o: No such file or directory
gcc: mysql.o: No such file or directory
*** Error code 1
make: Fatal error: Command failed for target `blib/arch/auto/DBD/mysql/mysql.so'

**If you are using perl shipped with solaris, you automatically get the error that cc is not found.

 ** If the all the libraries are using /usr/local/mysql and if the path doesn't exist, the compilation will fail!

I wish I could provide more updates as I fiddle around with it!

Thursday Aug 06, 2009

One of the common issues I face is having many pools with the same name. This happens many times I reinstall the OS for a new build of Sun Cluster software is out to test.  I use standard naming conventions and hence when I create a new pool without checking if there is already one with the same name, then I get an error on import:

bash-3.00# zpool import app
cannot import 'app': more than one matching pool
import by numeric ID instead

So how to find out which pools are available?  There are 2 way.  You can either use the ZFS manager GUI if you aren't too comfortable using the CLI or you can execute zpool import command which will list all the potential pools that can be imported:

bash-3.00# zpool import
  pool: app
    id: 17303573419851088164
 state: ONLINE
status: The pool was last accessed by another system.
action: The pool can be imported using its name or numeric identifier and
    the '-f' flag.
   see: http://www.sun.com/msg/ZFS-8000-EY
config:

    app         ONLINE
      raidz1    ONLINE
        c2t1d3  ONLINE
        c2t1d2  ONLINE

  pool: app
    id: 13179891989473835286
 state: ONLINE
status: The pool is formatted using an older on-disk version.
action: The pool can be imported using its name or numeric identifier, though
    some features will not be available without an explicit 'zpool upgrade'.
config:

    app         ONLINE
      c2t1d1    ONLINE

  pool: mysql
    id: 6396206132307901430
 state: ONLINE
status: The pool is formatted using an older on-disk version.
action: The pool can be imported using its name or numeric identifier, though
    some features will not be available without an explicit 'zpool upgrade'.
config:

    mysql       ONLINE
      c2t1d0    ONLINE

  pool: post
    id: 11620670201616239827
 state: ONLINE
status: The pool is formatted using an older on-disk version.
action: The pool can be imported using its name or numeric identifier, though
    some features will not be available without an explicit 'zpool upgrade'.
config:

    post        ONLINE
      c2t0d2    ONLINE

Now that I know the pools and their IDs,

bash-3.00# zpool import 13179891989473835286
bash-3.00# zpool destroy app

Voila!

Monday Jul 27, 2009

I am facing a strange issue with OpenSolaris 2009.06 (111b).

Any suggestions?

Tuesday Jun 09, 2009

I noticed today that the upload photos feature of Facebook has been changed to use Java.  May be they were using Java earlier for uploading photos as well but hey now it is crystal clear!  And need I say that it is far better than uploading 5 at a time?!  Java, the pervasive!

This blog copyright 2009 by maddy