Find it

Thursday, March 13, 2014

Apache-Subversion deployment - Legacy Solaris 8, different experience!

I got a requirement wherein customer requested to have Apache Subversion setup to be configured on quite old legacy version, Solaris 8 server; hence getting binaries for SVN on Solaris 8 is almost impossible hence I eventually decided to compile and install Subversion & all it's dependent components using source code.

Installing Subversion needs to fulfil some dependencies, below are the required dependent packages to install SVN successfully.

= Expat 2.x
= Apache 2.x with WebDAV support
= APR (Apache Portable Runtime)
= APR-UTIL
= NEON
= Compilation of SQLite-amalgamation C source code for SQLite which is a requirement for Subversion configure script and compilation purpose
= Compilation of zlib

This write-up is quite basic and gives enough insights on what compile string works fine on Solaris 8 and one might save lots of time.. trust me it's a pain to get Subversion compliled on Solaris 8 along with Apache and it's all dependent components.

Compile Expat
=============


# cd expat-2.0.1
#./configure && make && make install
# cd..

Compliling Apache 2.x
=====================


#./configure --prefix=/usr/local/apache2 --enable-so \
--enable-mods-shared=most --enable-ssl=static \
--with-ssl=/usr/local/ssl --enable-dav --enable-dav-fs
# make && make install
# cd..

Starting Apache Webserver
-------------------------


#/usr/local/apache2/bin/apachectl start

root@XXXX # ps -eaf | grep httpd | grep -v grep
  root 24948    1  2 21:35:49 ?        0:02 /usr/local/apache2/bin/httpd -k start
  svn 24952 24948  0 21:35:51 ?        0:00 /usr/local/apache2/bin/httpd -k start
  svn 24949 24948  0 21:35:51 ?        0:00 /usr/local/apache2/bin/httpd -k start
  svn 24950 24948  0 21:35:51 ?        0:00 /usr/local/apache2/bin/httpd -k start
  svn 24951 24948  0 21:35:51 ?        0:00 /usr/local/apache2/bin/httpd -k start
  svn 24953 24948  0 21:35:51 ?        0:00 /usr/local/apache2/bin/httpd -k start


Apache processes are onwed by user svn, you may use any user for this purpose.

Compile APR
===========


# cd subversion-1.6.6
# cd apr
# ./configure --prefix=/usr/local/apr
# make
# make install
# cd ..


Compile APR-UTIL
================


# cd apr-util
# ./configure --prefix=/usr/local/apr --with-apr=/usr/local/apr
# make
# make install
# cd ..


Compile NEON
============


# cd neon
# ./configure --prefix=/usr/local/neon  --with-ssl --with-libs=/usr/local/ssl --enable-shared
# make
# make install
# cd ..


Compile Subversion
==============


# ./configure --prefix=/usr/local/subversion \
--with-apxs=/usr/local/apache2/bin/apxs --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr --with-neon=/usr/local/neon
# make
# make install


If everything success subversion will add 2 modules into your apache modules and added 2 module line into your httpd.conf like below -

# more /usr/local/apache2/conf/httpd.conf
....
LoadModule dav_svn_module /usr/lib/apache2/mod_dav_svn.so
LoadModule authz_svn_module /usr/lib/apache2/mod_authz_svn.so
...

Restart Your Apache Services
----------------------------
------------

# /usr/local/apache2/bin/apachectl stop
# /usr/local/apache2/bin/apachectl start


SVN repository configuration via WebDAV
---------------------------------------
----------------

Under HTTP configuration file "/usr/local/apache2/conf/httpd.conf" put below configuration -
 











---------------------------------------------------------------------

Add users for basic authentication
==========================


# /usr/local/apache2/bin/htpasswd /usr/local/svn/repos/authz njoshi01
New password:
Re-type new password:
Adding password for user njoshi01


The above command can be used for adding user and modifying the password. Now to access the SVN repository user needs to authenticate and then access the repository contents.

--------------------------------------------------

To make sure the httpd service comes online automatically after server reboot will have to create startup script. Let's create a startup script -

-rwxr--r--   6 root     sys          734 Feb 13 10:24 /etc/init.d/apache

#!/sbin/sh

APACHE_HOME=/usr/local/apache2
CONF_FILE=/usr/local/apache2/conf/httpd.conf
RUNDIR=/var/run
PIDFILE=${RUNDIR}/httpd.pid

if [ ! -f ${CONF_FILE} ]; then
        exit 0
fi

if [ ! -d ${RUNDIR} ]; then
        /usr/bin/mkdir -p -m 755 ${RUNDIR}
fi

case "$1" in
start)
        /bin/rm -f ${PIDFILE}
        cmdtext="starting"
        ;;
restart)
        cmdtext="restarting"
        ;;
stop)
        cmdtext="stopping"
        ;;
*)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
        ;;
esac

echo "httpd $cmdtext."

/bin/sh -c "${APACHE_HOME}/bin/apachectl $1" 2>&1
status=$?

if [ $status != 0 ]; then
        echo "exit status $status"
        exit 1
fi
exit 0


PS: For Solaris 10 you have to create SMF service. Creating SMF is not described in this write-up.

--------------------------------------------------

How developers access the SVN repository?
=================================

Either via Eclipse or Web based Subversion portal.
































I hope above notes will stand helpful..

Thursday, January 2, 2014

Online data from storage luns in ZPOOL

Wishing you & your family very Happy New Year, may this year brings you all the success, good health & wealth.

Today will be writing about online storage (LUNs) migration for ZFS zpool. I'll be replacing the LUNs from old array to new array.

The best thing about the procedure is that during migration all the data which was present in ZFS file systems in ZPOOL nsrpool is still accessible without any issues, no performance lag. No impact to production system and no down time!!!

Each disk in zfs pool has the same size.

One can do this storage migration in two ways online.

1. One can use attach/detach options, zpool attach -f [pool] [device] [new-device] and then once re-silver done zpool detach [pool] [old-device]
2. Or simply one can simply do device replace, zpool replace [pool] [device] [new-device]

I’m going to use the 2nd option because I think this is the easiest way to achieve this LUN migration.

Newly allocated disks are as below,

/dev/rdsk/c6t6006016070312700CEB537F88C48E311d0s2 - 60G format
/dev/rdsk/c6t6006016070312700FA0468009348E311d0s2 - 60G format
/dev/rdsk/c6t600601606B312700FBA40FCCC0BCE211d0s2 - 60G format
/dev/rdsk/c6t600601606B3127002E623AB38B48E311d0s2 - 60G format
/dev/rdsk/c6t600601606B3127000283C9778948E311d0s2 - 60G format
/dev/rdsk/c6t6006016070312700008A87119148E311d0s2 - 60G format


Have formatted the above disks palcing everything on slice 0.

root@XXXXXX:/root# zpool status nsrpool
  pool: nsrpool
 state: ONLINE
 scan: none requested
config:

        NAME                                       STATE     READ WRITE CKSUM
        nsrpool                                  ONLINE       0     0     0
          c6t60060160E6C31D00625335009BF1DB11d0  ONLINE       0     0     0
          c6t60060160E6C31D00C8B0F7B898F1DB11d0  ONLINE       0     0     0
          c6t60060160E6C31D000C0C7E699AF1DB11d0  ONLINE       0     0     0
          c6t60060160E6C31D00AB24671C98F1DB11d0  ONLINE       0     0     0
          c6t60060160E6C31D0060312EA39BF1DB11d0  ONLINE       0     0     0
          c6t60060160E6C31D00CCF4057397F1DB11d0  ONLINE       0     0     0

errors: No known data errors

Let's start the migration -

root@XXXXXX:/root# zpool replace nsrpool c6t60060160E6C31D00625335009BF1DB11d0 c6t6006016070312700CEB537F88C48E311d0
root@XXXXXX:/root# zpool replace nsrpool c6t60060160E6C31D00C8B0F7B898F1DB11d0 c6t6006016070312700FA0468009348E311d0
root@XXXXXX:/root# zpool replace nsrpool c6t60060160E6C31D000C0C7E699AF1DB11d0 c6t600601606B312700FBA40FCCC0BCE211d0
root@XXXXXX:/root# zpool replace nsrpool c6t60060160E6C31D00AB24671C98F1DB11d0 c6t600601606B3127002E623AB38B48E311d0
root@XXXXXX:/root# zpool replace nsrpool c6t60060160E6C31D0060312EA39BF1DB11d0 c6t600601606B3127000283C9778948E311d0
root@XXXXXX:/root# zpool replace nsrpool c6t60060160E6C31D00CCF4057397F1DB11d0 c6t6006016070312700008A87119148E311d0


Now that resilvering started, will have to wait.

root@XXXXXX:/root# zpool status nsrpool
  pool: nsrpool
 state: ONLINE
status: One or more devices is currently being resilvered.  The pool will
        continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
 scan: resilver in progress since Wed Dec  4 13:04:21 2013
    44.4G scanned out of 220G at 75.1M/s, 0h39m to go
    44.4G scanned out of 220G at 75.1M/s, 0h39m to go
    44.4G resilvered, 20.24% done
config:

        NAME                                         STATE     READ WRITE CKSUM
        nsrpool                                    ONLINE       0     0     0
          replacing-0                              ONLINE       0     0     0
            c6t60060160E6C31D00625335009BF1DB11d0  ONLINE       0     0     0
            c6t6006016070312700CEB537F88C48E311d0  ONLINE       0     0     0  (resilvering)
          replacing-1                              ONLINE       0     0     0
            c6t60060160E6C31D00C8B0F7B898F1DB11d0  ONLINE       0     0     0
            c6t6006016070312700FA0468009348E311d0  ONLINE       0     0     0  (resilvering)
          replacing-2                              ONLINE       0     0     0
            c6t60060160E6C31D000C0C7E699AF1DB11d0  ONLINE       0     0     0
            c6t600601606B312700FBA40FCCC0BCE211d0  ONLINE       0     0     0  (resilvering)
          replacing-3                              ONLINE       0     0     0
            c6t60060160E6C31D00AB24671C98F1DB11d0  ONLINE       0     0     0
            c6t600601606B3127002E623AB38B48E311d0  ONLINE       0     0     0  (resilvering)
          replacing-4                              ONLINE       0     0     0
            c6t60060160E6C31D0060312EA39BF1DB11d0  ONLINE       0     0     0
            c6t600601606B3127000283C9778948E311d0  ONLINE       0     0     0  (resilvering)
          replacing-5                              ONLINE       0     0     0
            c6t60060160E6C31D00CCF4057397F1DB11d0  ONLINE       0     0     0
            c6t6006016070312700008A87119148E311d0  ONLINE       0     0     0  (resilvering)

errors: No known data errors


After a long time, resilvering done and now we see zpool with new disks - so our zpool online migration is done.

root@XXXXXX:/root# zpool status nsrpool
errors: No known data errors
  pool: nsrpool
 state: ONLINE
 scan: resilvered 219G in 2h55m with 0 errors on Wed Dec  4 16:00:07 2013
config:

        NAME                                       STATE     READ WRITE CKSUM
        nsrpool                                  ONLINE       0     0     0
          c6t6006016070312700CEB537F88C48E311d0  ONLINE       0     0     0
          c6t6006016070312700FA0468009348E311d0  ONLINE       0     0     0
          c6t600601606B312700FBA40FCCC0BCE211d0  ONLINE       0     0     0
          c6t600601606B3127002E623AB38B48E311d0  ONLINE       0     0     0
          c6t600601606B3127000283C9778948E311d0  ONLINE       0     0     0
          c6t6006016070312700008A87119148E311d0  ONLINE       0     0     0


It was easy! Hope this helps...