In order to enable the database, the following steps must be taken.
If the billing database does not already exist (see further below on migrating from an existing one), create it (we assume PostgreSQL here):
[root] #
createdb -O srmdcache -U postgres billing
If you are using a version of PostgreSQL prior to 8.4, you will also need to do:
[root] #
createlang -U srmdcache plpgsql billing
No further manual preparation is needed, as the necessary tables, indices, functions and triggers will automatically be generated when you (re)start the domain with the billing database logging turned on (see below).
The property billing.enable.db
controls whether
the billing cell sends billing messages to the database. By
default the option is disabled. To activate, set the value
to true
and restart the domain in which
the httpd
service is running.
Please take care to define the billing
service
before the httpd
service in your layout file. If
the billing
service is defined in a separate
domain, this domain should be defined before the domain in
which the httpd
service is running.
Example:
Extract from the layout file:
[httpdDomain] billing.enable.db=true [httpdDomain/billing] [httpdDomain/httpd] ...
[root] #
dcache restart httpdDomain
Stopping httpdDomain 0 1 done Starting httpdDomain done
In most cases, the billing service will be run out-of-the-box; nevertheless, the administrator does have control, if this is desired, over the database configuration.
Database name, host, user, and password can be easily modified using the properties:
billing.db.name
billing.db.host
billing.db.user
billing.db.password
The current database values can be checked with the dcache database ls command.
Example:
# dcache database ls DOMAIN CELL DATABASE HOST USER MANAGEABLE AUTO namespaceDomain PnfsManager chimera localhost chimera Yes Yes namespaceDomain cleaner chimera localhost chimera No No httpdDomain billing billing localhost srmdcache Yes Yes
Database inserts are batched for performance, and are controlled by the following properties:
billing.db.inserts.max-before-commit
(defaults to 10000
)billing.db.inserts.timeout-before-commit
(defaults to 5
)The default settings should usually be sufficient.
Should finer control over the DataNucleus layer (which
talks to the database) be needed, then a new
datanucleus.properties
file must be
provided. The path to this file, which will override the
internal settings, should be indicated using:
billing.db.config.path
(defaults to ""
)Changing this configuration requires an understanding of DataNucleus , and we expect it will be rather uncommon to utilize this option (it is suggested that the administrator in this case consult with a member of the dCache team).
Changing the database type (which defaults to PostgreSQL) to
something else would entail the above-mentioned necessary
modification of the
datanucleus.properties
as well as
changing the billing.db.driver
and
billing.db.url
properties appropriately.
This is not a recommended procedure, though in certain
exceptional circumstances, it may be desirable or
necessary. Once again, consultation with the dCache
team is suggested in this case.