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
billingToDb
controls whether the billing cell sends billing messages to the database. By default the option is disabled. To activate, set the value toyes
and restart the domain in which thehttpd
service is running.Example:
Extract from the layout file:
[httpdDomain] billingToDb=yes [httpdDomain/httpd] [httpdDomain/billing] ...
[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:
billingDbName
billingDbHost
billingDbUser
billingDbPass
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:
billingMaxInsertsBeforeCommit
(defaults to10000
)billingMaxTimeBeforeCommitInSecs
(defaults to5
)
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:billingInfoAccessPropertiesFile
(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 thebillingDbDriver
andbillingDbUrl
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.