wiki:Traditional Installation of dCache server - Karlsruhe2014
Last modified 6 years ago Last modified on 09/03/14 09:59:26
Home next >>

Installation of dCache server

(SERVER) (SERVER) (SERVER) (SERVER)

In this part we install dCache as a single node instance. Which means that all our services will run on the same host, it shows us the basics and necessary setup. At the end of this part we will have a running dCache that can be mounted locally as well as on your client.

Find the dCache server rpm on your server in the root's home direcrory /root/:

[root]# ls dcache-*
dcache-2.10.0-1.noarch.rpm

If you are using your own virtual machine, please download the rpm from dCache Downloads

Install the rpm on your server machine:

[root]# rpm -ivh dcache-2.10.0-1.noarch.rpm
Preparing...                ########################################### [100%]

1:dcache                 ########################################### [100%]
...

Set the owner for the host certificates: We already placed a X.509 host certificate in /etc/grid-security/hostcert.pem and /etc/grid-security/hostkey.pem . During installation of the RPM a user and group "dcache" would be created, and these two files need to get the right owners/permissions, so that dCache can use them. However, as you noticed before we logged into the machines as user dcache, which is why the user already existed. We nonetheless need to set the right permissions on both files:

[root]# chown dcache:dcache /etc/grid-security/host*.pem
[root]# chmod u=rw,go=r /etc/grid-security/hostcert.pem
[root]# chmod u=rw,go= /etc/grid-security/hostkey.pem

dCache server has dependencies: java-1.7.0-openjdk, postgresql-server (version >8.4), rpcbind and nfs-utils. You will find that openjdk, postgresql-server, rpcbind and nfs-utils are already installed on your machine. Run the following command to check for the java, postgresql, rpcbind and nfs-utils packages.

[root]# yum  list installed postgresql92-server java-1.7.0-openjdk nfs-utils rpcbind
Loaded plugins: security
Installed Packages
java-1.7.0-openjdk.x86_64                     1:1.7.0.55-2.4.7.1.el6_5                    @sl-security/6.4                                 
nfs-utils.x86_64                              1:1.2.3-39.el6                              @sl6x/6.4                                        
postgresql92-server.x86_64                    9.2.8-1PGDG.rhel6                           @pgdg92                                          
rpcbind.x86_64                                0.2.0-11.el6                                @anaconda-ScientificLinux-201303180938.x86_64/6.1

Look this up later: For more information on this please see dCache Book - Prerequisites. There are also several trivial steps that you have to do to setup postgresql, but they are not part of this tutorial and can be found in dCache Book - Readying the PostgreSQL server for the use with dCache We don't focus on detailed configuration of postgres server here, but have a look at the provided script for the commands needed if you are interested (configurepgsql.sh).

[root]# cat configurepgsql.sh
#/bin/bash
service postgresql-9.2 initdb
sed -ie 's/max_connections = 100/max_connections = 1000/' /var/lib/pgsql/9.2/data/postgresql.conf
service postgresql-9.2 start
chkconfig postgresql-9.2 on

mv /var/lib/pgsql/9.2/data/pg_hba.conf{,_ori}
cat >/var/lib/pgsql/9.2/data/pg_hba.conf <<EOF
# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

# "local" is for Unix domain socket connections only
local   all         all                               trust
# IPv4 local connections:
host    all         all         127.0.0.1/32          trust
# IPv6 local connections:
host    all         all         ::1/128               trust
EOF
service postgresql-9.2 restart
createdb -U postgres chimera
createuser -U postgres --no-superuser --no-createrole --createdb chimera
createuser -U postgres --no-superuser --no-createrole --createdb srmdcache
createdb -U srmdcache dcache
createdb -O srmdcache -U postgres billing
dcache database update

Now execute the configurepgsql.sh script:

[root]# ./configurepgsql.sh
Initializing database:                                     [  OK  ]
Starting postgresql-9.2 service:                           [  OK  ]
Stopping postgresql-9.2 service:                           [  OK  ]
Starting postgresql-9.2 service:                           [  OK  ]
...
some strings here
...
INFO  - Successfully released change log lock
Liquibase Update Successful
[root]#

Now you have a running and fully configured postgresql server and installed dCache server.

Configuration files

We make use of flat files, to define and change the settings for the layout and the behavior of dCache on different levels (per host, per domain or per service). There are three main places for the configuration files:

  • /usr/share/dcache/defaults

This directory is filled with files defining the default settings for all dCache services, as they are shipped by dCache.org. Do not modify these files, as they will be replaced by subsequent updates!

  • /etc/dcache/dcache.conf

The central configuration file that ideally should be nearly identical on all nodes of the dCache setup. Maybe it is possible to have only one difference among all nodes at all: the parameter pointing to the layout configuration files. To get to know what settings can be made in dcache.conf you can look through dcache.properties in the defaults directory.

  • /etc/dcache/layouts

Layout files are the place to define the actual topology for the dCache services/domains on this node. So typically layout files are identical for nodes that have same services running on it (e.g.: doors & pools).

The dCache install does no longer provide us with premade layout files. Right now you could start dCache and it would use the empty dcache.conf file and the fallback layout file <hostname>.conf. This would not exist after installing dCache, which is why we need to copy a file that we provide for this hands-on to /etc/dcache/layouts/:

[root]# cp /root/hands-ons/Karlsruhe/2014/server/layout.file /etc/dcache/layouts/ws_gridka_2014.conf

With this file the most important core services will be configured to run one single domain with default settings.

We need to tell dCache to use the layout file we just created and add this to /etc/dcache/dcache.conf:

[root]# vi /etc/dcache/dcache.conf

Do not make the mistake of entering the entire file name there, just add the following line:

dcache.layout=ws_gridka_2014

Leave vi open for the moment and keep on reading.

Adjust the layout file

Firstly we need to tell dCache that there will be many domains communicating with each other. As we described in the introduction dCache services run inside so called domains. Since we will have many domains, we will need some mechanism for these domains to communicate. The cells framework is used for this communication, which is why we activate it by adding the following line to the beginning of /etc/dcache/dcache.conf:

broker.scheme=cells

NOTE: broker.scheme=cells is default dCache configuration so not really necessary to define.

As mentioned we want to be able to mount dCache locally using NFSv41. Therefor a service called nfsv41 needs to be started, which we will keep in a separate domain for convenience of restarting it separately from the rest of dCache. These lines need to be added at the end of /etc/dcache/layouts/ws_gridka_2014.conf. They add a domain to dCache - [nfs-Domain] - that holds the nfsv41 service.

[nfs-Domain]
[nfs-Domain/nfsv41]

Save and leave vi and have a look at the layout file:

[root]# cat   /etc/dcache/layouts/ws_gridka_2014.conf
[dCacheDomain]
[dCacheDomain/admin]
[dCacheDomain/broadcast]
[dCacheDomain/poolmanager]
[dCacheDomain/loginbroker]
[dCacheDomain/spacemanager]
[dCacheDomain/pnfsmanager]
[dCacheDomain/cleaner]
[dCacheDomain/dir]
[dCacheDomain/gplazma]
[dCacheDomain/gsi-pam]
[dCacheDomain/pinmanager]
[dCacheDomain/billing]
[dCacheDomain/srm-loginbroker]
[dCacheDomain/httpd]
[dCacheDomain/topo]
[dCacheDomain/info]

[nfs-Domain]
[nfs-Domain/nfsv41]


# [dCacheDomain/pool]
# name=pool1
# path=/path/to/pool1

# [dCacheDomain/pool]
# name=pool2
# path=/path/to/pool2

# [dCacheDomain/replica]
# [dCacheDomain/dcap]
# [dCacheDomain/gsidcap]
# [dCacheDomain/gridftp]
# [dCacheDomain/srm]
# [dCacheDomain/transfermanagers]
# [dCacheDomain/xrootd]
# [dCacheDomain/webdav]
# [dCacheDomain/webadmin]
[root]#

Before we can start dCache we have to empty /etc/dcache/gplazma.conf as there is no security configured in a blank dCache:

[root]# echo "" > /etc/dcache/gplazma.conf

Then we want to be sure rpcbind service is up and running (in order to start nfs4 service correctly):

[root] # service rpcbind status
rpcbind is stopped
[root] # service rpcbind start
Starting rpcbind:                                          [  OK  ]
[root] # service rpcbind status
rpcbind (pid  4178) is running...

Check that all is configured properly before starting dcache by running "dcache check-config":

[root@gks-129 server]# dcache check-config
[WARNING] dcache.conf:12: Property broker.scheme: use
                          "dcache.broker.scheme" instead; support for
                          broker.scheme will be removed in the future
[ERROR] ws_gridka_2014.conf:11: URL
                                [file:/usr/share/dcache/services/gsi-pam.batch]
                                (no such resource)
[ERROR] ws_gridka_2014.conf:14: URL
                                [file:/usr/share/dcache/services/srm-loginbroker.batch]
                                (no such resource)
[ERROR] ws_gridka_2014.conf:38: URL
                                [file:/usr/share/dcache/services/nfsv41.batch]
                                (no such resource)
Found 3 errors and 1 warning.

Oh no, there are errors. Why is that? Well the dcache.conf and layout file that we provided have some errors, as some services are obsolete, were merged in other services or simply need to be configured a bit differently in this new version of dCache. Let's fix these issues. The first error states that there is a wrong property used in the dcache.conf file in line 12 and it even tells us what the right property should look like. This can be the case when you update from one version to another that a property name changes. Let's fix it opening the file with vi:

/etc/dcache/dcache.conf before:

...
# defaults by redefining the parameters in this file.
broker.scheme=cells
dcache.layout=ws_gridka_2014

after:

...
# defaults by redefining the parameters in this file.
dcache.broker.scheme=cells
dcache.layout=ws_gridka_2014

Let's run check-config again.

[root]# dcache check-config
[ERROR] ws_gridka_2014.conf:11: URL
                                [file:/usr/share/dcache/services/gsi-pam.batch]
                                (no such resource)
[ERROR] ws_gridka_2014.conf:14: URL
                                [file:/usr/share/dcache/services/srm-loginbroker.batch]
                                (no such resource)
[ERROR] ws_gridka_2014.conf:38: URL
                                [file:/usr/share/dcache/services/nfsv41.batch]
                                (no such resource)
Found 3 errors.

Yeah, one warning is gone, 3 errors to go. The errors tell us that three of the services we defined can not be found anymore. Why is that? The best place to look for answers is the release notes. In the last hands-on we used dcache version 2.6, now we use, let's check:

[root]# dcache version
2.10.0

So we would actually have to read all the release notes between 2.6 and 2.10, but we have mercy and give you a pointer: http://www.dcache.org/downloads/1.9/release-notes-2.7.shtml. In there you will find that the gsi-pam service can be dropped, "srm-loginbroker can simply be removed from layout" and the nfsv41 alternative is nfs, but you need to set nfs.version = 4.1 in the layout file /etc/dcache/layouts/ws_gridka_2014.conf. Let's do that:

before:

[dCacheDomain]
[dCacheDomain/admin]
[dCacheDomain/broadcast]
[dCacheDomain/poolmanager]
[dCacheDomain/loginbroker]
[dCacheDomain/spacemanager]
[dCacheDomain/pnfsmanager]
[dCacheDomain/cleaner]
[dCacheDomain/dir]
[dCacheDomain/gplazma]
[dCacheDomain/gsi-pam]
[dCacheDomain/pinmanager]
[dCacheDomain/billing]
[dCacheDomain/srm-loginbroker]
[dCacheDomain/httpd]
[dCacheDomain/topo]
[dCacheDomain/info]

[nfs-Domain]
[nfs-Domain/nfsv41]

after:

[dCacheDomain]
[dCacheDomain/admin]
[dCacheDomain/broadcast]
[dCacheDomain/poolmanager]
[dCacheDomain/loginbroker]
[dCacheDomain/spacemanager]
[dCacheDomain/pnfsmanager]
[dCacheDomain/cleaner]
[dCacheDomain/dir]
[dCacheDomain/gplazma]

#[dCacheDomain/gsi-pam]

[dCacheDomain/pinmanager]
[dCacheDomain/billing]

#[dCacheDomain/srm-loginbroker]

[dCacheDomain/httpd]
[dCacheDomain/topo]
[dCacheDomain/info]

[nfs-Domain]
#[nfs-Domain/nfsv41]
[nfs-Domain/nfs]
nfs.version = 4.1

Now let's check the config again:

[root]# dcache check-config
No problems found.

Yes, we made it.

Now start dCache by:

[root]# dcache start
Starting dCacheDomain done
Starting nfs-Domain done

Check if dCache has started up correctly for domains:

[root]# dcache status
DOMAIN       STATUS  PID   USER
dCacheDomain running 18314 dcache
nfs-Domain   running 18359 dcache

and services:

[root]# dcache services
DOMAIN       SERVICE         CELL            LOG
dCacheDomain admin           alm             /var/log/dcache/dCacheDomain.log
dCacheDomain broadcast       broadcast       /var/log/dcache/dCacheDomain.log
dCacheDomain poolmanager     PoolManager     /var/log/dcache/dCacheDomain.log
dCacheDomain loginbroker     LoginBroker     /var/log/dcache/dCacheDomain.log
dCacheDomain spacemanager    SrmSpaceManager /var/log/dcache/dCacheDomain.log
dCacheDomain pnfsmanager     PnfsManager     /var/log/dcache/dCacheDomain.log
dCacheDomain cleaner         cleaner         /var/log/dcache/dCacheDomain.log
dCacheDomain dir             dirLookupPool   /var/log/dcache/dCacheDomain.log
dCacheDomain gplazma         gPlazma         /var/log/dcache/dCacheDomain.log
dCacheDomain pinmanager      PinManager      /var/log/dcache/dCacheDomain.log
dCacheDomain billing         billing         /var/log/dcache/dCacheDomain.log
dCacheDomain srm-loginbroker srm-LoginBroker /var/log/dcache/dCacheDomain.log
dCacheDomain httpd           httpd           /var/log/dcache/dCacheDomain.log
dCacheDomain topo            topo            /var/log/dcache/dCacheDomain.log
dCacheDomain info            info            /var/log/dcache/dCacheDomain.log
nfs-Domain   nfsv41          NFSv41-ws-server-001   /var/log/dcache/nfs-Domain.log

Then also check the log files:

[root]# tail -F /var/log/dcache/*

==> /var/log/dcache/dCacheDomain.log <==

2014-03-06 11:00:53 Launching /usr/bin/java -server -Xmx512m -XX:MaxDirectMemorySize=512m -Dsun.net.inetaddr.ttl=1800 -Dorg.globus.tcp.port.range=20000,25000 -Djava.net.preferIPv4Stack=true -Dorg.dcache.dcap.port=0 -Dorg.dcache.net.tcp.portrange=33115:33145 -Dorg.globus.jglobus.delegation.cache.lifetime=30000 -Dorg.globus.jglobus.crl.cache.lifetime=60000 -Djava.security.krb5.realm=EXAMPLE.ORG -Djava.security.krb5.kdc=localhost -Djavax.security.auth.useSubjectCredsOnly=false -Djava.security.auth.login.config=/etc/dcache/jgss.conf -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/dcache/dCacheDomain-oom.hprof -javaagent:/usr/share/dcache/classes/spring-instrument-3.2.2.RELEASE.jar -Djava.awt.headless=true -DwantLog4jSetup=n -Ddcache.home=/usr/share/dcache -Ddcache.paths.defaults=/usr/share/dcache/defaults org.dcache.boot.BootLoader start dCacheDomain
06 Mar 2014 11:01:32 (PinManager) [] [AspectJ] javax.* types are not being woven because the weaver option '-Xset:weaveJavaxPackages=true' has not been specified

==> /var/log/dcache/nfs-Domain.log <==

2014-03-06 11:00:54 Launching /usr/bin/java -server -Xmx512m -XX:MaxDirectMemorySize=512m -Dsun.net.inetaddr.ttl=1800 -Dorg.globus.tcp.port.range=20000,25000 -Djava.net.preferIPv4Stack=true -Dorg.dcache.dcap.port=0 -Dorg.dcache.net.tcp.portrange=33115:33145 -Dorg.globus.jglobus.delegation.cache.lifetime=30000 -Dorg.globus.jglobus.crl.cache.lifetime=60000 -Djava.security.krb5.realm=EXAMPLE.ORG -Djava.security.krb5.kdc=localhost -Djavax.security.auth.useSubjectCredsOnly=false -Djava.security.auth.login.config=/etc/dcache/jgss.conf -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/dcache/nfs-Domain-oom.hprof -javaagent:/usr/share/dcache/classes/spring-instrument-3.2.2.RELEASE.jar -Djava.awt.headless=true -DwantLog4jSetup=n -Ddcache.home=/usr/share/dcache -Ddcache.paths.defaults=/usr/share/dcache/defaults org.dcache.boot.BootLoader start nfs-Domain

Now exit the tail command by pressing control+c.

This should show you that domains were created and no error messages should be flying around, so the output that tail shows should stop at some point after starting dCache although some output is normal to inform about successful domain creation. Sometimes a domain might report that it could not connect to the dCacheDomain, because it might have started up in advance of dCacheDomain. If however "dcache services" reports that the domain and service have been started, it was correctly connected after the dCacheDomain came up.

First Contact

Now that we have a running dCache that does nothing, we would like to make a first contact. This will be achieved by mounting dCache locally via NFSv41.

dCache needs several things to come together to be able to store data in it. It needs to authenticate and authorize people wanting to store data (gPlazma takes care of this), it needs a logical structure where file's names can be found in a directory structure, the namespace, which keeps file's meta data. The actual files are stored in a service that is called a pool that allows writing data to block devices and allows for a hierarchical storage management to be employed (More about this in the bonus part about tertiary storage of this hands-on).

dCache needs something that holds that actual data, the pools. So we first create a pool that is stored in a certain path in the local file system and set its maximum size. Execute the following command in your server console:

[root]# dcache pool create --size=419430400  --meta=db --lfs=precious   /pools/nfsPool1 nfsPool1 poolDomain
Created a pool in /pools/nfsPool1. The pool was added to poolDomain in
file:/etc/dcache/layouts/ws_gridka_2014.conf.
[root]# cat /etc/dcache/layouts/ws_gridka_2014.conf 
[dCacheDomain]
[dCacheDomain/admin]
...

...
[poolDomain]
[poolDomain/pool]
name=nfsPool1
path=/pools/nfsPool1
maxDiskSpace=419430400
metaDataRepository=org.dcache.pool.repository.meta.db.BerkeleyDBMetaDataRepository
waitForFiles=${path}/data:${path}/meta
lfs=precious

After we created the pool we need to start the domain that was created by executing:

[root]# dcache status
DOMAIN       STATUS  PID   USER
dCacheDomain running (for 118 seconds) 4509 dcache 
nfs-Domain   running (for 118 seconds) 4564 dcache 
poolDomain   stopped                   dcache
[root]# dcache start poolDomain
Starting poolDomain done

The pool service will always make sure that there is enough space on the pool to allow for some data to be moved around. The amount of space that is kept free is configurable and by default it is 4 GiB. For this tutorial we need to set the gap to a very low value (10 MB) because the disk space on the hands-on machines is so limited. In order to be able to administrate dCache we need to login to the admin interface. We will use key-based login with ssh2. Please create yourself a DSA key and store the public key in /etc/dcache/admin/authorized_keys2. Do the following steps to change the gap size (when generating dsa key use default file name and NO password):

[root]# ssh-keygen -t dsa
...
[root]# cat .ssh/id_dsa.pub >> /etc/dcache/admin/authorized_keys2
[root]# ssh -l admin -p 22224 localhost
... (local) admin > cd nfsPool1
... (nfsPool) admin > set gap 10m
Gap set to 10485760
... (nfsPool) admin > save

Then exit the admin interface by pressing control+d.

Try to create yourself second pool with name "nfsPool2" assigned to the same domain it will be needed for the next exercises (don't forget about gap size).

This now enables us to actually store files in dCache, but how? ... for example via a mounted NFSv41.

We need to set the NFS domain to make sure nfs server and client are inside the same namespace. This is done by adding the following line to the end of /etc/dcache/dcache.conf:

nfs.domain = karlsruhe-domain

As mentioned dCache also needs a namespace where file's meta data is stored. We need to create a directory in the dCache namespace by executing in the chimera front-end:

[root]# chimera
chimera:/# mkdir /data
chimera:/# mkdir /data/world-writable

We also need to tell the nfs server that machines are allowed to mount certain directories that the dCache server provides access to. This is not really a dCache specific thing as you would also use the /etc/exports file for a non-dCache nfs servers. Please add the following line to /etc/exports:

/data localhost(rw,no_root_squash)

This states that the directory /data can be accessed by localhost with read/write permissions. The no_root_squash option allows root to access/create files on the nfs server as root.

We do not have authentication setup yet, which is why we need to set the directory world writable to be able to write:

[root]# chimera
chimera:/# chmod 777 /data/world-writable

Leave the chimera front-end by pressing ctrl+d. Now we will be able to see the benefit of having the nfsv41 service in a separate domain as we need to restart the domain for the change in /etc/exports to take effect.

[root]# dcache status
DOMAIN       STATUS                   PID  USER   
dCacheDomain running (for 27 minutes) 4509 dcache 
nfs-Domain   running (for 27 minutes) 4564 dcache 
poolDomain   running (for 25 minutes) 5229 dcache 

[root]# dcache restart nfs-Domain
Stopping nfs-Domain 0 1 2 done
Starting nfs-Domain done

Had we not put the nfs service in a separate domain, we would have had to restart entire dCache, all services. Thereby we would disrupt all of them just to realise a minor fix to the config of the nfs service.

After this we can mount dCache locally by doing the following:

[root]# mkdir /data
[root]# mount -o intr,minorversion=1 localhost:/data /data

Now you can copy some file e.g.:

[root]# cp /etc/hosts /data/world-writable/myFirstNfsFile00001

just make an ls to be sure the file is actually copied

[root]# ls -la /data/world-writable/myFirstNfsFile00001

Congratulations you wrote your first file into dCache. We will now mount nfsv41 on the client. Therefor we need to grant it permission on the server side. Therefore edit /etc/exports:

[root]# vi /etc/exports

and change the one line from

/data localhost(rw,no_root_squash)

to

/data localhost(rw,no_root_squash) <your client IP address>(rw,no_root_squash)

or to

/data localhost(rw,no_root_squash) <your client HOSTNAME>(rw,no_root_squash)

then exit INSERT mode and save. This line now means that directory /data can be mounted with read-write permissions from localhost as well as <your client address>. After addition of this permission restart the nfs-Domain once more:

[root]# dcache restart nfs-Domain

Now go to your client:

(CLIENT) (CLIENT) (CLIENT) (CLIENT)

There you can have a look at:

[root]# less /etc/idmapd.conf

At the top of this file you will find:

[General]
#Verbosity = 0
# The following should be set to the local NFSv4 domain name
# The default is the host's DNS domain name.
Domain = karlsruhe-domain

Remember, earlier we set the nfs.domain = ho_dcahce-domain in the dcache.conf on the server. This is now telling server and client to be in the same domain. If you had to change this value, which we luckily already did for you, you would have to restart the /etc/rpcidmapd service. But that is not necessary, now.

Check if the machine has a /data directory (just type "ls /data"), in case not just create with:

[root]# mkdir /data

then mount and have a look at the mounted dCache and unmount:

[root]# mount -o intr,minorversion=1 <your server address>:/data /data
[root]# ls -R /data
...
[root]# umount /data

Please note: For the nfsv41 mount to work on our client we need a nfs-utils installed, an SL6 kernel > 2.6.32-220.

What you have now is a running dCache server that has a mounted NFSv41 server locally that you have access data without any authentication. In this section we also created started a pool service with one pool, we created a directory /data that holds our data and a subdirectory /data/world-writable that can be used without authentication.


Home next >>