The mdclient AMGA metadata client application and its usage (hands on)

The AMGA metadata catalog can be accessed using both the mdclient client application or a set of API calls. In this WIKI you will learn about the use and configuration of the mdclient AMGA metadata client and how to create simple metadata structures inside an AMGA server. In particular the following items will be covered by this WIKI session:

1 Accessing and configure the AMGA client (mdclient)

It is possible to run the AMGA client from any gLite user interface having the AMGA client installed. To control if your UI is able to run the AMGA client, just check the output of the following command:

1.1) Check the AMGA client or get client version

rpm -qa | grep -i amga-cli (You should get a package name like: glite-amga-cli-X.Y.Z-w)

Before starting the AMGA client application it is necessary to copy a configuration file into the home directory. There is a template file provided by the AMGA client installation that can be customised and used to access your own AMGA server.

1.2) Copy template configuration file to the HOME directory

cp $GLITE_LOCATION/etc/mdclient.config $HOME/.mdclient.config (The file can be hidden or not by adding/avoiding the '.' character at the beginning of the file name).

Once you have copied your configuration file (.mdclient.config) it is necessary to open the file using a text editor and change some values. The following fields should be changed accordingly:

1.3) Setup the .mdclient.config configuration file

Login=acgridXX (replace XX according to your UI login id)
Password=****** (replace **** with your UI login password)
UseSSL = no (we are not using ssl-based authentication)
Port=8822 (AMGA server listening port)
HOST=localhost (AMGA server hostname)
AuthenticateWithCertificate = 0 (not using certificate for AMGA authentication)
UseGridProxy = 0 (not using grid proxy for AMGA authentication)

Now the AMGA client application can be started:

1.4) Start the mdclient application

$ mdclient

Once you are succesfully logged in, you will see the command prompt:

Connected to localhost:8822
ARDA Metadata Server 1.2.0

2 Getting help on mdclient usage

It is possible to get help anytime on the client just using the 'help' command.

2.1) Try the help command

Query> help
>> >help [topic]<
>> >Displays help on a command or a topic.<
>> >Valid topics are: help metadata metadata-optional directory entry group acl index schema sequence user
view ticket commands<

Commands are grouped by topic. You can get the list of valid commands for each topic, typing: help [topic] The list of valid topics is:

  • help
  • metadata
  • metadata-optional
  • directory
  • replication
  • entry
  • group
  • acl
  • index
  • schema
  • sequence
  • user
  • view
  • ticket
  • commands

2.2) Try the use of help command with any topic

Query> help entry

3 Preparation your own directory in AMGA

In the step, you will create your own directory under the /tutorial directory for the following exercise. You will learn:

  • how to create a new directory (e.g. a new database table in the backend RDB)
  • how to set the access control list of your directory

Following the instructions below:

Query> cd /tutorial
Query> mkdir acgridXX     replace XX accordingly
Query> cd acgridXX          replace XX accordingly
Query> acl_show .
Query> acl_remove . root:acgrid
Query> acl_show .
Query> acl_add . root:acgrid rx

NOTE: from now on, you have to work within your own directory !! Before doing the following instructions, please make sure that you are in the directory, /tutorials/acgridxx

4 Basic directory operations

In this step, you will following the instructions below to create/delete some directories in AMGA and move around between them. You will learn:

  • basic directory operations in AMGA

Query> pwd
Query> ls
Query> ls -al
Query> mkdir test_dir
Query> ls -al
Query> cd test_dir
Query> cd ..
Query> rmdir test_dir

5 Attributes and Entries

Following the example below, you will create a new directory for storing the metadata of movies, adding few entries in this directory. You will learn:

  • how to create a directory with metadata attributes
  • how to insert entries into a directory
  • how to assign metadata attributes for an entry

Thinking about a directory (movies) contains file entries. Each file entry has the attributes to characterize a movie. The database-like schema is shown in the following picture:


Creating the movies directory

Query> cd /tutorials/acgridXX     replace XX accordingly
Query> mkdir movies
Query> cd movies

Adding the metadata attributes for the entries in the movies directory

Query> addattr . MovieTitle varchar(128)
Query> addattr . Runtime int
Query> addattr . Description text
Query> listattr .

Adding new entries and set corresponding metadata attributes

Query> addentry MovieTitle 'Madagascar'
Query> setattr Runtime 96
Query> setattr Runtime 96 Description 'Madagascar Movie'

Query> addentry batman.avi MovieTitle 'Batman'
Query> setattr batman.avi Runtime 90 Description 'Batman Movie'

Query> ls -al

Valid datatypes are summarized by the following table where the corrisponding AMGA DB backend datatype is also shown.

AMGA PostgreSQL MySQL Oracle SQLite Pyton
int integer int number(38) int int
float double precision double precision float float float
varchar(n) character varying(n) character varying(n) varchar2(n) varchar(n) string
timestamp timestamp w/o TZ datetime timestamp(6) unsupported time(unsupported)
text text text long text string
numeric(p,s) numeric(p.s) numeric(p.s) numeric(p.s) numeric(p.s) float

6 Metadata retrieval and query

Based on the movies directory and the entries/metadata attributes we created above, this step will fetch the metadata of the entries. You will learn:

  • how to get attribute directory
  • how to get attribute by query

Query> getattr * MovieTitle Runtime Description
Query> selectattr .:MovieTitle .:Runtime .:Description '.:Runtime > 90'
Query> selectattr .:MovieTitle .:Runtime .:Description 'like(.:FILE,"")'
Query> find *.mov 'Runtime > 90'

7 Exercise: a step-by-step hint for building AMGA usecase

In the exercise, we will create a simple bookmark system using AMGA. We will create a new directory, bookmark. The entries in this directory will have the following metadata schema:


  • create a new directory called bookmark
  • set the metadata attributes for the file entries in this directory based on the schema above
  • create two entries given in the following table:

id name surl type desc
1 google web my favorite search engine
2 amga manual pdf The AMGA manual

  • try to query the bookmark to search for your favorites in the bookmark

  • to make it more like an application, you need to make some client interface on top of it using the supported AMGA APIs. Here you can find the C++ APIs, Java APIs, and Python APIs.

-- HurngChunLee - 04 Nov 2007

Topic attachments
I Attachment History Action Size Date Who Comment
PNGpng bookmark_schema.png r1 manage 13.1 K 2007-11-06 - 15:56 HurngChunLee  
PNGpng movies_schema.png r1 manage 11.2 K 2007-11-06 - 10:20 HurngChunLee  
PNGpng sfc_schema.png r1 manage 12.5 K 2007-11-06 - 10:23 HurngChunLee  
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r3 - 2007-11-06 - HurngChunLee
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    ArdaGrid All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback