- 28 Jun 2024
- 5 Minutes to read
- Print
- DarkLight
Backup and Restore for All-In-One Architecture
- Updated on 28 Jun 2024
- 5 Minutes to read
- Print
- DarkLight
This article describes how to backup and restore Tegsoft to prevent data loss.
Information about backup options for Tegsoft products, how to check local backup files, the technical steps to be taken for creating backups and restoring from them for a certain Tegsoft system are covered in this article.
By carrying out these operations, your Tegsoft product will become more immune to loss of valuable data.
Prerequisites
To perform the procedures in this article smoothly, Tegsoft recommends that you have basic knowledge of these topics:
- Networking
- SSH connection
- Linux Command Line Interface
1. Create Backups
Database backup is the process of backing up the stored data of Tegsoft. It enables the creation of adatabase copy.
A backup file contains the following data:
- History data (CDR, agent activity history, and all call related data)
- Configuration settings
- Contacts data
- IVR configurations
- Requirements and complaint history
1.1. Backup Types
Tegsoft supports two backup modes: daily automatic backup and manual backup. The backup data is retained for four days by default.
➤ Automatic Backup
Automatic backup is a type of a data backup model that requires no human intervention.
Configuration
Automatic Backup is configured as default in Tegsoft systems. The default backup hour (hh:mm) is 02:30 which can be seen in the PBX Management ➔ Server Settings screen below. (If you have a system that works intensively in this hour, it is recommended to update the default backup hour.)
In addition, Tegsoft provides the option to change the default target of the backup files. The target folder can be specified with the parameter in the screenshot below.
➤ Manuel Backup
Manual backup is a non-automated data backup model in which data created up to that time is considered. This backup model can be used to create backups on an as-needed basis.
Configuration
Please follow the steps below to create a backupmanually.
1. Connect to the server with SSH protocol.
2. After connecting to the server, please run following command below.
./tegsoft_BackupDB.sh
1.2. Check Local Backup Files
Your Tegsoft server hosts all backups (automatic or manual) of the system for up tolast 4 days ago on its own server disk.
These backups can be accessed by the following two methods.
1. Target folder can be accessed via Shared Windows Folder.
2. After connecting to the server with SSH protocol, run the following command to access the directory where the backup is generated.
ls -lrth /home/tobe/backup/
An example output is given below.
The filename format is date-MACaddress.tgz.
2. Restore from Backup
In database technologies, restoring is an operation that returns a database to its previous state. Restoring is important for database integrity because it enables a database to be restored to its proper state even after erroneous operations are performed.
Please follow the steps below for the restoring operation.
1. Connect to server's command-line interface (CLI) with SSH connection.
2. Run the following command to stop the services.
service tegsoft stop
*Use "service tegsoft_web stop" if above command responds with "tegsoft.service not found."
*Make sure "ps aux|grep java" brings no processes. If service daemon can't stop Tegsoft processes, use "killall java" instead.
3. Run the following command to stop the database service.
service tegsoft_db stop
4.Run the following command to restart the database service.
service tegsoft_db restart
5. Run the following command to fix the date and time.
/root/tegsoft_fixdate.sh
6. Run the following command to switch user to database user.
su - tobe
7. Run the following command to extract the backup file by taking into account the warnings.
cd /home/tobe/backup/
mv 20120807* backup.tgz
tar -xzvf backup.tgz
cd /home/tobe/backup/*/
8. Run the following command to drop current database.
db2 drop database tobe
db2 catalog database tobe
db2 uncatalog database tobe
SQL1035N The operation failed because the specified database cannot be
connected to in the mode requested. SQLSTATE=57019
9. Run the following command to create the database.
db2 "CREATE DATABASE tobe automatic storage yes USING CODESET UTF-8 TERRITORY TR pagesize 32 K"
This process will take approximately 5-10 minutes.
10. Run the following command to create and authorize the database files.
rm -rf /home/tobe/tobe/NODE0000/MIRRORLOGPATH
mkdir /home/tobe/tobe/NODE0000/MIRRORLOGPATH
chown tobe.tobe /home/tobe/tobe/NODE0000/MIRRORLOGPATH
11.Run the following command to update the database config file.
db2 update db cfg for tobe using MIRRORLOGPATH /home/tobe/tobe/NODE0000/MIRRORLOGPATH
12. Run the following command to restore the system from backup file.
db2 update db cfg for tobe using logfilsiz 10000 logprimary 30 logsecond 30
nohup db2move tobe IMPORT -u tobe -p t1be &
13.Run the following command to follow the output of the operation.
tail -f nohup.out
When the operation is completed successfully, the nohup file shall be broken by pressing Control+C.
14. Run the following command to connect to the database.
db2 connect to tobe
db2
15. Run the followingcommands to create view structures.
CREATE VIEW tobe.VIEWUNITS AS SELECT UNITUID,PARENT,ORDERID,DESCRIPTION,MODUID,MODDATE, (SELECT L1.UNITUID FROM TBLUNITS L1 WHERE L1.UNITUID = L0.UNITUID AND L1.PARENT IS NULL UNION SELECT L1.UNITUID|| '/'|| L2.UNITUID FROM TBLUNITS L1 INNER JOIN TBLUNITS L2 ON (L1.UNITUID = L2.PARENT) WHERE L2.UNITUID = L0.UNITUID AND L1.PARENT IS NULL UNION SELECT L1.UNITUID|| '/'|| L2.UNITUID|| '/'|| L3.UNITUID FROM TBLUNITS L1 INNER JOIN TBLUNITS L2 ON (L1.UNITUID = L2.PARENT) INNER JOIN TBLUNITS L3 ON (L2.UNITUID = L3.PARENT) WHERE L3.UNITUID = L0.UNITUID AND L1.PARENT IS NULL UNION SELECT L1.UNITUID|| '/'|| L2.UNITUID|| '/'|| L3.UNITUID|| '/'|| L4.UNITUID FROM TBLUNITS L1 INNER JOIN TBLUNITS L2 ON (L1.UNITUID = L2.PARENT) INNER JOIN TBLUNITS L3 ON (L2.UNITUID = L3.PARENT) INNER JOIN TBLUNITS L4 ON (L3.UNITUID = L4.PARENT) WHERE L4.UNITUID = L0.UNITUID AND L1.PARENT IS NULL UNION SELECT L1.UNITUID|| '/'|| L2.UNITUID|| '/'|| L3.UNITUID|| '/'|| L4.UNITUID|| '/'|| L5.UNITUID FROM TBLUNITS L1 INNER JOIN TBLUNITS L2 ON (L1.UNITUID = L2.PARENT) INNER JOIN TBLUNITS L3 ON (L2.UNITUID = L3.PARENT) INNER JOIN TBLUNITS L4 ON (L3.UNITUID = L4.PARENT) INNER JOIN TBLUNITS L5 ON (L4.UNITUID = L5.PARENT) WHERE L5.UNITUID = L0.UNITUID AND L1.PARENT IS NULL UNION SELECT L1.UNITUID|| '/'|| L2.UNITUID|| '/'|| L3.UNITUID|| '/'|| L4.UNITUID|| '/'|| L5.UNITUID|| '/'|| L6.UNITUID FROM TBLUNITS L1 INNER JOIN TBLUNITS L2 ON (L1.UNITUID = L2.PARENT) INNER JOIN TBLUNITS L3 ON (L2.UNITUID = L3.PARENT) INNER JOIN TBLUNITS L4 ON (L3.UNITUID = L4.PARENT) INNER JOIN TBLUNITS L5 ON (L4.UNITUID = L5.PARENT) INNER JOIN TBLUNITS L6 ON (L5.UNITUID = L6.PARENT) WHERE L6.UNITUID = L0.UNITUID AND L1.PARENT IS NULL) AS "LEVEL" FROM TBLUNITS L0
CREATE VIEW tobe.VIEWUSERACCESS AS SELECT UNITUID,"UID",ACCID FROM TBLUSERACCESS UNION ALL SELECT B.UNITUID,B."UID",A.ACCID FROM TBLGROUPACCESS A,TBLUSERGROUPS B WHERE B.GRPID=A.GRPID AND A.UNITUID=B.UNITUID
CREATE VIEW tobe.VIEWUSERS AS SELECT * FROM tobe.TBLUSERS WHERE (EXPIRED IS NULL OR EXPIRED ='false') AND (EXPIREDATE IS NULL OR EXPIREDATE>SYSDATE)
16. Run the followingcommand to commit and exit.
commit
quit
exit
17. Finally, run the following command to restart the services.
service tegsoft restart
Tegsoft makes no representations or warranties, either express or implied, by or with respect to anything in this document, and shall not be liable for any implied warranties of merchantability or fitness for a particular purpose or for any indirect, special or consequential damages.
Copyright © 2021, Tegsoft. All rights reserved.
"Tegsoft" and Tegsoft’s products are trademarks of Tegsoft. References to other companies and their products use trademarks owned by the respective companies and are for reference purpose only.