Tag Archives: dcache

OpenIndiana + PostgreSQL + dCache

This is a test for installing openindiana and set up a working dCache test-vm.

dCache is a storage element of the Grid (scientific computing).

OI == OpenIndiana. Kind of like opensolaris with an Illumos kernel, not the sun/oracle kernel.

With http://www.guldmyr.com/blog/esxi-vmware-workstation/ as a base for how to set up ip settings etc in OI.

oi-dev-151a-text-x86.iso installed

pkg install package/pkg

pkg update

java -version

mkdir /var/postgres

useradd postgres

groupadd postgres

chown postgres:postgres /var/postgres

chmod 755 /var/postgres

The pkg update makes it into 151a2

If you do not create the ones above the install of service/postgres will fail and create a new BE.

pkg install pkg:/database/postgres-84
pkg install pkg:/service/database/postgres-84

vi /etc/passwd

change postgres to 90:90 and homedir to /export/home/postgres

mkdir /export/home/postgres

chown postgres.postgres /export/home/postgres
root@oi:~# vi /export/home/postgres/.profile
PATH=/usr/postgres/8.4/bin:${PATH}
PGDATA=/var/postgres/8.4/data
export PATH PGDATA

you probably also want to add these to the root user’s path

svcadm enable postgresql-84:32_bit

root@oi:/var/log# svcs -a|grep postg
disabled       17:29:37 svc:/application/database/postgresql_84:default_64bit
online         17:31:35 svc:/application/database/postgresql_84:default_32bit

su - postgres

psql

\l

I initially did this in an ESXi VM in VMWare Workstation, but that keept freezing so I went over to a ‘real vm’ instead. The VM is more responsive.

dCache stuff

wget it from www.dcache.org

pkgadd -d dcache-server-1.9.12-16.pkg

follow http://www.dcache.org/manuals/Book-1.9.12/start/in-install.shtml for the instructions of which postgresql-scripts and users and stuff to create

It’s however not enough :

root@oi:~# /opt/d-cache/bin/dcache start
/opt/d-cache/bin/dcache[127]: local: not found [No such file or directory]
/opt/d-cache/bin/dcache[128]: local: not found [No such file or directory]
/opt/d-cache/bin/dcache[129]: local: not found [No such file or directory]
/opt/d-cache/bin/dcache[130]: local: not found [No such file or directory]
/opt/d-cache/bin/dcache[131]: local: not found [No such file or directory]
/opt/d-cache/bin/dcache[132]: local: not found [No such file or directory]
/opt/d-cache/bin/dcache[317]: .[162]: local: not found [No such file or directory]

so, edit /opt/d-cache/bin/dcache and remove the if in the beginning that will make it use /usr/xpg4/bin/sh – so that it uses /bin/bash instead.

Like this:

if [ "$1" = "%" ]; then
    shift
elif [ "`uname`" = "SunOS" ]; then
    if [ -x /bin/bash ]; then
        exec /bin/bash $0 % "$@"
    else
        echo "Cannot find POSIX compliant shell. This script will"
        echo "probably break, but we attempt to execute it anyway."
    fi
fi

after I changed this, I noticed in the console that it said:

rpcbind: non-local attempt to set

bad?

anyway, then start dCache

root@oi:/opt/d-cache/bin# /opt/d-cache/bin/dcache start
Starting dCacheDomain done

in /var/log/dCacheDomain.log you’ll find why it’s not working:

touch /etc/exports

and it appears to be stable, except for some errors about (NFSv3-oi), however, we disregard those for now, we just want to get it running!

vi /opt/d-cache/etc/dcache.conf
dcache.layout=single
mkdir /pool1

and

vi /opt/d-cache/etc/layouts/single.conf

uncomment the pool1 section, set a maxDiskSize=2G to specify max disk space allowed.
Specifics are in the installation part on dcache.org in the book.

Then point your webbrowser to – see any blue buttons?! yay, it’s up!

Next step is to try it out, this might prove a little bit more difficult (to find dcap/root/srm client for opensolaris/oi).

PostgreSQL problem

so maybe next time you restart the vm it gives some errors and puts the postgresql-server in maintenance mode. Look in /var/adm/messages for some tips, it should point you to

svcs -xv svc:/application/database/postgresql_84:default_32bit

/var/svc/log/application-database-postgresql_84\:default_32bit.log

which will tell you more about what’s going on and how to fix it

svcadm restart
svcadm clear

Use dCache with webdav

We’ll start with trying to use Webdav (doesn’t require anything fancy on the client side, except maybe a browser plugin for uploading).

go to the layout file and uncomment the webdav part, add

webdavAnonymousAccess=FULL
webdavRootPath=/data/world-writable

The script /opt/d-cache/bin/chimera-cli.sh sadly assumes that you need bash or a special version of bash somehow.
So running

bash /opt/d-cache/bin/chimera-cli.sh mkdir /data

works, but

/opt/d-cache/bin/chimera-cli.sh mkdir /data

does not.

See http://www.dcache.org/manuals/Book-1.9.12/start/intouch-client.shtml for the rest.

If you keep the webdav in the same domain you’ll need to restart the whole dcache.

In Windows 7 you can then mount a new network folder and click “Connect to a web site that you can use to store your documents and pictures” and in there type:

Now you get another folder in your computer where you can create folders. These will also show up if you surf to , sadly however, you cannot write files. gridpp.ac.uk says it’s because pool is full. But it’s 2048MiB and all free?

https://twiki.grid.iu.edu/bin/view/Storage/MeetingMinutes2009Sep02

suggests minimum pool size might be 4G, changed pool maxdiskspace to 8G.

tada, now the copy starts, or the file creation starts, but I cannot actually write anything to it. So if I create a .txt file, I can give it a name and save it, unless I try to write anything inside it!

some errors to accompany this:

 (WebDAV-oi) [door:WebDAV-oi@dCacheDomain:13295xxx] Your resource factory returned a resource with a different name to that requested!!! Requested: null returned: world-writable - resource factory: class org.dcache.webdav.DcacheResourceFactory
 (WebDAV-oi) [door:WebDAV-oi@dCacheDomain:13295xxx] resource is being locked with a null user. This won't really be locked at all...
 (WebDAV-oi) [door:WebDAV-oi@dCacheDomain:13295xxx] resource is being locked with a null user. This won't really be locked at all...
 (WebDAV-oi) [door:WebDAV-oi@dCacheDomain:13295xxx] Your resource factory returned a resource with a different name to that requested!!! Requested: null returned: world-writable - resource factory: class org.dcache.webdav.DcacheResourceFactory
 (pool1) [00002CBCC971ABC14BDC9E496A0AEAA31FC3] A task was added to queue 'store', however the queue is not configured to execute any tasks.

trying dccp

[root] # cd /etc/yum.repos.d/
[root] # wget http://grid-deployment.web.cern.ch/grid-deployment/glite/repos/3.2/glite-UI.repo
or 
[root] # yum install dcap dccp -d 63 -H /bin/bash dcap://ip.to.server/data/world-writable/2nd/4 creates another empty file, while it adds an entry to the 'store' queue and then not so much happens. stuck on this: Sending control message: 2 0 client open "dcap://IP.to.server/data/world-writable/2nd/4" w -mode=0755 -truncate sl1 40619 -timeout=-1 -onerror=default  -alloc-size=938672  -uid=0 (len=153) 

NFSv41

uncomment the nfsv3 and add nfsv41
then on a system you should be able to ‘apt-get install nfs-common’; modprobe nfs; mkdir /nfsv4 mount -t nfs4 ip.to.server:/ /nfsv4′. But for me this stops working with an “cp: closing `./bash’: Input/output error”. Possibly because I could not specify -o minorversion=1 on this ubuntu install (3.0.0-16).

 

NFSv41 with dCacheToGo

Download dCache2Go from here:

To convert it into VMware format:

VBoxManage clonehd source.vdi target.vmdk --format VMDK

Then create new vm and set the new vmdk file as the disk.

When this VM is up (and the dCache server of course), hit:

mount -t nfs4 -o minorversion ip.to.dcache.host:/ /mnt

then

cd /mnt/data/world-writable
mkdir another
cd another
cp /bin/bash .
cp bash /tmp/bash
diff /tmp/bash /bin/bash

SCORE! We have a working dCache setup in a VM running openindiana!

Simple RRD graphs

This is how to create simple RRD graphs using one data source that can be 0 and above. It is not an “ever increasing” counter.

It will look like this:

example rrd graph

 

1. Create the rrd database

I wrote this down in a .sh file so I can go back later and see how it was set up.

#!/bin/sh
rrdfile=’/home/$user/rrd/movers.rrd’
rrdtool=’/usr/bin/rrdtool’
$rrdtool create $rrdfile –step 300 DS:movers:GAUGE:600:U:U RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460

#5 minute step (base interval with which data will be fed into the RRD)
#10 minute heartbeat for the data source
#2 days of 5 minute averages
#2 weeks of 1/2 hour averages
#2 months of 2 hour averages
#2 years of 12 hour averages
 

2 Add data to the rrd

Also done in a bash script. Because the –step above is set to 300, you need to run this script every 300 seconds (or every 5 minutes). The script specified in $allpools prints the path to a file. Then with $output and $movers that file is grepped for ‘RUNNING’ and then it counts how many lines that was – amount of movers.

#!/bin/sh
rrdfile='/home/$user/rrd/movers.rrd'
rrdtool='/usr/bin/rrdtool'

allpools='/home/$user/bash_script.sh'
output=$($allpools)
movers=$(grep RUNNING $output|wc -l)

$rrdtool update $rrdfile N:$movers

The N: is NOW. $movers is the value you want to plot.

3. Make a graph

Add this to another .sh script. This you can run at whatever interval you want.

#!/bin/sh
rrdfile='movers.rrd'
rrdtool='/usr/bin/rrdtool'
dpath="/var/www/html/graphs/movers"
alltimeimage="$dpath/movers.png"
lastweekimage="$dpath/moverslw.png"
lastmonthimage="$dpath/moverslm.png"
last4hoursimage="$dpath/moversl4h.png"
last3monthsimage="$dpath/moversl3m.png"
lastday="$dpath/moversld.png"
enddate=$(date +%s)
#enddate is the same as "now"
cd /home/$user/rrd

$rrdtool graph $alltimeimage --end now --start 1321603000 \
        -v from_beginning -t active_movers \
        DEF:movers=$rrdfile:movers:AVERAGE LINE:movers#000000
#rrdtool graph /path/to/image.png --end now --start when_I_started_capturing -v label_left -t title_top \
#DEF: as I only have one I only used movers, maybe you can change the names in case you have several data sources
#DEF: you can also use other things than AVERAGE (like MIN/MAX)
#LINE: #000000 is black

$rrdtool graph $lastweekimage --start -1w \
        -v last_week -t active_movers \
        DEF:movers=$rrdfile:movers:AVERAGE LINE:movers#000000 \
        AREA:movers#8C2E64 \
        GPRINT:movers:LAST:"Current\: %1.0lf" \
        GPRINT:movers:MAX:"Max\: %1.0lf" \
        GPRINT:movers:MIN:"Min\: %1.0lf" \
        GPRINT:movers:AVERAGE:"Avg\: %1.0lf"

#If you want to make it a little more complex. AREA fills the space between the value and the x-axis.
#GPRINT statements print some values relating to the graph.

$rrdtool graph $last4hoursimage --end now --start end-4h \
        -v last_4_hours -t active_movers \
        DEF:movers=$rrdfile:movers:AVERAGE LINE:movers#000000

$rrdtool graph $lastmonthimage --end now --start -1m \
        -v last_month -t active_movers \
        DEF:movers=$rrdfile:movers:AVERAGE LINE:movers#000000

$rrdtool graph $last3monthsimage --end now --start -8035200 \
        -v last_3_months -t active_movers \
        DEF:movers=$rrdfile:movers:AVERAGE LINE:movers#000000

$rrdtool graph $lastday --end now --start -1d \
        -v last_day -t active_movers \
        DEF:movers=$rrdfile:movers:AVERAGE LINE:movers#000000

4. Crontab – scheduling

*/5 * * * * /bin/bash /home/$user/rrd/rrd.update.sh > /dev/null 2>&1
#every 5 minutes
*/15 * * * * /bin/bash /home/$user/rrd/rrd.graph.sh > /dev/null 2>&1
#every 15 minutes

 

5. Final Words

I am not providing the data gathering script here as you probably won’t need it: it lists movers (transfers) on all pools in a dCache system.