Database Administration: UDR and SDR [Документация VAS Experts]

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:dpi:dpi_components:platform:dpi_admin:admin_db [2024/09/26 15:29] – создано - внешнее изменение 127.0.0.1en:dpi:dpi_components:platform:dpi_admin:admin_db [2025/07/17 07:25] (current) elena.krasnobryzh
Line 1: Line 1:
-====== Database administration ======+====== Database Administration: UDR and SDR ======
 {{indexmenu_n>2}} {{indexmenu_n>2}}
  
-UDR (built-in database, user data repository) is used for permanent storage of data on services and policing settings for the subscribers.+Up to version 14, only one built-in database is used: **UDR (User Data Repository)**, intended for persistent storage of data about servicespolicing, and other FastDPI settings.\\
  
-**List of database tables**+Starting from version 14, UDR is split into UDR and SDR. The split occurs automatically during the version upgrade.\\ 
 +**SDR (System Data Repository)** is intended for storing FastDPI settings not related to subscribers. 
 +It can be considered a continuation of fastdpi.conf. No special SDR activation is required – the necessary .mdb files are created automatically when the corresponding mode is enabled in fastdpi.conf.
  
-^ Table ^ Purpose ^ +<note warning>Global rules for vlan drop/pass/hide/permit, previously set using the CLI command vlan group, will be converted and moved from UDR to SDR and deleted from UDR. When downgrading from version 14 to 13, data from SDR will be lost, so manual transfer is required by saving a copy of SDR before the update.</note>
-|bindings| login and address binding| +
-|bindings_multi| login and address binding for multu-subscribers (with several IPs)| +
-|policing| Subscriber policing setting| +
-|profile_names| Names of profiles| +
-|profiles| Profiles of services and policing| +
-|services| Subscriber services setting| +
-|vchannel_policing| Channel policing setting| +
-|ip_props| BRAS subscriber properties|+
  
-==== Activating the built-in database ====+**List of Tables in UDR** 
 +^ Table             ^ Purpose                                                       ^ 
 +| bindings          | Link between login and address                               | 
 +| bindings_multi    | Link between login and address for multi-subscriber (multiple IPs) | 
 +| ip_props          | BRAS subscriber properties                                   | 
 +| policing          | Policing settings for subscribers                           | 
 +| profile_names     | Profile names                                                | 
 +| profiles          | Service and policing profiles                                | 
 +| services          | Subscriber service settings                                  | 
 +| vchannel_policing | Policing settings for channels                               |
  
-<note important>UDR activation is required to support dynamic IPs and subscribers with several IPs.</note>+**SDR Structure**\\ 
 +In the SDR directory /var/db/dpisdr, depending on the enabled modes, the database files are located: 
 +  * fdpi.mdb: general data 
 +  * bras.mdb: data related to BRAS mode 
 +  * router.mdb: data related to router mode 
 +Contents of these DBs for version 14:
  
-UDR is activated by the configuration parameter in **///etc/dpi/fastdpi.conf//** file.+fdpi.mdb: 
 +  acl_vlan_rule - stores VLAN rules (rules are set using CLI commands in vlan rule group) 
 +  acl_qinq_rule - stores QinQ rules (rules are set using CLI commands in vlan rule group)
  
-<code>udr=1</code>+bras.mdb: 
 +  * l2tp_server_props - L2TP servers served by BRAS and their properties (rules set using CLI commands in l2tp server group)
  
-The created database is located in the **///var/db/dpi//** directory+router.mdb: 
 +  neighbor4 - IPv4 neighborDB, [[dpi:dpi_components:router#arp_менеджмент|see "ARP Management" section for details]] 
 +  neighbor6 - IPv6 neighborDB, [[dpi:dpi_components:router#arp_менеджмент|see "ARP Management" section for details]]
  
-<note important>You can make a copy of the database without stopping the DPI with a backup command +<note tip>The maximum size of each .mdb file is set by the udr_size parameter.</note>
-<code>mdb_copy/var/db/dpi./DB</code> +
-and handle further manipulations in the copied database.</note>+
  
-==== Enlarging the DB ====+Backup: save copies of .mdb files from the SDR directory (preferably when fastDPI is stopped)   
 +Restore: copy .mdb files to the SDR directory
  
-By default, the database size is limited to 1GBIf you have more than 1 million policing profiles, you will need to increase the default size: +==== Activation of Built-in UDR ==== 
-<code>udr_size=2147483648</code> +<note important>UDR activation is mandatory when using dynamic IP addresses and to support subscribers with multiple IPsNo special activation of SDR is required – the necessary .mdb files are created automatically when the corresponding mode is enabled in fastdpi.conf.</note> 
-will set the DB size of 2GB.+UDR is activated using the configuration parameter in the file **///etc/dpi/fastdpi.conf//** 
 +<code> 
 +udr=
 +</code> 
 +The created database is located in the directory **///var/db/dpi //**
  
-<note>The built-in database does not require administration and is fault tolerant. However, in rare cases, damage to the embedded database occurredIn this case, one of the following options is possible.</note>+<note important>You can create a DB copy without stopping DPI using the backup command 
 +<code>mdb_copy /var/db/dpi ./DB</code> 
 +and then perform further manipulations on the DB copy. 
 +</note>
  
-==== Database recovery with data transfer ====+==== Increasing the Size of UDR and SDR DB ==== 
 +By default, the size of the UDR and SDR DB is limited to 1GB. 
 +If your number of policing profiles exceeds 1 million, 
 +you need to increase the default size: 
 +<code>udr_size=2147483648</code> 
 +sets the DB size to 2GB
  
-Stop the fastDPI +<note>The built-in DB does not require administration and is fault-tolerant. 
-<code>service fastdpi stop</code>+However, in rare cases the built-in DB has been corrupted. 
 +In this case, the following actions are possible:</note>
  
-Run the script +==== DB Recovery with Data Migration ==== 
-<code>+Stop fastDPI <code> service fastdpi stop</code> Run the script <code>
 rm -rf /var/db/dpi.recover/* rm -rf /var/db/dpi.recover/*
 mkdir -p /var/db/dpi.recover/tmp mkdir -p /var/db/dpi.recover/tmp
Line 53: Line 78:
 rm /var/db/dpi/lock.mdb rm /var/db/dpi/lock.mdb
 mv /var/db/dpi/data.mdb /var/db/dpi.recover/data.mdb.backup mv /var/db/dpi/data.mdb /var/db/dpi.recover/data.mdb.backup
-cp -f /var/db/dpi.recover/data.mdb /var/db/dpi/</code>+cp -f /var/db/dpi.recover/data.mdb /var/db/dpi/</code> Start fastDPI <code> service fastdpi start </code>
  
-Start the fastDPI +==== Deleting the DB and Reloading Data from External Source (e.g., billing system) ==== 
-<code>service fastdpi start</code> +\\ Stop fastDPI<code> service fastdpi stop </code> Delete DB <code> /bin/rm /var/db/dpi/* </code> Start fastDPI <code> service fastdpi start </code> Reload all settings into the DB using your own scripts
- +
-==== Deleting a database and reloading data back from an external source (billing, etc.) ==== +
- +
-Stop the fastDPI +
-<code>service fastdpi stop</code> +
- +
-Delete the DB +
-<code>/bin/rm /var/db/dpi/*</code> +
- +
-Start the fastDPI +
-<code>service fastdpi start</code> +
- +
-Reload all the settings into the database using own scripts.+
  
 ===== Experimental Section ===== ===== Experimental Section =====
-==== Restoring a database to the fdpi_ctrl command format ==== 
  
-Stop the fastDPI +==== DB Recovery in fdpi_ctrl Command Format ====
-<code>service fastdpi stop</code>+
  
-Run the script +Stop fastDPI <code> service fastdpi stop </code> Run the script <code> 
-<code>mdb_dump -p -a -f dump.sh /var/db/dpi +mdb_dump -p -a -f dump.sh /var/db/dpi 
-/bin/rm /var/db/dpi/*</code>+/bin/rm /var/db/dpi/*</code> Start fastDPI <code> service fastdpi start </code> Run the script <code> 
 +chmod +x dump.sh 
 +./dump.sh 
 +</code>
  
-Start the fastDPI +==== Recovery of Individual DB Tables in fdpi_ctrl Command Format ====
-<code>service fastdpi start</code>+
  
-Run the script +Stop fastDPI <code> service fastdpi stop </code> Run the script <code> 
-<code>chmod +x dump.sh +for table in $(mdb_dump -l /var/db/dpi); do
-./dump.sh</code> +
- +
-==== Restoring certain tables to the fdpi_ctrl command format ==== +
- +
-Stop the fastDPI +
-<code>service fastdpi stop</code> +
- +
-Run the script +
-<code>for table in $(mdb_dump -l /var/db/dpi); do+
 mdb_dump -p -f dump.$table.sh -s $table /var/db/dpi mdb_dump -p -f dump.$table.sh -s $table /var/db/dpi
 done done
-/bin/rm /var/db/dpi/*</code> +/bin/rm /var/db/dpi/*</code> Start fastDPI <code> 
- +service fastdpi start </code> Select the required scripts and run them, **example** <code> 
-Start the fastDPI +chmod +x dump.bindings.sh 
-<code>service fastdpi start</code>+./dump.bindings.sh 
 +</code>
  
-Choose and run the scripts you need, **for example** 
-<code>chmod +x dump.bindings.sh 
-./dump.bindings.sh</code>