Jump to: navigation, search

Difference between revisions of "Freezer-docs"

(Created page with "== How To Use Freezer == Keystone v2.0 and v3 authentication is supported for freezer. v2.0: export OS_BACKUP_URL=http://192.168.33.10:9090 export OS_AUTH_URL=http://19...")
 
Line 1: Line 1:
== How To Use Freezer ==
+
= Freezer Scheduler =
  
Keystone v2.0 and v3 authentication is supported for freezer.
+
=== Client Registration ===
 +
 
 +
Make the agent/scheduler available to the api/cli/ui:
 +
 
 +
    freezer-scheduler register
 +
 
 +
Verify the client is registered correctly:
 +
 
 +
* for kilo, liberty and mitaka:
 +
    freezer-scheduler client-list
 +
* for newton onwards:
 +
    freezer client-list
 +
 
 +
=== Scheduler Start/Stop ===
 +
 
 +
==== Start the scheduler ====
 +
 
 +
In order to poll the api to get new jobs, actions, etc. we need to start the scheduler
 +
 
 +
make sure to use the credentials for keystone v2.0 or v3 and you are root or Administrator on Windows
 +
 
 +
Keystone v2.0 and v3 authentication is supported for freezer
  
 
v2.0:
 
v2.0:
  
  export OS_BACKUP_URL=http://192.168.33.10:9090
+
    export OS_BACKUP_URL=http://192.168.33.10:9090
  export OS_AUTH_URL=http://192.168.33.10:5000/v2.0
+
    export OS_AUTH_URL=http://192.168.33.10:5000/v2.0
  export OS_USERNAME=admin
+
    export OS_USERNAME=admin
  export OS_PASSWORD=quiet
+
    export OS_PASSWORD=quiet
  export OS_TENANT_NAME=admin
+
    export OS_TENANT_NAME=admin
  export OS_REGION_NAME=RegionOne
+
    export OS_REGION_NAME=RegionOne
  export OS_IDENTITY_API_VERSION=2
+
    export OS_IDENTITY_API_VERSION=2
  
 
v3:
 
v3:
  
  export OS_BACKUP_URL=http://192.168.33.10:9090
+
    export OS_BACKUP_URL=http://192.168.33.10:9090
  export OS_AUTH_URL=http://192.168.33.10:5000/v3
+
    export OS_AUTH_URL=http://192.168.33.10:5000/v3
  export OS_USERNAME=admin
+
    export OS_USERNAME=admin
  export OS_PASSWORD=quiet
+
    export OS_PASSWORD=quiet
  export OS_PROJECT_DOMAIN_NAME=admin
+
    export OS_PROJECT_DOMAIN_NAME=admin
  export OS_USER_DOMAIN_NAME=admin
+
    export OS_USER_DOMAIN_NAME=admin
  export OS_PROJECT_NAME=admin
+
    export OS_PROJECT_NAME=admin
  export OS_REGION_NAME=RegionOne
+
    export OS_REGION_NAME=RegionOne
  export OS_IDENTITY_API_VERSION=3
+
    export OS_IDENTITY_API_VERSION=3
 +
 
 +
    freezer-scheduler start
 +
 
 +
Verify the scheduler is running:
 +
 
 +
    freezer-scheduler status
 +
 
 +
==== Stop the scheduler ====
 +
 
 +
    freezer-scheduler stop
  
on windows, replace "export" by "set"
+
It can be also be started as a foreground process using the –no-daemon flag:
  
== Scheduler ==
+
  freezer-scheduler --no-daemon start
=== Client Registration ===
+
 
 +
This can be useful for testing purposes, when launched in a Docker container, or by a babysitting process such as systemd.
  
Make the agent/scheduler available to the api/cli/ui
+
== Using the Scheduler ==
  
  freezer-scheduler register
+
The cli-tool version is used to manage the jobs in the API. A “job” is basically a container; a document which contains one or more “actions”. An action contains the instructions for the freezer-agent. They are the same parameters that would be passed to the agent on the command line. For example: “backup_name”, “path_to_backup”, “max_level”
  
Verify the client is registered correcly
+
To sum it up, a job is a sequence of parameters that the scheduler pulls from the API and passes to a newly spawned freezer-agent process at the right time.
  
for kilo, liberty and mitaka
+
The scheduler understands the “scheduling” part of the job document, which it uses to actually schedule the job, while the rest of the parameters are substantially opaque.
  
  freezer-scheduler client-list
+
It may also be useful to use the “-c” parameter to specify the client-id that the scheduler will use when interacting with the API.
 
for newton onwards
 
  
  freezer client-list
+
The purpose of the client-id is to associate a job with the scheduler instance which is supposed to execute that job.
  
Here is an example:
+
A single openstack user could manage different resources on different nodes (and actually may even have different freezer-scheduler instances running on the same node with different local privileges, for example), and the client-id allows him to associate the specific scheduler instance with its specific jobs.
  
{| class="wikitable"
+
When not provided with a custom client-id, the scheduler falls back to the default which is composed from the tenant-id and the hostname of the machine on which it is running.
|-
 
! client_id !! hostname !! description
 
|-
 
| padawan-ccp-comp0001-mgmt || padawan-ccp-comp0001-mgmt || padawan-ccp-comp0001-mgmt
 
|-
 
| padawan-ccp-c0-m1-mgmt  || padawan-ccp-c0-m1-mgmt  || padawan-ccp-c0-m1-mgmt
 
|-
 
| padawan-ccp-comp0002-mgmt || padawan-ccp-comp0002-mgmt || padawan-ccp-comp0002-mgmt
 
|}
 
  
 +
=== Create a job ===
  
=== Start the Scheduler ===
+
The first step to use the scheduler is creating a document with the job:
  
In order to poll the api to get new jobs, actions, etc. we need to start the scheduler
+
    {
 +
        "job_actions": [{
 +
            "freezer_action": {
 +
                  "action": "backup",
 +
                      "mode": "fs",
 +
                      "backup_name": "backup1",
 +
                        "path_to_backup": "/home/me/datadir",
 +
                        "container": "schedule_backups",
 +
                        "log_file": "/home/me/.freezer/freezer.log"
 +
                },
 +
                "max_retries": 3,
 +
                "max_retries_interval": 60
 +
          }],
 +
          "job_schedule": {
 +
              "schedule_interval": "4 hours",
 +
              "schedule_start_date": "2015-08-16T17:58:00"
 +
        },
 +
        "description": "schedule_backups 6"
 +
    }
  
make sure to use the credentials for keystone v2.0 or v3 and you are root or Administrator on Windows
 
  
  freezer-scheduler start
+
Then upload that job into the API
 +
* for kilo, liberty and mitaka:
 +
  freezer-scheduler -c node12 job-create --file test_job.json
 +
* for newton onwards:
 +
  freezer job-create --file test_job.json  -C node12
  
Verify the scheduler is running
 
  
   freezer-scheduler status
+
=== List jobs ===
 +
* for kilo, liberty and mitaka:
 +
  freezer-scheduler -c node12 job-list
 +
* for newton onwards:
 +
   freezer job-list -C node12
  
Stop the scheduler
+
=== Get the content of a job ===
  
   freezer-scheduler stop
+
* for kilo, liberty and mitaka:
 +
  freezer-scheduler -c node12 job-get -j 07999ea33a494ccf84590191d6fe850c
 +
* for newton onwards:
 +
   freezer job-get 07999ea33a494ccf84590191d6fe850c -C node12

Revision as of 10:42, 27 June 2016

Freezer Scheduler

Client Registration

Make the agent/scheduler available to the api/cli/ui:

   freezer-scheduler register

Verify the client is registered correctly:

  • for kilo, liberty and mitaka:
   freezer-scheduler client-list
  • for newton onwards:
   freezer client-list

Scheduler Start/Stop

Start the scheduler

In order to poll the api to get new jobs, actions, etc. we need to start the scheduler

make sure to use the credentials for keystone v2.0 or v3 and you are root or Administrator on Windows

Keystone v2.0 and v3 authentication is supported for freezer

v2.0:

   export OS_BACKUP_URL=http://192.168.33.10:9090
   export OS_AUTH_URL=http://192.168.33.10:5000/v2.0
   export OS_USERNAME=admin
   export OS_PASSWORD=quiet
   export OS_TENANT_NAME=admin
   export OS_REGION_NAME=RegionOne
   export OS_IDENTITY_API_VERSION=2

v3:

   export OS_BACKUP_URL=http://192.168.33.10:9090
   export OS_AUTH_URL=http://192.168.33.10:5000/v3
   export OS_USERNAME=admin
   export OS_PASSWORD=quiet
   export OS_PROJECT_DOMAIN_NAME=admin
   export OS_USER_DOMAIN_NAME=admin
   export OS_PROJECT_NAME=admin
   export OS_REGION_NAME=RegionOne
   export OS_IDENTITY_API_VERSION=3
   freezer-scheduler start

Verify the scheduler is running:

   freezer-scheduler status

Stop the scheduler

   freezer-scheduler stop

It can be also be started as a foreground process using the –no-daemon flag:

  freezer-scheduler --no-daemon start

This can be useful for testing purposes, when launched in a Docker container, or by a babysitting process such as systemd.

Using the Scheduler

The cli-tool version is used to manage the jobs in the API. A “job” is basically a container; a document which contains one or more “actions”. An action contains the instructions for the freezer-agent. They are the same parameters that would be passed to the agent on the command line. For example: “backup_name”, “path_to_backup”, “max_level”

To sum it up, a job is a sequence of parameters that the scheduler pulls from the API and passes to a newly spawned freezer-agent process at the right time.

The scheduler understands the “scheduling” part of the job document, which it uses to actually schedule the job, while the rest of the parameters are substantially opaque.

It may also be useful to use the “-c” parameter to specify the client-id that the scheduler will use when interacting with the API.

The purpose of the client-id is to associate a job with the scheduler instance which is supposed to execute that job.

A single openstack user could manage different resources on different nodes (and actually may even have different freezer-scheduler instances running on the same node with different local privileges, for example), and the client-id allows him to associate the specific scheduler instance with its specific jobs.

When not provided with a custom client-id, the scheduler falls back to the default which is composed from the tenant-id and the hostname of the machine on which it is running.

Create a job

The first step to use the scheduler is creating a document with the job:

   {
       "job_actions": [{
            "freezer_action": {
                 "action": "backup",
                      "mode": "fs",
                      "backup_name": "backup1",
                       "path_to_backup": "/home/me/datadir",
                       "container": "schedule_backups",
                       "log_file": "/home/me/.freezer/freezer.log"
                },
               "max_retries": 3,
               "max_retries_interval": 60
         }],
         "job_schedule": {
              "schedule_interval": "4 hours",
              "schedule_start_date": "2015-08-16T17:58:00"
        },
        "description": "schedule_backups 6"
   }


Then upload that job into the API

  • for kilo, liberty and mitaka:
  freezer-scheduler -c node12 job-create --file test_job.json
  • for newton onwards:
  freezer job-create --file test_job.json  -C node12


List jobs

  • for kilo, liberty and mitaka:
  freezer-scheduler -c node12 job-list
  • for newton onwards:
 freezer job-list -C node12

Get the content of a job

  • for kilo, liberty and mitaka:
  freezer-scheduler -c node12 job-get -j 07999ea33a494ccf84590191d6fe850c
  • for newton onwards:
 freezer job-get 07999ea33a494ccf84590191d6fe850c -C node12