From 29865ce51f2abac4aad7ccfe81b94967a93d251e Mon Sep 17 00:00:00 2001 From: gengchc2 Date: Fri, 2 Nov 2018 20:20:55 -0700 Subject: [PATCH] Modify freezer-api v1 and v2 and scheduler configuration Change-Id: I8a579bdc4f95eb28366b8ec2ed244a49f7d5195b --- doc/source/install/common_configure.rst | 134 +++++++++++++++++++++++- doc/source/install/install_agent.rst | 28 +++++ 2 files changed, 157 insertions(+), 5 deletions(-) diff --git a/doc/source/install/common_configure.rst b/doc/source/install/common_configure.rst index b2fb4326..0f3d441d 100644 --- a/doc/source/install/common_configure.rst +++ b/doc/source/install/common_configure.rst @@ -8,21 +8,51 @@ 3. Edit the ``/etc/freezer/freezer-api.conf`` file and complete the following actions: + There are two kinds of api interface, v1 and v2. + + There are two kinds of database drivers, elasticsearch and Sqlalchemy. + + There are four kinds of combinations between api interface and database + drivers: + + ============== =========== =============== + configuration freezer api database driver + ============== =========== =============== + configuration1 v1 elasticsearch + configuration2 v2 elasticsearch + configuration3 v1 sqlalchemy + configuration4 v2 sqlalchemy + ============== =========== =============== + + ``notes:`` + + Default configuration is freezer api v2 and elasticsearch. + + ``Configuration1``: api v1 interface and elasticsearch: + + * In the ``[DEFAULT]`` section, configure api interface type: + + .. code-block:: ini + + [DEFAULT] + ... + enable_v1_api = True + * In the ``[storage]`` section, configure database access: .. code-block:: ini [storage] ... - backend = elasticv2 - driver = freezer_api.storage.elasticv2.ElasticSearchEngineV2 + backend = elasticsearch + driver = elasticsearch - * In the ``[elasticv2]`` section, configure elasticsearch access: - You might need to create the elasticv2 section first. + * In the ``[elasticsearch]`` section, configure elasticsearch access: + You might need to create the elasticsearch section first. .. code-block:: ini - [elasticv2] + [elasticsearch] ... hosts=http://localhost:9200 index=freezer @@ -33,6 +63,99 @@ retries=20 number_of_replicas = 1 + ``Configuration2``: api v2 interface and elasticsearch: + + * In the ``[DEFAULT]`` section, configure api interface type: + + .. code-block:: ini + + [DEFAULT] + ... + #enable_v1_api = True + + * In the ``[storage]`` section, configure database access: + + .. code-block:: ini + + [storage] + ... + backend = elasticsearch + driver = elasticsearch + + * In the ``[elasticsearch]`` section, configure elasticsearch access: + You might need to create the elasticsearch section first. + + .. code-block:: ini + + [elasticsearch] + ... + hosts=http://localhost:9200 + index=freezer + use_ssl=False + ca_certs='' + use_ssl=False + timeout=60 + retries=20 + number_of_replicas = 1 + + ``Configuration3``: api v1 interface and sqlalchemy: + + * In the ``[DEFAULT]`` section, configure api interface type: + + .. code-block:: ini + + [DEFAULT] + ... + enable_v1_api = True + + * In the ``[storage]`` section, configure database access: + + .. code-block:: ini + + [storage] + ... + backend = sqlalchemy + driver = sqlalchemy + + * In the ``[database]`` section, configure sqlalchemy access: + + You might need to create the database section first. + + .. code-block:: ini + + [database] + ... + connection = mysql+pymysql://root:stack@127.0.0.1/freezer?charset=utf8 + + ``Configuration4``: api v2 interface and sqlalchemy: + + * In the ``[DEFAULT]`` section, configure api interface type: + + .. code-block:: ini + + [DEFAULT] + ... + #enable_v1_api = True + + * In the ``[storage]`` section, configure database access: + + .. code-block:: ini + + [storage] + ... + backend = sqlalchemy + driver = sqlalchemy + + * In the ``[database]`` section, configure sqlalchemy access: + You might need to create the database section first. + + .. code-block:: ini + + [database] + ... + connection = mysql+pymysql://root:stack@127.0.0.1/freezer?charset=utf8 + + Start elasticsearch ------------------- @@ -181,3 +304,4 @@ Install and configure freezer-scheduler/agent --------------------------------------------- .. include:: install_agent.rst + diff --git a/doc/source/install/install_agent.rst b/doc/source/install/install_agent.rst index 7ee21ba3..e9728b35 100644 --- a/doc/source/install/install_agent.rst +++ b/doc/source/install/install_agent.rst @@ -27,6 +27,16 @@ Configure the scheduler 2. Edit the ``/etc/freezer/scheduler.conf`` file and complete the following actions: + There are two kinds of api interface, v1 and v2. + + There are two kinds of configurations: + + ``notes:`` + + Default configuration is freezer api v2. + + ``Configuration1``: freezer-api is started by v1 interface: + * In the ``[DEFAULT]`` section, configure database access: The ``client_id`` has to be set to the hostname of the machine. It will be @@ -38,6 +48,23 @@ Configure the scheduler ... client_id = hostname_of_machine jobs_dir = /etc/freezer/scheduler/conf.d + enable_v1_api = True + + ``Configuration2``: freezer-api is started by v2 interface: + + * In the ``[DEFAULT]`` section, configure database access: + + The ``client_id`` has to be set to the hostname of the machine. It will be + used as an identifier for this node to fetch its scheduled backups + + .. code-block:: ini + + [DEFAULT] + ... + client_id = hostname_of_machine + jobs_dir = /etc/freezer/scheduler/conf.d + #enable_v1_api = False + 3. Start ``freezer-scheduler`` @@ -45,3 +72,4 @@ Configure the scheduler $ . admin-openrc $ sudo freezer-scheduler --config-file /etc/freezer/scheduler.conf start +