ESC in Maintenance Mode
This chapter contains the following chapters:
• ESC in Maintenance Mode, page 1
• Backing Up ESC Database, page 2
• Restoring ESC Database, page 3
ESC in Maintenance ModeESC must be put to maintenance mode to backup and restore ESC database. This can be done in two ways:
1 Using the REST API
2 Using the esc adm tool
Before You Begin
During maintenance mode,
• Northbound requests are blocked by ESC and ESC responds with maintenance mode notification.
• Only REST requests receive response that ESC is unavailable temporarily. ConfD requests get themaintenance mode rejection message, or an OKmessage for all idempotent request such as create tenantrequest when the tenant already exists.
• Monitoring actions are paused.
• All ongoing requests and transactions continue to progress.
Procedure
Step 1 Put ESC to maintenance mode by sending REST API POST request:curl -X POST http://{ESC_HOST}:8080/ESCManager/v0/operationmode/{operation_mode}
where, operation_mode is MAINTENANCE or OPERATION
Example:
Cisco Elastic Services Controller 2.2 User Guide 1
curl -X POST http://127.0.0.1:8080/ESCManager/v0/operationmode/MAINTENANCE
Step 2 Run the following query to see if ESC is in operation mode:curl http://{ESC_HOST}:8080/ESCManager/v0/operationmode/
Example:curl http://127.0.0.1:8080/ESCManager/v0/operationmode/{
"mode": "OPERATION"}or{
"mode": "MAINTENANCE"}
Using the esc adm ToolESC can be put to maintenance mode using the esc adm tool.
Procedure
Step 1 Put ESC to maintenance mode from the VM shell:sudo escadm op_mode set --mode=maintenanceSet mode to MAINTENANCEOperation Mode = MAINTENANCE
Step 2 To query operation mode at any time,sudo escadm op_mode show
Example:Operation Mode = OPERATION
Backing Up ESC DatabaseTo backup the ESC database from a standalone ESC or a HA (master node):
Procedure
Step 1 Run the following command in ESC:# /opt/cisco/esc/esc-scripts/esc_dbtool.py backup --filescp://<username>:<password>@<backup_vm_ip>:<filename>
or
# /opt/cisco/esc/esc-scripts/esc_dbtool.py backup --filescp://<username>@<backup_vm_ip>:<filename>
Use remote IP or local IP for database backup.
Cisco Elastic Services Controller 2.2 User Guide2
ESC in Maintenance ModeUsing the esc adm Tool
Example:# /opt/cisco/esc/esc-scripts/esc_dbtool.py backup --filescp://admin:[email protected]:/home/admin/db_backup.tar
Step 2 Enter the ESC password in the URL, or manually enter it after executing the above command.
To put ESC back to operation mode, run:sudo escadm op_mode set --mode=operation
Restoring ESC DatabaseBefore You Begin
To restore the database,
• Stop ESC services in standalone ESC. Run # service esc_service stop.
• For ESC HA, stop the KeepAliveD. Run # service keepalived stop.
• All the services must be stopped. To check the status, run # service esc_service status.
• To promote the database, run # drbdadm primary esc# mount /dev/drbd1
/opt/cisco/esc/esc_database/
• To clean up the backed up files, run # rm -rf /opt/cisco/esc/esc_database/confd-cdb/
/opt/cisco/esc/esc_database/postgresql/
• To start the postgresql database, run # service postgresql-9.4 start.
Procedure
Step 1 To restore the database, run the following command:# /opt/cisco/esc/esc-scripts/esc_dbtool.py restore --filescp://<username>:<password>@<backup_vm_ip>:<filename>
or
# /opt/cisco/esc/esc-scripts/esc_dbtool.py restore --filescp://<username>@<backup_vm_ip>:<filename>
Step 2 Enter the ESC password in the URL, or manually enter it after executing the above command.Step 3 Restart the ESC service to complete the database restore by running the following command:
For standalone ESC
# service esc_service start
For ESC HA
# service keepalived start
Cisco Elastic Services Controller 2.2 User Guide 3
ESC in Maintenance ModeRestoring ESC Database
ESC maintenance mode blocks the northbound request and VNF monitoring. However, if there aresome ongoing transactions because of northbound requests before ESC entering maintenance mode,those transactions may have following restriction with backup and restore:
Note
• ESC reports an error for the deployment, network creation, and subnet creation requests, ifthese transactions are interrupted by backup and restore. Northbound handles these errormessages but it may cause network or subnet leakage in some cases (For example, ESC isinterrupted before getting the UUID from OpenStack).
• ESC reports an error for service chain upgrade, and requires service chain undeployment anddeployment (rather than downgrade and upgrade) to re-create the service.
Cisco Elastic Services Controller 2.2 User Guide4
ESC in Maintenance ModeRestoring ESC Database