|
介绍
phpIPAM为目前比较好用的开源IP地址管理平台,在使用过程中需要注意数据的备份,防止服务器异常导致的数据丢失,根据官方文档建议进行数据备份与恢复
参考文档
安装文档参考:容器化部署phpIPAM - 何丹的文章 - 知乎 https://zhuanlan.zhihu.com/p/573011083
官网文档:https://phpipam.net/documents/upgrade/
数据备份
方法一:通过页面进行备份
管理--导入导出--准备mysql转储
会导出一个phpipam_MySQL_dump_2022-12-05.sql文件,后续可通过mysqldump进行数据恢复

方法二:通过mysqldump命令进行数据库备份
备份命令(shell):
mysqldump -u root -p phpipam > ./phpipam_backup.sql
进入数据库过程
root@2fa838f96aac:/var/lib/mysql# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2004
Server version: 10.10.2-MariaDB-1:10.10.2+maria~ubu2204 mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| phpipam |
| sys |
+--------------------+
5 rows in set (0.000 sec)
MariaDB [(none)]> use phpipam;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [phpipam]> show tables;
+------------------------+
| Tables_in_phpipam |
+------------------------+
| api |
| changelog |
| circuitProviders |
| circuitTypes |
| circuits |
| circuitsLogical |
| circuitsLogicalMapping |
| customers |
| deviceTypes |
| devices |
| firewallZoneMapping |
| firewallZoneSubnet |
| firewallZones |
| instructions |
| ipTags |
| ipaddresses |
| lang |
| locations |
| loginAttempts |
| logs |
| nameservers |
| nat |
| nominatim |
| nominatim_cache |
| php_sessions |
| pstnNumbers |
| pstnPrefixes |
| rackContents |
| racks |
| requests |
| routing_bgp |
| routing_subnets |
| scanAgents |
| sections |
| settings |
| settingsMail |
| subnets |
| userGroups |
| users |
| usersAuthMethod |
| vaultItems |
| vaults |
| vlanDomains |
| vlans |
| vrf |
| widgets |
+------------------------+
46 rows in set (0.000 sec)
数据恢复
mysql -u root -p phpipam < phpipam_MySQL_dump_2022-12-05.sql
mysql -u root -p phpipam < phpipam_backup.sql
以上备份恢复测试正常,生产环境中可通过crontab计划任务进行日常备份,供参考
另外非容器化部署的话,config.php也建议进行备份 |
|