- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我正在创建一个用于跟踪网络上机器配置的应用程序。 “配置”广泛定义了系统上安装的产品/服务/操作系统/应用程序。其中任何一个的变化都会导致配置发生变化。信息是使用扫描仪获取的。数据已经解析。我需要找出一种有效存储数据的方法。
基本思路是
我坚持定义一组合适的表格来帮助我实现以下目标
我得到的数据是 IP 和条目集及其类型标识符。例如。
IP - x.y.z.w :
Entries - Microsoft Windows XP :1(Type-OS),
Apache HTTP 2.3 :2(Type-Service),
Mozilla Firefox :3(Type - Application)
早些时候,当我不关心配置而只需要存储条目时,我有以下方案
Table ip_map : id int, ip char #Table that keeps track of IPs
Table ip_ref: id int , ip_id references ip_map(id), t_stamp timestamp, archived bool, type smallint #Table that keeps IPs and type
Table current_network: id int, ip_ref_id references ip_ref(id), port int, vendor, product,version #Table that stores actual entries
即- 我使用 IP 和类型信息识别条目。
如果我需要实现配置,方案应该有点像
ip_map:
+--+-------+
|id|ip |
+--+-------+
|1 |x.y.z.w|
+--+-------+
ip_config:
+--+------+----------+--------+----------+
|id|ip_id |t_stamp |archived|config_num|
+--+------+----------+--------+----------+
|1 |1 |1212231313| 1 | 1 |
|2 |1 |1212299999| 0 | 2 |
+--+------+----------+--------+----------+
我卡在这之后的步骤中了。理想情况下,config_num 是指向配置表主键的外键。但是由于配置是由不同的类型组成的,这似乎是不可能的。这就是我的想法。
config:
+--+---+----+
|id|num|type|
+--+---+----+
|1 | 1 | 1 |
|2 | 1 | 2 |
|3 | 2 | 1 |
|4 | 2 | 2 |
+--+---+----+
entry:
+--+---------+----+-------------+-------------+-------------+
|id|config_id|port|vendor | product | version |
+--+---------+----+-------------+-------------+-------------+
|1 | 1 | 0 | Microsoft | Windows | XP |
|2 | 1 | 0 | Microsoft | Windows | 7 Home |
|3 | 2 | 80 | Apache | HTTP Server | 2.3.19 |
|4 | 3 | 0 | Linux | Linux | 2.6 |
|5 | 3 | 0 | Linux | Linux | 2.4 |
|6 | 4 | 22 | OpenSSH | SSHD | 4.3p1 |
+--+---------+----+-------------+-------------+-------------+
但它破坏了一致性(由于 ip_config 和配置表之间缺少外键)。 IP 可能会被删除,但配置将继续存在。如何更改设计以满足我的要求?
注意:理想情况下,类型信息(针对每个 IP 或配置)应该单独维护,因为这是程序的单独部分所期望的。
最佳答案
我不能说我理解这里的一切,所以这个例子可能会给你一些想法。
从ConfigurationType
开始,这可以是1- OS; 2- 服务 ...
Configuration
表包含所有可能的(允许的)配置。 ConfigurationTypeNo
是每个 ConfigurationTypeID
的整数 (1,2,3 ...) - 所以有 OS (1,2,3 ..);服务(1,2,3 ...)等
SystemConfiguration
捕获每个系统的配置设置历史。由于 TimeChanged
是 PK 的一部分,因此可以重复相同的配置。
IP_Allocation
跟踪 IP 分配的历史记录。
关于database - (疑似)多对多关系的模式设计,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9208769/
我们使用 Azure 弹性池,生成多个客户端数据库和一个引用客户端数据库的主数据库。 我们已经拥有多个数据库,并且正在开发新版本的代码。我们使用 EF6 代码优先。当我们对模型进行更改(添加属性)时,
我们使用 Azure 弹性池,生成多个客户端数据库和一个引用客户端数据库的主数据库。 我们已经拥有多个数据库,并且正在开发新版本的代码。我们使用 EF6 代码优先。当我们对模型进行更改(添加属性)时,
我希望将一些信息分发到不同的机器上,以便在没有任何网络开销的情况下实现高效和极快的访问。数据存在于关系模式中,实体之间的关系是“加入”的要求,但根本不是写入数据库的要求(它会离线生成)。 我非常相信
我使用 GrapheneDB 来托管我的 neo4j 数据库 (db)。 问题 我有 N客户并且正在寻找自动分离他们的内容(他们独特的数据库)的方法,以便: 它不重叠数据 操作速度不受影响。 选项 1
当服务器开始工作(Tomcat)时,日志显示此错误: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid b
我在 Oracle 数据库实例中按以下方式创建了一个触发器。 CREATE OR REPLACE TRIGGER after_logon_on_database AFTER LOGON ON DATA
原谅我的无知,我是数据库约定的初学者。 这是我的 SQLite 代码:(由我的数据库浏览器自动生成) CREATE TABLE `ResearchItems` ( `ID` INTEGER NO
是的是的是的,我已经在整个互联网上搜索过这个问题。一些结果发现,甚至来自 Stackoverflow。但是他们中的大多数人说“你应该自动加载数据库”,或者“parent::__construct();
我正在创建一个 Mac 应用程序,它将一些数据保存到 SQLite 数据库中。问题是:当我关闭数据库并再次打开时,数据不存在了。这是我的代码: NSString *sql = [NSString st
我正在建立一个网站,我打算发布各种帖子,比如教程、文章等。我打算用 php 来管理它,但是当涉及到存储每个帖子的内容时,将要显示的文本,更好的选择是:使用单独的文本文件还是将其添加为数据库中的每个条目
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 3 年前。 Improve this qu
对不起,这个关键字对我来说没有任何意义...有人可以给我一个定义吗? 提前致谢... 最佳答案 这是一个品牌。 http://pervasive.com/这是他们的数据库产品的链接 http://ww
我已经在 docker 版本 1.10.1 的 docker 镜像中安装了 PostgreSQL 9.4.6。根据这张官方图片: https://github.com/docker-library/p
当我的 android 应用程序尝试读取 android 短信数据库时,我遇到了这个崩溃。读取android短信数据库的代码类似于下面的代码 fragment : String SMS_URI = "
我有一个 public kit repo,我推送了 v1.0.3 并具有以下结构 go -database --database.go --go.mod --go.sum 我需要它 require g
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 9 年前。 Improve this qu
我们正在使用MySQL数据库在Go中创建一个Web应用程序。我们的用户一次只能拥有一个活跃的客户端。就像Spotify一样,您一次只能在一台设备上听音乐。为此,我制作了一个映射,将用户ID和作为其值的
我已经尝试在 PostgreSQL 中创建数据库好几天了,遇到了几个问题,但似乎卡住了。 我在 PostgreSQL 中手动创建了一个名为 postgres_development 的数据库,因为 b
我正在创建一个 iMessage 应用程序,它需要连接到与我的常规应用程序相同的数据库。 我调用 FirebaseApp.configure() 并对用户进行身份验证,但出于某种原因,在所有 Data
就像std::unordered_map但所有数据都应存储在磁盘上而不是内存中。 按照我的理解,应该做两部分:索引和存储。我已经学习了一些关于索引的数据结构,比如 Linear-Hash 或 B-Tr
我是一名优秀的程序员,十分优秀!