Database administration [Документация VAS Experts]

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
en:dpi:dpi_components:platform:dpi_admin:admin_db:start [2024/05/07 06:07] atereschenkoen:dpi:dpi_components:platform:dpi_admin:admin_db:start [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1
Line 1: Line 1:
-====== Database administration ====== 
-{{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. 
- 
-**List of database tables** 
- 
-^ Table ^ Purpose ^ 
-|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 ==== 
- 
-<note important>UDR activation is required to support dynamic IPs and subscribers with several IPs.</note> 
- 
-UDR is activated by the configuration parameter in **///etc/dpi/fastdpi.conf//** file. 
- 
-<code>udr=1</code> 
- 
-The created database is located in the **///var/db/dpi//** directory 
- 
-<note important>You can make a copy of the database without stopping the DPI with a backup command 
-<code>mdb_copy/var/db/dpi./DB</code> 
-and handle further manipulations in the copied database.</note> 
- 
-==== Enlarging the DB ==== 
- 
-By default, the database size is limited to 1GB. If you have more than 1 million policing profiles, you will need to increase the default size: 
-<code>udr_size=2147483648</code> 
-will set the DB size of 2GB. 
- 
-<note>The built-in database does not require administration and is fault tolerant. However, in rare cases, damage to the embedded database occurred. In this case, one of the following options is possible.</note> 
- 
-==== Database recovery with data transfer ==== 
- 
-Stop the fastDPI 
-<code>service fastdpi stop</code> 
- 
-Run the script 
-<code> 
-rm -rf /var/db/dpi.recover/* 
-mkdir -p /var/db/dpi.recover/tmp 
-for table in $(mdb_dump -l /var/db/dpi); do 
-mdb_dump -f /var/db/dpi.recover/tmp/dump.$table.load -s $table /var/db/dpi 
-mdb_load -f /var/db/dpi.recover/tmp/dump.$table.load /var/db/dpi.recover 
-done 
-rm /var/db/dpi/lock.mdb 
-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> 
- 
-Start the fastDPI 
-<code>service fastdpi start</code> 
- 
-==== 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 ===== 
-==== Restoring a database to the fdpi_ctrl command format ==== 
- 
-Stop the fastDPI 
-<code>service fastdpi stop</code> 
- 
-Run the script 
-<code>mdb_dump -p -a -f dump.sh /var/db/dpi 
-/bin/rm /var/db/dpi/*</code> 
- 
-Start the fastDPI 
-<code>service fastdpi start</code> 
- 
-Run the script 
-<code>chmod +x dump.sh 
-./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 
-done 
-/bin/rm /var/db/dpi/*</code> 
- 
-Start the fastDPI 
-<code>service fastdpi start</code> 
- 
-Choose and run the scripts you need, **for example** 
-<code>chmod +x dump.bindings.sh 
-./dump.bindings.sh</code>