Command Line Interface

Page for release 1.8.4. See this page for: release 1.8.2, release 1.8.1

The following CLI samples refers to a namespace called TESTNS. Adapt to your own value.

Service management

Display conscience content

[root@singlenode conf]# redc-cluster TESTNS

NAMESPACE INFORMATION

                Name : TESTNS
          Chunk size : 10485760 bytes
              Option : writable_vns = TESTNS


-- meta0 --
                Addr                   Score
192.168.244.143:6001                     100


-- meta2 --
                Addr                   Score
192.168.244.143:6005                       0
192.168.244.143:6006                       0


-- meta1 --
                Addr                   Score
192.168.244.143:6004                      25
192.168.244.143:6003                      25
192.168.244.143:6002                      25

Display conscience content (parsable output)

[root@singlenode ~]# redc-cluster -r TESTNS | grep rawx
TESTNS|rawx|192.168.244.128:6008|score=91|tag.up=true|tag.loc=seclin.bureau119.pc1|tag.vol=/DATA/TESTNS/singlenode17/vol02
TESTNS|rawx|192.168.244.128:6007|score=91|tag.up=true|tag.loc=seclin.bureau119.pc1|tag.vol=/DATA/TESTNS/singlenode17/vol01

Disable service (aka Lock a service)

Find the desired service parameters and replace $service,$ip,$port

[root@singlenode ~]# redc-cluster --set-score 0 -S "TESTNS|$service|$ip:$port"

Enable service (aka unlock a service)

Find the desired service parameters and replace $service,$ip,$port

[root@singlenode ~]# redc-cluster --unlock-score -S "TESTNS|$service|$ip:$port"

Display local service status

Display services status (UP, BROKEN, DISABLED, STOPPED), pid and group belonging

[root@singlenode ~]# gridinit_cmd status
KEY                            STATUS      PID GROUP
gridagent                      UP         3199 common,common,singlenode,gridagent
TESTNS-singlenode-conscience-1 UP         3198 TESTNS,singlenode,singlenode,conscience
TESTNS-singlenode-meta0-1      UP         3374 TESTNS,singlenode,singlenode,meta0
TESTNS-singlenode-meta1-1      UP         3429 TESTNS,singlenode,singlenode,meta1
TESTNS-singlenode-meta1-2      UP         3431 TESTNS,singlenode,singlenode,meta1
TESTNS-singlenode-meta1-3      UP         3430 TESTNS,singlenode,singlenode,meta1
TESTNS-singlenode-meta2-1      UP         3500 TESTNS,singlenode,singlenode,meta2
TESTNS-singlenode-meta2-2      UP         3501 TESTNS,singlenode,singlenode,meta2

Restart a service

[root@singlenode gridinit.conf.d]# gridinit_cmd stop TESTNS-singlenode-conscience-1
DONE            TESTNS-singlenode-conscience-1  Success
[root@singlenode gridinit.conf.d]# gridinit_cmd start TESTNS-singlenode-conscience-1
DONE            TESTNS-singlenode-conscience-1  Success

or

[root@singlenode gridinit.conf.d]# gridinit_cmd restart TESTNS-singlenode-conscience-1
DONE            TESTNS-singlenode-conscience-1  Success

Restart a group of service

[root@singlenode ~]# gridinit_cmd restart @meta2

Container management

Create a container

[root@singlenode ~]# redc put TESTNS/container-test
Container [container-test] created in namespace [TESTNS].

Information on container

Display the different services involved by this container, including versioning policy, default storage policy and container size

[root@localhost ~]# redc info TESTNS/container-test

        [ Directory ]

                META0 : tcp://127.0.0.1:6001
                META1 : tcp://127.0.0.1:6004 tcp://127.0.0.1:6003 tcp://127.0.0.1:6002
                META2 : tcp://127.0.0.1:6023 tcp://127.0.0.1:6022 tcp://127.0.0.1:6021

        [ Container ]

                      Name : [container-test]
                        ID : [CAADCA16D9CD4D7EC918421A715718B62123A79C184B87CC1BC929E9ADBFC4EC]
                Admin Info :
                                          sys.namespace : TESTNS
                                         schema_version : 1.8
                                  sys.versioning_policy : 0
                                             sys.m2vers : 1
                                              base_type : meta2
                                     sys.storage_policy : NONE
                                              base_name : CAADCA16D9CD4D7EC918421A715718B62123A79C184B87CC1BC929E9ADBFC4EC
                                     sys.container_name : container-test
                                         container_name : CAADCA16D9CD4D7EC918421A715718B62123A79C184B87CC1BC929E9ADBFC4EC
                                     sys.container_size : 9095

Activate versioning on a container

Allow 4 versions of each content in this container

[root@localhost ~]# redc version TESTNS/container-test 4

Desactivate versioning on a container

[root@localhost ~]# redc version TESTNS/container-test 0

Change default storage policy

The storage policy is set at the namespace level, then container level and finally at content level. Most precise wins. Available storage policies are displayed by gridcluster command.

[root@localhost ~]# redc stgpol TESTNS/container-test TWOCOPIES

Change quota

If quota is activated and set at namespace level, it is still possible to overload this value on a per container basis. The default value is displayed by gridcluster command.<br> The following example set the quota to 1MB:

[root@localhost ~]# redc quota TESTNS/container-test 1048576

Destroy container

It is not possible to delete a non empty container. In a versioning enabled container, each version of each content must be (marked as) deleted, as described in the following sequence

[root@localhost ~]# redc get -O ShowInfo=on TESTNS/container-test
#Listing container=[container-test]
9095 1 test.txt
9095 2 test.txt (deleted)
#Total in [container-test] : 2 elements

[root@localhost ~]# redc delete TESTNS/container-test

ERROR : Container [container-test] not empty [TESTNS].

(Run action with -v option for technical details.)
[root@localhost ~]# redc get TESTNS/container-test

[root@localhost ~]# redc delete TESTNS/container-test/test.txt?version=1
[root@localhost ~]# redc get -O ShowInfo=on TESTNS/container-test
#Listing container=[container-test]
9095 2 test.txt (deleted)
9095 1 test.txt (deleted)
#Total in [container-test] : 2 elements
[root@localhost ~]# redc delete TESTNS/container-test

Content management

Store content

[root@singlenode ~]# redc put TESTNS/container-test test.txt
Uploaded a new version of content [test.txt] in container [container-test]

In a container without versioning, uploading the same content will generate an error

[root@singlenode ~]# redc put TESTNS/container-test test.txt

ERROR : Content [test.txt] alreay exists in container [container-test]

In a container with versioning, the new version of the content will be uploaded

[root@singlenode~]# redc put TESTNS/container-test test.txt
Uploaded a new version of content [test.txt] in container [container-test]

List content

[root@singlenode ~]# redc get TESTNS/container-test
#Listing container=[container-test]
test.txt
#Total in [container-test] : 1 elements

In a container with versioning, use –O ShowInfo=on in order to display versions (and size)

[root@singlenode ~]# redc get -O ShowInfo=on TESTNS/container-test
#Listing container=[container-test]
9095 1 test.txt
9095 2 test.txt
#Total in [container-test] : 2 elements

First column is the content size. Second column is the version number.

Get content

[root@singlenode ~]# redc get $namespace/container-test/test.txt /tmp/test.txt

By default, “redc get” will output content to stdout. Specify a filename (/tmp/test.txt) to store content in a file<br>

In order to retrieve a specific version of a content in a versioning enabled container, specify the version in the request URL. By default, “redc get” will always retrieve the latest version.

[root@singlenode ~]# redc get TESTNS/container-test/test.txt?version=1 /tmp/test.txt

Please note that if the target file exists, “redc get” will not process the request

Delete content

[root@singlenode ~]# redc delete TESTNS/container-test/test.txt

In a versioning enabled container, “redc delete” will not physically delete content, rather mark them as DELETED for future deletion. Also note that “redc delete” will delete the latest version if not specified in the URL

If the last version of a content is (marked as) deleted, it will not appear in the basic list content command

[root@singlenode~]# redc get TESTNS/container-test
#Listing container=[container-test]
#Total in [container-test] : 0 elements

Nevertheless, in a versioning enabled container, older version might still be available

[root@singlenode ~]# redc get -O ShowInfo=on TESTNS/container-test
#Listing container=[container-test]
9095 1 test.txt
9095 2 test.txt (deleted)
#Total in [container-test] : 2 elements

Information on content

Display the different services involved by this content, including storage policy, chunk location, MD5, properties …

[root@localhost ~]# redc info TESTNS/container-test/install.log

        [ Directory ]

                META0 : tcp://127.0.0.1:6001
                META1 : tcp://127.0.0.1:6004 tcp://127.0.0.1:6003 tcp://127.0.0.1:6002
                META2 : tcp://127.0.0.1:6023 tcp://127.0.0.1:6022 tcp://127.0.0.1:6021

        [ Container ]

                      Name : [container-test]
                        ID : [CAADCA16D9CD4D7EC918421A715718B62123A79C184B87CC1BC929E9ADBFC4EC]
                Admin Info :
                                          sys.namespace : TESTNS
                                         schema_version : 1.8
                                  sys.versioning_policy : 0
                                             sys.m2vers : 2
                                              base_type : meta2
                                     sys.storage_policy : NONE
                                     sys.container_name : container-test
                                              base_name : CAADCA16D9CD4D7EC918421A715718B62123A79C184B87CC1BC929E9ADBFC4EC
                                         container_name : CAADCA16D9CD4D7EC918421A715718B62123A79C184B87CC1BC929E9ADBFC4EC
                                     sys.container_size : 9095


        [ Content ]

                         Name : "install.log"
                      Version : 1
                         Size : 9095 bytes
                       Policy : NONE
                        Flags : ONLINE
                     Chunk nb : 1
                User Metadata : []
                Syst Metadata : [mime-type=octet/stream;chunk-method=chunk-size;creation-date=1368539915;storage-policy=NONE]
                   Properties :


        [ Chunks ]

                [ Chunk.0  ]

                             Url : tcp://127.0.0.1:6015 Id=EB902590CC6AD9F0CC7B15087733A40092F8D1433F5714C333D63F12278D343D Path=/DATA/TESTNS/singlenode18/vol03
                        Position : 0
                            Size : 9095 bytes
                             Md5 : AC9343EE83A899D2C1A162E9E978A708
                           Flags : 0000

Add a content property

[root@localhost ~]# redc propset TESTNS/container-test/install.log key value
Properties has been set to content [install.log]

Get a content property

[root@localhost ~]# redc propget TESTNS/container-test/install.log key
Listing container properties:
   [key=value]
1 properties found matching search criteria

Remove a content property

[root@localhost ~]# redc propdel TESTNS/container-test/install.log key
Properties removed

User Tools